Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/delibero.git

Started to implement Shiro authentication. Updated graphs to use CPP preprocessor for include files.

AuthorDave Jarvis <email>
Date2015-01-20 13:51:52 GMT-0800
Commit9314aa490145de21565b4e952f6335f8313d923c
Parentf08b7a2
build.gradle
// Authentication and authorization
compile "org.apache.shiro:shiro-core:1.2.3"
+ compile "org.apache.shiro:shiro-web:1.2.3"
// XSLT 2.0 with EXSLT (http://exslt.org/) for XSLT math (e.g., fn:abs)
docs/manual/graphs/build.sh
#!/bin/bash
-# Replace "// IMPORT" with the contents of the style file.
-sed -e '/\/\/ IMPORT/ {
- r style.dot
- d
-}' < $1 | dot -Tsvg > $(basename $1 .dot).svg
+cpp -I. $1 | dot -Tsvg > $(basename $1 .dot).svg
docs/manual/graphs/categories.dot
digraph {
- // IMPORT
+ #include <style.dot>
rankdir="TB";
docs/manual/graphs/navigation-account.dot
digraph CL {
- // IMPORT
+ #include <style.dot>
Account -> {Implications Interests Edits Proposals Votes Views Flags};
docs/manual/graphs/navigation-home.dot
digraph CL {
- // IMPORT
+ #include <style.dot>
rankdir="LR";
docs/manual/graphs/reputation.dot
digraph CL {
- // IMPORT
+ #include <style.dot>
rankdir="LR";
source/java/to/discuss/App.java
import org.apache.shiro.subject.Subject;
import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.AuthenticationToken;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.web.util.SavedRequest;
+import org.apache.shiro.web.util.WebUtils;
import to.discuss.util.AppURIResolver;
public App() {
+ }
+
+ protected synchronized void doPost(
+ HttpServletRequest request,
+ HttpServletResponse response ) throws IOException, ServletException
+ {
+ Subject user = SecurityUtils.getSubject();
+
+ String u = request.getParameter( "account" );
+ String p = request.getParameter( "password" );
+
+ AuthenticationToken token = new UsernamePasswordToken( u, p );
+
+ try {
+ user.login( token );
+ }
+ catch( Exception e ) {
+ return;
+ }
+
+ SavedRequest s = WebUtils.getAndClearSavedRequest( request );
+ response.sendRedirect( s.getRequestUrl() );
}
*/
private void sendContent() throws Exception {
- Subject user = SecurityUtils.getSubject();
+ //Subject user = SecurityUtils.getSubject();
Transformer transformer = getTransformer();
source/xsl/common.xsl
<!-- Application context that responds to HTTP requests. -->
-<xsl:param name="CONTEXT" select="'app'"/>
+<xsl:param name="CONTEXT" select="'/app'"/>
<xsl:template match="/">
<xsl:template match="*[@id]">
<div class="{local-name()}"><a
- href="/{$CONTEXT}/{local-name()}/{@id}"><xsl:apply-templates
+ href="{$CONTEXT}/{local-name()}/{@id}"><xsl:apply-templates
select="node()|*"/></a></div>
</xsl:template>
<xsl:template match="item" mode="menu">
<li class="item">
- <a href="/{$CONTEXT}/{@link}"><xsl:apply-templates/></a>
+ <a href="{$CONTEXT}/{@link}"><xsl:apply-templates/></a>
</li>
</xsl:template>
source/xsl/login.xsl
<xsl:template match="policy">
- <form id="login" method="post" action="{$CONTEXT}/">
+ <form id="login" method="post" action="{$CONTEXT}/login" autocomplete="off">
<fieldset form="login" name="login">
- <input id="account" type="text" name="account" placeholder="Account"/><br/>
- <input type="password" name="password" placeholder="Password"/><br/>
+ <input type="text" autocomplete="off" id="account" name="account"
+ placeholder="Account"/><br/>
+ <input type="password" autocomplete="off" id="password" name="password"
+ placeholder="Password"/><br/>
<button type="submit">Log In</button>
</fieldset>
Delta41 lines added, 16 lines removed, 25-line increase