| Author | Dave Jarvis <email> |
|---|---|
| Date | 2015-01-20 13:51:52 GMT-0800 |
| Commit | 9314aa490145de21565b4e952f6335f8313d923c |
| Parent | f08b7a2 |
| // 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) |
| #!/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 | ||
| digraph { | ||
| - // IMPORT | ||
| + #include <style.dot> | ||
| rankdir="TB"; |
| digraph CL { | ||
| - // IMPORT | ||
| + #include <style.dot> | ||
| Account -> {Implications Interests Edits Proposals Votes Views Flags}; |
| digraph CL { | ||
| - // IMPORT | ||
| + #include <style.dot> | ||
| rankdir="LR"; |
| digraph CL { | ||
| - // IMPORT | ||
| + #include <style.dot> | ||
| rankdir="LR"; |
| 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(); | ||
| <!-- 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> | ||
| <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> |
| Delta | 41 lines added, 16 lines removed, 25-line increase |
|---|