You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by bd...@apache.org on 2016/10/24 14:33:53 UTC

svn commit: r1766414 [12/16] - /shiro/site/publish/

Modified: shiro/site/publish/sessionmanager.html
URL: http://svn.apache.org/viewvc/shiro/site/publish/sessionmanager.html?rev=1766414&r1=1766413&r2=1766414&view=diff
==============================================================================
--- shiro/site/publish/sessionmanager.html (original)
+++ shiro/site/publish/sessionmanager.html Mon Oct 24 14:33:52 2016
@@ -78,13 +78,36 @@
 
         <div id="content">
 
-            <p>TODO</p>
+            <p>This page has been moved.  You are being redirected.</p>
 
-<h2><a name="SessionManager-Lendahandwithdocumentation"></a>Lend a hand with documentation </h2>
+<div class="panelMacro">
+    <table class="noteMacro">
+        <colgroup span="1">
+            <col span="1" width="24">
+            <col span="1">
+        </colgroup>
+        <tbody>
+        <tr>
+            <td colspan="1" rowspan="1" valign="top">
+                <i class="fa fa-warning"></i>
+            </td>
+
+            <td colspan="1" rowspan="1">
+                <b>Redirection Notice</b>
+                <br clear="none">
+                This page should redirect to <a href="session-management.html" title="Session Management">Session Management</a>.
+            </td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+
+<script type="text/javascript">
+    <!--
+    window.location = "session-management.html"
+    //-->
+</script>
 
-<p>While we hope this documentation helps you with the work you're doing with Apache Shiro, the community is improving and expanding the documentation all the time.  If you'd like to help the Shiro project, please consider corrected, expanding, or adding documentation where you see a need. Every little bit of help you provide expands the community and in turn improves Shiro. </p>
-
-<p>The easiest way to contribute your documentation is to send it to the <a class="external-link" href="http://shiro-user.582556.n2.nabble.com/" rel="nofollow">User Forum</a> or the <a href="mailing-lists.html" title="Mailing Lists">User Mailing List</a>.</p>
 
         </div>
 

Modified: shiro/site/publish/spring.html
URL: http://svn.apache.org/viewvc/shiro/site/publish/spring.html?rev=1766414&r1=1766413&r2=1766414&view=diff
==============================================================================
--- shiro/site/publish/spring.html (original)
+++ shiro/site/publish/spring.html Mon Oct 24 14:33:52 2016
@@ -78,232 +78,171 @@
 
         <div id="content">
 
-            <h1><a name="Spring-IntegratingApacheShirointoSpringbasedApplications"></a>Integrating Apache Shiro into Spring-based Applications</h1>
-
-<table align="right" width="275" style="margin-left: 20px; margin-bottom: 20px; border-style: solid; border-width: 2px; border-color: navy" cellpadding="10px">
-
-<tr>
-<td>
+            <a name="Spring-IntegratingApacheShirointoSpringbasedApplications"></a>
+<h1>Integrating Apache Shiro into Spring-based Applications</h1>
+<table align="right" width="275" style="margin-left: 20px; margin-bottom: 20px; border-style: solid; border-width: 2px; border-color: navy" cellpadding="10px"><tbody><tr><td>
 <div id="border">
-	
+        
   <h3><a href="web.html">Web Apps with Shiro</a></h3>
-  <p>Detailed support for integrating Shiro into web applications. </br><span style="font-size:11"><a href="web.html">Read More &gt;&gt;</a></span></p>
-	
+  <p>Detailed support for integrating Shiro into web applications. <br><span style="font-size:11"><a href="web.html">Read More &gt;&gt;</a></span></p>
+    
   <h3><a href="webapp-tutorial.html">Web App Tutorial</a></h3>
-  <p>Step-by-step tutorial for securing a web application with Shiro. </br><span style="font-size:11"><a href="webapp-tutorial.html">Read More &gt;&gt;</a></span></p>
+  <p>Step-by-step tutorial for securing a web application with Shiro. <br><span style="font-size:11"><a href="webapp-tutorial.html">Read More &gt;&gt;</a></span></p>
 
 </div>
-</td>
-</tr>
-</table>
-
-<p>This page covers the ways to integrate Shiro into <a class="external-link" href="http://spring.io" rel="nofollow">Spring</a>-based applications.</p>
-
-<p>Shiro's JavaBeans compatibility makes it perfectly suited to be configured via Spring XML or other Spring-based configuration mechanisms.  Shiro applications need an application singleton <tt>SecurityManager</tt> instance.  Note that this does not have to be a <em>static</em> singleton, but there should only be a single instance used by the application, whether its a static singleton or not.</p>
-
+</td></tr></tbody></table>
+<p>This page covers the ways to integrate Shiro into <a href="http://spring.io">Spring</a>-based applications.</p>
+<p>Shiro&rsquo;s JavaBeans compatibility makes it perfectly suited to be configured via Spring XML or other Spring-based configuration mechanisms. Shiro applications need an application singleton <code>SecurityManager</code> instance. Note that this does not have to be a <em>static</em> singleton, but there should only be a single instance used by the application, whether its a static singleton or not.</p>
 <h2><a name="Spring-StandaloneApplications"></a>Standalone Applications</h2>
-
-<p>Here is the simplest way to enable an application singleton <tt>SecurityManager</tt> in Spring applications:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag"><span class="code-comment">&lt;!-- Define the realm you want to use to connect to your back-end security datasource: --&gt;</span></span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"myRealm"</span> class=<span class="code-quote">"..."</span>&gt;</span>
-...
-<span class="code-tag">&lt;/bean&gt;</span>
-
-<span class="code-tag">&lt;bean id=<span class="code-quote">"securityManager"</span> class=<span class="code-quote">"org.apache.shiro.mgt.DefaultSecurityManager"</span>&gt;</span>
-    <span class="code-tag"><span class="code-comment">&lt;!-- Single realm app.  If you have multiple realms, use the 'realms' property instead. --&gt;</span></span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"realm"</span> ref=<span class="code-quote">"myRealm"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"lifecycleBeanPostProcessor"</span> class=<span class="code-quote">"org.apache.shiro.spring.LifecycleBeanPostProcessor"</span>/&gt;</span>
-
-<span class="code-tag"><span class="code-comment">&lt;!-- For simplest integration, so that all SecurityUtils.* methods work in all cases, --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- make the securityManager bean a static singleton.  DO NOT do this in web         --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- applications - see the 'Web Applications' section below instead.                 --&gt;</span></span>
-<span class="code-tag">&lt;bean class=<span class="code-quote">"org.springframework.beans.factory.config.MethodInvokingFactoryBean"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"staticMethod"</span> value=<span class="code-quote">"org.apache.shiro.SecurityUtils.setSecurityManager"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"arguments"</span> ref=<span class="code-quote">"securityManager"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-
-<h2><a name="Spring-WebApplications"></a>Web Applications</h2>
-
-<p>Shiro has first-rate support for Spring web applications.  In a web application, all Shiro-accessible web requests must go through a master Shiro Filter.  This filter itself is extremely powerful, allowing for <br clear="none">
-ad-hoc custom filter chains to be executed based on any URL path expression.</p>
-
-<p>Prior to Shiro 1.0, you had to use a hybrid approach in Spring web applications, defining the Shiro filter and<br clear="none">
-all of its configuration properties in web.xml but define the <tt>SecurityManager</tt> in Spring XML.  This was a little frustrating since you couldn't 1) consolidate your configuration in one place and 2) leverage the configuration power of the more advanced Spring features, like the <tt>PropertyPlaceholderConfigurer</tt> or abstract beans to consolidate common configuration.</p>
-
+<p>Here is the simplest way to enable an application singleton <code>SecurityManager</code> in Spring applications:</p>
+<pre><code class="xml">&lt;!-- Define the realm you want to use to connect to your back-end security datasource: --&gt;
+&lt;bean id=&quot;myRealm&quot; class=&quot;...&quot;&gt;
+    ...
+&lt;/bean&gt;
+
+&lt;bean id=&quot;securityManager&quot; class=&quot;org.apache.shiro.mgt.DefaultSecurityManager&quot;&gt;
+    &lt;!-- Single realm app.  If you have multiple realms, use the &#39;realms&#39; property instead. --&gt;
+    &lt;property name=&quot;realm&quot; ref=&quot;myRealm&quot;/&gt;
+&lt;/bean&gt;
+
+&lt;bean id=&quot;lifecycleBeanPostProcessor&quot; class=&quot;org.apache.shiro.spring.LifecycleBeanPostProcessor&quot;/&gt;
+
+&lt;!-- For simplest integration, so that all SecurityUtils.* methods work in all cases, --&gt;
+&lt;!-- make the securityManager bean a static singleton.  DO NOT do this in web         --&gt;
+&lt;!-- applications - see the &#39;Web Applications&#39; section below instead.                 --&gt;
+&lt;bean class=&quot;org.springframework.beans.factory.config.MethodInvokingFactoryBean&quot;&gt;
+    &lt;property name=&quot;staticMethod&quot; value=&quot;org.apache.shiro.SecurityUtils.setSecurityManager&quot;/&gt;
+    &lt;property name=&quot;arguments&quot; ref=&quot;securityManager&quot;/&gt;
+&lt;/bean&gt;
+</code></pre>
+<a name="Spring-WebApplications"></a>
+<h2><a href="#web-applications" name="web-applications">Web Applications</a></h2>
+<p>Shiro has first-rate support for Spring web applications. In a web application, all Shiro-accessible web requests must go through a master Shiro Filter. This filter itself is extremely powerful, allowing for<br/>ad-hoc custom filter chains to be executed based on any URL path expression.</p>
+<p>Prior to Shiro 1.0, you had to use a hybrid approach in Spring web applications, defining the Shiro filter and<br/>all of its configuration properties in web.xml but define the <code>SecurityManager</code> in Spring XML. This was a little frustrating since you couldn&rsquo;t 1) consolidate your configuration in one place and 2) leverage the configuration power of the more advanced Spring features, like the <code>PropertyPlaceholderConfigurer</code> or abstract beans to consolidate common configuration.</p>
 <p>Now in Shiro 1.0 and later, all Shiro configuration is done in Spring XML providing access to the more robust Spring configuration mechanisms.</p>
-
 <p>Here is how to configure Shiro in a Spring-based web application:</p>
-
-<h3><a name="Spring-web.xml"></a>web.xml</h3>
-
-<p>In addition to your other Spring web.xml elements (<tt>ContextLoaderListener</tt>, <tt>Log4jConfigListener</tt>, etc), define the following filter and filter mapping:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag"><span class="code-comment">&lt;!-- The filter-name matches name of a 'shiroFilter' bean inside applicationContext.xml --&gt;</span></span>
-<span class="code-tag">&lt;filter&gt;</span>
-    <span class="code-tag">&lt;filter-name&gt;</span>shiroFilter<span class="code-tag">&lt;/filter-name&gt;</span>
-    <span class="code-tag">&lt;filter-class&gt;</span>org.springframework.web.filter.DelegatingFilterProxy<span class="code-tag">&lt;/filter-class&gt;</span>
-    <span class="code-tag">&lt;init-param&gt;</span>
-        <span class="code-tag">&lt;param-name&gt;</span>targetFilterLifecycle<span class="code-tag">&lt;/param-name&gt;</span>
-        <span class="code-tag">&lt;param-value&gt;</span>true<span class="code-tag">&lt;/param-value&gt;</span>
-    <span class="code-tag">&lt;/init-param&gt;</span>
-<span class="code-tag">&lt;/filter&gt;</span>
+<a name="Spring-web.xml"></a>
+<h3>web.xml</h3>
+<p>In addition to your other Spring web.xml elements (<code>ContextLoaderListener</code>, <code>Log4jConfigListener</code>, etc), define the following filter and filter mapping:</p>
+<pre><code class="xml">&lt;!-- The filter-name matches name of a &#39;shiroFilter&#39; bean inside applicationContext.xml --&gt;
+&lt;filter&gt;
+    &lt;filter-name&gt;shiroFilter&lt;/filter-name&gt;
+    &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
+    &lt;init-param&gt;
+        &lt;param-name&gt;targetFilterLifecycle&lt;/param-name&gt;
+        &lt;param-value&gt;true&lt;/param-value&gt;
+    &lt;/init-param&gt;
+&lt;/filter&gt;
 
 ...
 
-<span class="code-tag"><span class="code-comment">&lt;!-- Make sure any request you want accessible to Shiro is filtered. /* catches all --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- requests.  Usually this filter mapping is defined first (before all others) to --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- ensure that Shiro works in subsequent filters in the filter chain:             --&gt;</span></span>
-<span class="code-tag">&lt;filter-mapping&gt;</span>
-    <span class="code-tag">&lt;filter-name&gt;</span>shiroFilter<span class="code-tag">&lt;/filter-name&gt;</span>
-    <span class="code-tag">&lt;url-pattern&gt;</span>/*<span class="code-tag">&lt;/url-pattern&gt;</span>
-<span class="code-tag">&lt;/filter-mapping&gt;</span>
-</pre>
-</div></div>
-
-<h3><a name="Spring-applicationContext.xml"></a>applicationContext.xml</h3>
-
-<p>In your applicationContext.xml file, define the web-enabled <tt>SecurityManager</tt> and the 'shiroFilter' bean that will be referenced from <tt>web.xml</tt>.</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;bean id=<span class="code-quote">"shiroFilter"</span> class=<span class="code-quote">"org.apache.shiro.spring.web.ShiroFilterFactoryBean"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"securityManager"</span> ref=<span class="code-quote">"securityManager"</span>/&gt;</span>
+&lt;!-- Make sure any request you want accessible to Shiro is filtered. /* catches all --&gt;
+&lt;!-- requests.  Usually this filter mapping is defined first (before all others) to --&gt;
+&lt;!-- ensure that Shiro works in subsequent filters in the filter chain:             --&gt;
+&lt;filter-mapping&gt;
+    &lt;filter-name&gt;shiroFilter&lt;/filter-name&gt;
+    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
+&lt;/filter-mapping&gt;
+</code></pre>
+<a name="Spring-applicationContext.xml"></a>
+<h3>applicationContext.xml</h3>
+<p>In your applicationContext.xml file, define the web-enabled <code>SecurityManager</code> and the &lsquo;shiroFilter&rsquo; bean that will be referenced from <code>web.xml</code>.</p>
+<pre><code class="xml">&lt;bean id=&quot;shiroFilter&quot; class=&quot;org.apache.shiro.spring.web.ShiroFilterFactoryBean&quot;&gt;
+    &lt;property name=&quot;securityManager&quot; ref=&quot;securityManager&quot;/&gt;
     &lt;!-- override these for application-specific URLs if you like:
-    <span class="code-tag">&lt;property name=<span class="code-quote">"loginUrl"</span> value=<span class="code-quote">"/login.jsp"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"successUrl"</span> value=<span class="code-quote">"/home.jsp"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"unauthorizedUrl"</span> value=<span class="code-quote">"/unauthorized.jsp"</span>/&gt;</span> --&gt;
-    <span class="code-tag"><span class="code-comment">&lt;!-- The 'filters' property is not necessary since any declared javax.servlet.Filter bean  --&gt;</span></span>
-    <span class="code-tag"><span class="code-comment">&lt;!-- defined will be automatically acquired and available via its beanName in chain        --&gt;</span></span>
-    <span class="code-tag"><span class="code-comment">&lt;!-- definitions, but you can perform instance overrides or name aliases here if you like: --&gt;</span></span>
-    <span class="code-tag">&lt;!-- &lt;property name=<span class="code-quote">"filters"</span>&gt;</span>
-        <span class="code-tag">&lt;util:map&gt;</span>
-            <span class="code-tag">&lt;entry key=<span class="code-quote">"anAlias"</span> value-ref=<span class="code-quote">"someFilter"</span>/&gt;</span>
-        <span class="code-tag">&lt;/util:map&gt;</span>
-    <span class="code-tag">&lt;/property&gt;</span> --&gt;
-    <span class="code-tag">&lt;property name=<span class="code-quote">"filterChainDefinitions"</span>&gt;</span>
-        <span class="code-tag">&lt;value&gt;</span>
+    &lt;property name=&quot;loginUrl&quot; value=&quot;/login.jsp&quot;/&gt;
+    &lt;property name=&quot;successUrl&quot; value=&quot;/home.jsp&quot;/&gt;
+    &lt;property name=&quot;unauthorizedUrl&quot; value=&quot;/unauthorized.jsp&quot;/&gt; --&gt;
+    &lt;!-- The &#39;filters&#39; property is not necessary since any declared javax.servlet.Filter bean  --&gt;
+    &lt;!-- defined will be automatically acquired and available via its beanName in chain        --&gt;
+    &lt;!-- definitions, but you can perform instance overrides or name aliases here if you like: --&gt;
+    &lt;!-- &lt;property name=&quot;filters&quot;&gt;
+        &lt;util:map&gt;
+            &lt;entry key=&quot;anAlias&quot; value-ref=&quot;someFilter&quot;/&gt;
+        &lt;/util:map&gt;
+    &lt;/property&gt; --&gt;
+    &lt;property name=&quot;filterChainDefinitions&quot;&gt;
+        &lt;value&gt;
             # some example chain definitions:
             /admin/** = authc, roles[admin]
             /docs/** = authc, perms[document:read]
             /** = authc
             # more URL-to-FilterChain definitions here
-        <span class="code-tag">&lt;/value&gt;</span>
-    <span class="code-tag">&lt;/property&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-
-<span class="code-tag"><span class="code-comment">&lt;!-- Define any javax.servlet.Filter beans you want anywhere in this application context.   --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- They will automatically be acquired by the 'shiroFilter' bean above and made available --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- to the 'filterChainDefinitions' property.  Or you can manually/explicitly add them     --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- to the shiroFilter's 'filters' Map if desired. See its JavaDoc for more details.       --&gt;</span></span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"someFilter"</span> class=<span class="code-quote">"..."</span>/&gt;</span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"anotherFilter"</span> class=<span class="code-quote">"..."</span>&gt;</span> ... <span class="code-tag">&lt;/bean&gt;</span>
+        &lt;/value&gt;
+    &lt;/property&gt;
+&lt;/bean&gt;
+
+&lt;!-- Define any javax.servlet.Filter beans you want anywhere in this application context.   --&gt;
+&lt;!-- They will automatically be acquired by the &#39;shiroFilter&#39; bean above and made available --&gt;
+&lt;!-- to the &#39;filterChainDefinitions&#39; property.  Or you can manually/explicitly add them     --&gt;
+&lt;!-- to the shiroFilter&#39;s &#39;filters&#39; Map if desired. See its JavaDoc for more details.       --&gt;
+&lt;bean id=&quot;someFilter&quot; class=&quot;...&quot;/&gt;
+&lt;bean id=&quot;anotherFilter&quot; class=&quot;...&quot;&gt; ... &lt;/bean&gt;
 ...
 
-<span class="code-tag">&lt;bean id=<span class="code-quote">"securityManager"</span> class=<span class="code-quote">"org.apache.shiro.web.mgt.DefaultWebSecurityManager"</span>&gt;</span>
-    <span class="code-tag"><span class="code-comment">&lt;!-- Single realm app.  If you have multiple realms, use the 'realms' property instead. --&gt;</span></span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"realm"</span> ref=<span class="code-quote">"myRealm"</span>/&gt;</span>
+&lt;bean id=&quot;securityManager&quot; class=&quot;org.apache.shiro.web.mgt.DefaultWebSecurityManager&quot;&gt;
+    &lt;!-- Single realm app.  If you have multiple realms, use the &#39;realms&#39; property instead. --&gt;
+    &lt;property name=&quot;realm&quot; ref=&quot;myRealm&quot;/&gt;
     &lt;!-- By default the servlet container sessions will be used.  Uncomment this line
-         to use shiro's native sessions (see the JavaDoc for more): --&gt;
-    <span class="code-tag"><span class="code-comment">&lt;!-- &lt;property name=<span class="code-quote">"sessionMode"</span> value=<span class="code-quote">"native"</span>/&gt;</span> --&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"lifecycleBeanPostProcessor"</span> class=<span class="code-quote">"org.apache.shiro.spring.LifecycleBeanPostProcessor"</span>/&gt;</span>
-
-<span class="code-tag"><span class="code-comment">&lt;!-- Define the Shiro Realm implementation you want to use to connect to your back-end --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- security datasource: --&gt;</span></span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"myRealm"</span> class=<span class="code-quote">"..."</span>&gt;</span>
-...
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-<h2><a name="Spring-EnablingShiroAnnotations"></a>Enabling Shiro Annotations</h2>
-
-<p>In both standalone and web applications, you might want to use Shiro's Annotations for security checks (for example, <tt>@RequiresRoles</tt>, <tt>@RequiresPermissions</tt>, etc.  This requires Shiro's Spring AOP integration to scan for the appropriate annotated classes and perform security logic as necessary. </p>
-
-<p>Here is how to enable these annotations.  Just add these two bean definitions to <tt>applicationContext.xml</tt>:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag"><span class="code-comment">&lt;!-- Enable Shiro Annotations for Spring-configured beans.  Only run after --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- the lifecycleBeanProcessor has run: --&gt;</span></span>
-<span class="code-tag">&lt;bean class=<span class="code-quote">"org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"</span> depends-on=<span class="code-quote">"lifecycleBeanPostProcessor"</span>/&gt;</span>
-<span class="code-tag">&lt;bean class=<span class="code-quote">"org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"securityManager"</span> ref=<span class="code-quote">"securityManager"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-<h2><a name="Spring-SecureSpringRemoting"></a>Secure Spring Remoting</h2>
-
-<p>There are two parts to Shiro's Spring remoting support: Configuration for the client making the remoting call and configuration for the server receiving and processing the remoting call.</p>
-
-<h3><a name="Spring-ServersideConfiguration"></a>Server-side Configuration</h3>
-
-<p>When a remote method invocation comes in to a Shiro-enabled server, the <a href="subject.html" title="Subject">Subject</a> associated with that RPC call must be bound to the receiving thread for access during the thread's execution.  This is done by defining Shiro's <tt>SecureRemoteInvocationExecutor</tt> bean in <tt>applicationContext.xml</tt>:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag"><span class="code-comment">&lt;!-- Secure Spring remoting:  Ensure any Spring Remoting method invocations --&gt;</span></span>
-<span class="code-tag"><span class="code-comment">&lt;!-- can be associated with a Subject for security checks. --&gt;</span></span>
-<span class="code-tag">&lt;bean id=<span class="code-quote">"secureRemoteInvocationExecutor"</span> class=<span class="code-quote">"org.apache.shiro.spring.remoting.SecureRemoteInvocationExecutor"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"securityManager"</span> ref=<span class="code-quote">"securityManager"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-<p>Once you have defined this bean, you must plug it in to whatever remoting <tt>Exporter</tt> you are using to export/expose your services.  <tt>Exporter</tt> implementations are defined according to the remoting mechanism/protocol in use.  See Spring's <a class="external-link" href="http://docs.spring.io/spring/docs/2.5.x/reference/remoting.html" rel="nofollow">Remoting chapter</a> on defining <tt>Exporter</tt> beans.</p>
-
-<p>For example, if using HTTP-based remoting (notice the property reference to the <tt>secureRemoteInvocationExecutor</tt> bean):</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;bean name=<span class="code-quote">"/someService"</span> class=<span class="code-quote">"org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"service"</span> ref=<span class="code-quote">"someService"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"serviceInterface"</span> value=<span class="code-quote">"com.pkg.service.SomeService"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"remoteInvocationExecutor"</span> ref=<span class="code-quote">"secureRemoteInvocationExecutor"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-<h3><a name="Spring-ClientsideConfiguration"></a>Client-side Configuration</h3>
-
-<p>When a remote call is being executed, the <tt>Subject</tt> identifying information must be attached to the remoting payload to let the server know who is making the call.  If the client is a Spring-based client, that association is done via Shiro's <tt>SecureRemoteInvocationFactory</tt>:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;bean id=<span class="code-quote">"secureRemoteInvocationFactory"</span> class=<span class="code-quote">"org.apache.shiro.spring.remoting.SecureRemoteInvocationFactory"</span>/&gt;</span>
-</pre>
-</div></div>
-
-<p>Then after you've defined this bean, you need to plug it in to the protocol-specific Spring remoting <tt>ProxyFactoryBean</tt> you're using.</p>
-
-<p>For example, if you were using HTTP-based remoting (notice the property reference to the <tt>secureRemoteInvocationFactory</tt> bean defined above):</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;bean id=<span class="code-quote">"someService"</span> class=<span class="code-quote">"org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"</span>&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"serviceUrl"</span> value=<span class="code-quote">"http://host:port/remoting/someService"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"serviceInterface"</span> value=<span class="code-quote">"com.pkg.service.SomeService"</span>/&gt;</span>
-    <span class="code-tag">&lt;property name=<span class="code-quote">"remoteInvocationFactory"</span> ref=<span class="code-quote">"secureRemoteInvocationFactory"</span>/&gt;</span>
-<span class="code-tag">&lt;/bean&gt;</span>
-</pre>
-</div></div>
-
-<h2><a name="Spring-Lendahandwithdocumentation"></a>Lend a hand with documentation </h2>
-
-<p>While we hope this documentation helps you with the work you're doing with Apache Shiro, the community is improving and expanding the documentation all the time.  If you'd like to help the Shiro project, please consider corrected, expanding, or adding documentation where you see a need. Every little bit of help you provide expands the community and in turn improves Shiro. </p>
-
-<p>The easiest way to contribute your documentation is to send it to the <a class="external-link" href="http://shiro-user.582556.n2.nabble.com/" rel="nofollow">User Forum</a> or the <a href="mailing-lists.html" title="Mailing Lists">User Mailing List</a>.</p>
-
+         to use shiro&#39;s native sessions (see the JavaDoc for more): --&gt;
+    &lt;!-- &lt;property name=&quot;sessionMode&quot; value=&quot;native&quot;/&gt; --&gt;
+&lt;/bean&gt;
+&lt;bean id=&quot;lifecycleBeanPostProcessor&quot; class=&quot;org.apache.shiro.spring.LifecycleBeanPostProcessor&quot;/&gt;
+
+&lt;!-- Define the Shiro Realm implementation you want to use to connect to your back-end --&gt;
+&lt;!-- security datasource: --&gt;
+&lt;bean id=&quot;myRealm&quot; class=&quot;...&quot;&gt;
+    ...
+&lt;/bean&gt;
+</code></pre>
+<a name="Spring-EnablingShiroAnnotations"></a>
+<h2><a href="#enabling-shiro-annotations" name="enabling-shiro-annotations">Enabling Shiro Annotations</a></h2>
+<p>In both standalone and web applications, you might want to use Shiro&rsquo;s Annotations for security checks (for example, <code>@RequiresRoles</code>, <code>@RequiresPermissions</code>, etc. This requires Shiro&rsquo;s Spring AOP integration to scan for the appropriate annotated classes and perform security logic as necessary.</p>
+<p>Here is how to enable these annotations. Just add these two bean definitions to <code>applicationContext.xml</code>:</p>
+<pre><code class="xml">&lt;!-- Enable Shiro Annotations for Spring-configured beans.  Only run after --&gt;
+&lt;!-- the lifecycleBeanProcessor has run: --&gt;
+&lt;bean class=&quot;org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator&quot; depends-on=&quot;lifecycleBeanPostProcessor&quot;/&gt;
+    &lt;bean class=&quot;org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor&quot;&gt;
+    &lt;property name=&quot;securityManager&quot; ref=&quot;securityManager&quot;/&gt;
+&lt;/bean&gt;
+</code></pre>
+<a name="Spring-SecureSpringRemoting"></a>
+<h2><a href="#secure-spring-remoting" name="secure-spring-remoting">Secure Spring Remoting</a></h2>
+<p>There are two parts to Shiro&rsquo;s Spring remoting support: Configuration for the client making the remoting call and configuration for the server receiving and processing the remoting call.</p>
+<a name="Spring-ServersideConfiguration"></a>
+<h3>Server-side Configuration</h3>
+<p>When a remote method invocation comes in to a Shiro-enabled server, the <a href="subject.html" title="Subject">Subject</a> associated with that RPC call must be bound to the receiving thread for access during the thread&rsquo;s execution. This is done by defining Shiro&rsquo;s <code>SecureRemoteInvocationExecutor</code> bean in <code>applicationContext.xml</code>:</p>
+<pre><code class="xml">&lt;!-- Secure Spring remoting:  Ensure any Spring Remoting method invocations --&gt;
+&lt;!-- can be associated with a Subject for security checks. --&gt;
+&lt;bean id=&quot;secureRemoteInvocationExecutor&quot; class=&quot;org.apache.shiro.spring.remoting.SecureRemoteInvocationExecutor&quot;&gt;
+    &lt;property name=&quot;securityManager&quot; ref=&quot;securityManager&quot;/&gt;
+&lt;/bean&gt;
+</code></pre>
+<p>Once you have defined this bean, you must plug it in to whatever remoting <code>Exporter</code> you are using to export/expose your services. <code>Exporter</code> implementations are defined according to the remoting mechanism/protocol in use. See Spring&rsquo;s <a href="http://docs.spring.io/spring/docs/2.5.x/reference/remoting.html">Remoting chapter</a> on defining <code>Exporter</code> beans.</p>
+<p>For example, if using HTTP-based remoting (notice the property reference to the <code>secureRemoteInvocationExecutor</code> bean):</p>
+<pre><code class="xml">&lt;bean name=&quot;/someService&quot; class=&quot;org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter&quot;&gt;
+    &lt;property name=&quot;service&quot; ref=&quot;someService&quot;/&gt;
+    &lt;property name=&quot;serviceInterface&quot; value=&quot;com.pkg.service.SomeService&quot;/&gt;
+    &lt;property name=&quot;remoteInvocationExecutor&quot; ref=&quot;secureRemoteInvocationExecutor&quot;/&gt;
+&lt;/bean&gt;
+</code></pre>
+<a name="Spring-ClientsideConfiguration"></a>
+<h3>Client-side Configuration</h3>
+<p>When a remote call is being executed, the <code>Subject</code> identifying information must be attached to the remoting payload to let the server know who is making the call. If the client is a Spring-based client, that association is done via Shiro&rsquo;s <code>SecureRemoteInvocationFactory</code>:</p>
+<pre><code class="xml">&lt;bean id=&quot;secureRemoteInvocationFactory&quot; class=&quot;org.apache.shiro.spring.remoting.SecureRemoteInvocationFactory&quot;/&gt;
+</code></pre>
+<p>Then after you&rsquo;ve defined this bean, you need to plug it in to the protocol-specific Spring remoting <code>ProxyFactoryBean</code> you&rsquo;re using.</p>
+<p>For example, if you were using HTTP-based remoting (notice the property reference to the <code>secureRemoteInvocationFactory</code> bean defined above):</p>
+<pre><code class="xml">&lt;bean id=&quot;someService&quot; class=&quot;org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean&quot;&gt;
+    &lt;property name=&quot;serviceUrl&quot; value=&quot;http://host:port/remoting/someService&quot;/&gt;
+    &lt;property name=&quot;serviceInterface&quot; value=&quot;com.pkg.service.SomeService&quot;/&gt;
+    &lt;property name=&quot;remoteInvocationFactory&quot; ref=&quot;secureRemoteInvocationFactory&quot;/&gt;
+&lt;/bean&gt;
+</code></pre>
+<a name="Spring-Lendahandwithdocumentation"></a>
+<h2><a href="#lend-a-hand-with-documentation" name="lend-a-hand-with-documentation">Lend a hand with documentation</a></h2>
+<p>While we hope this documentation helps you with the work you&rsquo;re doing with Apache Shiro, the community is improving and expanding the documentation all the time. If you&rsquo;d like to help the Shiro project, please consider corrected, expanding, or adding documentation where you see a need. Every little bit of help you provide expands the community and in turn improves Shiro.</p>
+<p>The easiest way to contribute your documentation is to send it to the <a href="http://shiro-user.582556.n2.nabble.com/">User Forum</a> or the <a href="mailing-lists.html" title="Mailing Lists">User Mailing List</a>.</p>
 
         </div>
 

Modified: shiro/site/publish/subject.html
URL: http://svn.apache.org/viewvc/shiro/site/publish/subject.html?rev=1766414&r1=1766413&r2=1766414&view=diff
==============================================================================
--- shiro/site/publish/subject.html (original)
+++ shiro/site/publish/subject.html Mon Oct 24 14:33:52 2016
@@ -78,155 +78,98 @@
 
         <div id="content">
 
-            <h1><a name="Subject-UnderstandingSubjectsinApacheShiro"></a>Understanding Subjects in Apache Shiro</h1>
-
-<p>Without question, the most important concept in Apache Shiro is the <tt>Subject</tt>.  'Subject' is just a security term that means a security-specific 'view' of an application user.  A Shiro <tt>Subject</tt> instance represents both security state and operations for a <em>single</em> application user.</p>
-
+            <a name="Subject-UnderstandingSubjectsinApacheShiro"></a>
+<h1><a href="#understanding-subjects-in-apache-shiro" name="understanding-subjects-in-apache-shiro">Understanding Subjects in Apache Shiro</a></h1>
+<p>Without question, the most important concept in Apache Shiro is the <code>Subject</code>. &lsquo;Subject&rsquo; is just a security term that means a security-specific &lsquo;view&rsquo; of an application user. A Shiro <code>Subject</code> instance represents both security state and operations for a <em>single</em> application user.</p>
 <p>These operations include:</p>
-<ul><li>authentication (login)</li><li>authorization (access control)</li><li>session access</li><li>logout</li></ul>
-
-
-<p>We originally wanted to call it 'User' since that "just makes sense", but we decided against it: too many applications have existing APIs that already have their own User classes/frameworks, and we didn't want to conflict with those. Also, in the security world, the term 'Subject' is actually the recognized nomenclature.</p>
-
-<p>Shiro's API encourages a <tt>Subject</tt>-centric programming paradigm for applications.  When coding application logic, most application developers want to know who the <em>currently executing</em> user is.  While the application can usually look up any user via their own mechanisms (UserService, etc), when it comes to security, the most important question is <b>"Who is the <em>current</em> user?"</b></p>
-
-<p>While any Subject can be acquired by using the <tt>SecurityManager</tt>, application code based on only the current user/<tt>Subject</tt> is much more natural and intuitive.</p>
-
-<h2><a name="Subject-TheCurrentlyExecutingSubject"></a>The Currently Executing Subject</h2>
-
-<p>In almost all environments, you can obtain the currently executing <tt>Subject</tt> by using <tt>org.apache.shiro.SecurityUtils</tt>:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject currentUser = SecurityUtils.getSubject();
-</pre>
-</div></div>
-
-<p>The <tt>getSubject()</tt> call in a standalone application might return a <tt>Subject</tt> based on user data in an application-specific location, and in a server environment (e.g. web app), it acquires the Subject based on user data associated with current thread or incoming request.</p>
-
-<p>After you acquire the current <tt>Subject</tt>, what can you do with it?</p>
-
+<ul>
+  <li>authentication (login)</li>
+  <li>authorization (access control)</li>
+  <li>session access</li>
+  <li>logout</li>
+</ul>
+<p>We originally wanted to call it &lsquo;User&rsquo; since that &ldquo;just makes sense&rdquo;, but we decided against it: too many applications have existing APIs that already have their own User classes/frameworks, and we didn&rsquo;t want to conflict with those. Also, in the security world, the term &lsquo;Subject&rsquo; is actually the recognized nomenclature.</p>
+<p>Shiro&rsquo;s API encourages a <code>Subject</code>-centric programming paradigm for applications. When coding application logic, most application developers want to know who the <em>currently executing</em> user is. While the application can usually look up any user via their own mechanisms (UserService, etc), when it comes to security, the most important question is <strong>&ldquo;Who is the <em>current</em> user?&rdquo;</strong></p>
+<p>While any Subject can be acquired by using the <code>SecurityManager</code>, application code based on only the current user/<code>Subject</code> is much more natural and intuitive.</p>
+<a name="Subject-TheCurrentlyExecutingSubject"></a>
+<h2><a href="#the-currently-executing-subject" name="the-currently-executing-subject">The Currently Executing Subject</a></h2>
+<p>In almost all environments, you can obtain the currently executing <code>Subject</code> by using <code>org.apache.shiro.SecurityUtils</code>:</p>
+<pre><code class="java">Subject currentUser = SecurityUtils.getSubject();
+</code></pre>
+<p>The <code>getSubject()</code> call in a standalone application might return a <code>Subject</code> based on user data in an application-specific location, and in a server environment (e.g. web app), it acquires the Subject based on user data associated with current thread or incoming request.</p>
+<p>After you acquire the current <code>Subject</code>, what can you do with it?</p>
 <p>If you want to make things available to the user during their current session with the application, you can get their session:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Session session = currentUser.getSession();
-session.setAttribute( <span class="code-quote">"someKey"</span>, <span class="code-quote">"aValue"</span> );
-</pre>
-</div></div>
-
-<p>The <tt>Session</tt> is a Shiro-specific instance that provides most of what you're used to with regular HttpSessions but with some extra goodies and one <b>big</b> difference:  it does not require an HTTP environment!</p>
-
-<p>If deploying inside a web application, by default the <tt>Session</tt> will be <tt>HttpSession</tt> based.  But, in a non-web environment, like this simple Quickstart, Shiro will automatically use its Enterprise Session Management by default.  This means you get to use the same API in your applications, in any tier, regardless of deployment environment.  This opens a whole new world of applications since any application requiring sessions does not need to be forced to use the <tt>HttpSession</tt> or EJB Stateful Session Beans.  And, any client technology can now share session data.</p>
-
-<p>So now you can acquire a <tt>Subject</tt> and their <tt>Session</tt>.  What about the <em>really</em> useful stuff like checking if they are allowed to do things, like checking against roles and permissions?</p>
-
-<p>Well, we can only do those checks for a known user.  Our <tt>Subject</tt> instance above represents the current user, but <em>who</em> is actually the current user?  Well, they're anonymous - that is, until they log in at least once.  So, let's do that:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">if</span> ( !currentUser.isAuthenticated() ) {
-    <span class="code-comment">//collect user principals and credentials in a gui specific manner
-</span>    <span class="code-comment">//such as username/password html form, X509 certificate, OpenID, etc.
-</span>    <span class="code-comment">//We'll use the username/password example here since it is the most common.
-</span>    <span class="code-comment">//(<span class="code-keyword">do</span> you know what movie <span class="code-keyword">this</span> is from? ;)
-</span>    UsernamePasswordToken token = <span class="code-keyword">new</span> UsernamePasswordToken(<span class="code-quote">"lonestarr"</span>, <span class="code-quote">"vespa"</span>);
-    <span class="code-comment">//<span class="code-keyword">this</span> is all you have to <span class="code-keyword">do</span> to support 'remember me' (no config - built in!):
-</span>    token.setRememberMe(<span class="code-keyword">true</span>);
+<pre><code class="java">Session session = currentUser.getSession();
+session.setAttribute( &quot;someKey&quot;, &quot;aValue&quot; );
+</code></pre>
+<p>The <code>Session</code> is a Shiro-specific instance that provides most of what you&rsquo;re used to with regular HttpSessions but with some extra goodies and one <strong>big</strong> difference: it does not require an HTTP environment!</p>
+<p>If deploying inside a web application, by default the <code>Session</code> will be <code>HttpSession</code> based. But, in a non-web environment, like this simple Quickstart, Shiro will automatically use its Enterprise Session Management by default. This means you get to use the same API in your applications, in any tier, regardless of deployment environment. This opens a whole new world of applications since any application requiring sessions does not need to be forced to use the <code>HttpSession</code> or EJB Stateful Session Beans. And, any client technology can now share session data.</p>
+<p>So now you can acquire a <code>Subject</code> and their <code>Session</code>. What about the <em>really</em> useful stuff like checking if they are allowed to do things, like checking against roles and permissions?</p>
+<p>Well, we can only do those checks for a known user. Our <code>Subject</code> instance above represents the current user, but <em>who</em> is actually the current user? Well, they&rsquo;re anonymous - that is, until they log in at least once. So, let&rsquo;s do that:</p>
+<pre><code class="java">if ( !currentUser.isAuthenticated() ) {
+    //collect user principals and credentials in a gui specific manner
+    //such as username/password html form, X509 certificate, OpenID, etc.
+    //We&#39;ll use the username/password example here since it is the most common.
+    //(do you know what movie this is from? ;)
+    UsernamePasswordToken token = new UsernamePasswordToken(&quot;lonestarr&quot;, &quot;vespa&quot;);
+    //this is all you have to do to support &#39;remember me&#39; (no config - built in!):
+    token.setRememberMe(true);
     currentUser.login(token);
 }
-</pre>
-</div></div>
-
-<p>That's it!  It couldn't be easier.</p>
-
-<p>But what if their login attempt fails?  You can catch all sorts of specific exceptions that tell you exactly what happened:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">try</span> {
+</code></pre>
+<p>That&rsquo;s it! It couldn&rsquo;t be easier.</p>
+<p>But what if their login attempt fails? You can catch all sorts of specific exceptions that tell you exactly what happened:</p>
+<pre><code class="java">try {
     currentUser.login( token );
-    <span class="code-comment">//<span class="code-keyword">if</span> no exception, that's it, we're done!
-</span>} <span class="code-keyword">catch</span> ( UnknownAccountException uae ) {
-    <span class="code-comment">//username wasn't in the system, show them an error message?
-</span>} <span class="code-keyword">catch</span> ( IncorrectCredentialsException ice ) {
-    <span class="code-comment">//password didn't match, <span class="code-keyword">try</span> again?
-</span>} <span class="code-keyword">catch</span> ( LockedAccountException lae ) {
-    <span class="code-comment">//account <span class="code-keyword">for</span> that username is locked - can't login.  Show them a message?
-</span>} 
-    ... more types exceptions to check <span class="code-keyword">if</span> you want ...
-} <span class="code-keyword">catch</span> ( AuthenticationException ae ) {
-    <span class="code-comment">//unexpected condition - error?
-</span>}
-</pre>
-</div></div>
-
-<p>You, as the application/GUI developer can choose to show the end-user messages based on exceptions or not (for example, <tt>"There is no account in the system with that username."</tt>).  There are many different types of exceptions you can check, or throw your own for custom conditions Shiro might not account for.  See the <a class="external-link" href="https://shiro.apache.org/static/current/apidocs/org/apache/shiro/authc/AuthenticationException.html" rel="nofollow">AuthenticationException JavaDoc</a> for more.</p>
-
-<p>Ok, so by now, we have a logged in user.  What else can we do?</p>
-
-<p>Let's say who they are:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-comment">//print their identifying principal (in <span class="code-keyword">this</span> <span class="code-keyword">case</span>, a username):
-</span>log.info( <span class="code-quote">"User ["</span> + currentUser.getPrincipal() + <span class="code-quote">"] logged in successfully."</span> );
-</pre>
-</div></div>
-
+    //if no exception, that&#39;s it, we&#39;re done!
+} catch ( UnknownAccountException uae ) {
+    //username wasn&#39;t in the system, show them an error message?
+} catch ( IncorrectCredentialsException ice ) {
+    //password didn&#39;t match, try again?
+} catch ( LockedAccountException lae ) {
+    //account for that username is locked - can&#39;t login.  Show them a message?
+}
+    ... more types exceptions to check if you want ...
+} catch ( AuthenticationException ae ) {
+    //unexpected condition - error?
+}
+</code></pre>
+<p>You, as the application/GUI developer can choose to show the end-user messages based on exceptions or not (for example, <code>&quot;There is no account in the system with that username.&quot;</code>). There are many different types of exceptions you can check, or throw your own for custom conditions Shiro might not account for. See the <a href="https://shiro.apache.org/static/current/apidocs/org/apache/shiro/authc/AuthenticationException.html">AuthenticationException JavaDoc</a> for more.</p>
+<p>Ok, so by now, we have a logged in user. What else can we do?</p>
+<p>Let&rsquo;s say who they are:</p>
+<pre><code class="java">//print their identifying principal (in this case, a username): 
+log.info( &quot;User [&quot; + currentUser.getPrincipal() + &quot;] logged in successfully.&quot; );
+</code></pre>
 <p>We can also test to see if they have specific role or not:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">if</span> ( currentUser.hasRole( <span class="code-quote">"schwartz"</span> ) ) {
-    log.info(<span class="code-quote">"May the Schwartz be with you!"</span> );
-} <span class="code-keyword">else</span> {
-    log.info( <span class="code-quote">"Hello, mere mortal."</span> );
+<pre><code class="java">if ( currentUser.hasRole( &quot;schwartz&quot; ) ) {
+    log.info(&quot;May the Schwartz be with you!&quot; );
+} else {
+    log.info( &quot;Hello, mere mortal.&quot; );
 }
-</pre>
-</div></div>
-
+</code></pre>
 <p>We can also see if they have a <a href="permissions.html" title="Permissions">permission</a> to act on a certain type of entity:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">if</span> ( currentUser.isPermitted( <span class="code-quote">"lightsaber:weild"</span> ) ) {
-    log.info(<span class="code-quote">"You may use a lightsaber ring.  Use it wisely."</span>);
-} <span class="code-keyword">else</span> {
-    log.info(<span class="code-quote">"Sorry, lightsaber rings are <span class="code-keyword">for</span> schwartz masters only."</span>);
+<pre><code class="java">if ( currentUser.isPermitted( &quot;lightsaber:weild&quot; ) ) {
+    log.info(&quot;You may use a lightsaber ring.  Use it wisely.&quot;);
+} else {
+    log.info(&quot;Sorry, lightsaber rings are for schwartz masters only.&quot;);
 }
-</pre>
-</div></div>
-
+</code></pre>
 <p>Also, we can perform an extremely powerful <em>instance-level</em> <a href="permissions.html" title="Permissions">permission</a> check - the ability to see if the user has the ability to access a specific instance of a type:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-keyword">if</span> ( currentUser.isPermitted( <span class="code-quote">"winnebago:drive:eagle5"</span> ) ) {
-    log.info(<span class="code-quote">"You are permitted to 'drive' the 'winnebago' with license plate (id) 'eagle5'.  "</span> +
-                <span class="code-quote">"Here are the keys - have fun!"</span>);
-} <span class="code-keyword">else</span> {
-    log.info(<span class="code-quote">"Sorry, you aren't allowed to drive the 'eagle5' winnebago!"</span>);
+<pre><code class="java">if ( currentUser.isPermitted( &quot;winnebago:drive:eagle5&quot; ) ) {
+    log.info(&quot;You are permitted to &#39;drive&#39; the &#39;winnebago&#39; with license plate (id) &#39;eagle5&#39;.  &quot; +
+                &quot;Here are the keys - have fun!&quot;);
+} else {
+    log.info(&quot;Sorry, you aren&#39;t allowed to drive the &#39;eagle5&#39; winnebago!&quot;);
 }
-</pre>
-</div></div>
-
+</code></pre>
 <p>Piece of cake, right?</p>
-
 <p>Finally, when the user is done using the application, they can log out:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-currentUser.logout(); <span class="code-comment">//removes all identifying information and invalidates their session too.</span>
-</pre>
-</div></div>
-
+<pre><code class="java">currentUser.logout(); //removes all identifying information and invalidates their session too.
+</code></pre>
 <p>This simple API constitutes 90% of what Shiro end-users will ever have to deal with when using Shiro.</p>
-
-<h2><a name="Subject-CustomSubjectInstances"></a>Custom Subject Instances</h2>
-
+<a name="Subject-CustomSubjectInstances"></a>
+<h2><a href="#custom-subject-instances" name="custom-subject-instances">Custom Subject Instances</a></h2>
 <p>A new feature added in Shiro 1.0 is the ability to construct custom/ad-hoc subject instances for use in special situations.</p>
-
 <div class="panelMacro">
     <table class="noteMacro">
         <colgroup span="1">
@@ -242,25 +185,23 @@ currentUser.logout(); <span class="code-
             <td colspan="1" rowspan="1">
                 <b>Special Use Only!</b>
                 <br clear="none">
-                You should almost always acquire the currently executing Subject by calling <tt>SecurityUtils.getSubject();</tt><br clear="none">Creating custom <tt>Subject</tt> instances should only be done in special cases.
+                You should almost always acquire the currently executing Subject by calling <code>SecurityUtils.getSubject();</code> Creating custom <code>Subject</code> instances should only be done in special cases.
             </td>
         </tr>
         </tbody>
     </table>
 </div>
-
-<p>Some 'special cases' when this can be useful:</p>
-
-<ul><li>System startup/bootstrap - when there are no users interacting with the system, but code should execute as a 'system' or daemon user.  It is desirable to create Subject instances representing a particular user so bootstrap code executes as that user (e.g. as the <tt>admin</tt> user).
-<br clear="none" class="atl-forced-newline">
-<br clear="none" class="atl-forced-newline">
-This practice is encouraged because it ensures that utility/system code executes in the same way as a normal user, ensuring code is consistent.  This makes code easier to maintain since you don't have to worry about custom code blocks just for system/daemon scenarios.
-<br clear="none" class="atl-forced-newline">
-<br clear="none" class="atl-forced-newline"></li><li>Integration <a href="testing.html" title="Testing">Testing</a> - you might want to create <tt>Subject</tt> instances as necessary to be used in integration tests.  See the <a href="testing.html" title="Testing">testing documentation</a> for more.
-<br clear="none" class="atl-forced-newline">
-<br clear="none" class="atl-forced-newline"></li><li>Daemon/background process work - when a daemon or background process executes, it might need to execute as a particular user.</li></ul>
-
-
+<p>Some &lsquo;special cases&rsquo; when this can be useful:</p>
+<ul>
+  <li>
+    <p>System startup/bootstrap - when there are no users interacting with the system, but code should execute as a &lsquo;system&rsquo; or daemon user. It is desirable to create Subject instances representing a particular user so bootstrap code executes as that user (e.g. as the <code>admin</code> user).</p>
+    <p>This practice is encouraged because it ensures that utility/system code executes in the same way as a normal user, ensuring code is consistent. This makes code easier to maintain since you don&rsquo;t have to worry about custom code blocks just for system/daemon scenarios.</p>
+  </li>
+  <li>
+  <p>Integration <a href="testing.html" title="Testing">Testing</a> - you might want to create <code>Subject</code> instances as necessary to be used in integration tests. See the <a href="testing.html" title="Testing">testing documentation</a> for more.</p></li>
+  <li>
+  <p>Daemon/background process work - when a daemon or background process executes, it might need to execute as a particular user.</p></li>
+</ul>
 <div class="panelMacro">
     <table class="tipMacro">
         <colgroup span="1">
@@ -274,141 +215,97 @@ This practice is encouraged because it e
             <td colspan="1" rowspan="1">
                 <b>Tip</b>
                 <br clear="none">
-                If you already have access to a <tt>Subject</tt> instance and want it to be available to other threads, you should use the <tt>Subject.associateWith</tt>* methods instead of creating a new Subject instance.
+                If you already have access to a <code>Subject</code> instance and want it to be available to other threads, you should use the <code>Subject.associateWith</code>* methods instead of creating a new Subject instance.
             </td>
         </tr>
         </tbody>
     </table>
 </div>
-
-<p>Ok, so assuming you still need to create custom subject instances, let's see how to do it:</p>
-
-<h3><a name="Subject-Subject.Builder"></a>Subject.Builder</h3>
-
-<p>The <tt>Subject.Builder</tt> class is provided to build <tt>Subject</tt> instances easily without needing to know construction details.</p>
-
-<p>The simplest usage of the Builder is to construct an anonymous, session-less <tt>Subject</tt> instance:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-keyword">new</span> Subject.Builder().buildSubject()
-</pre>
-</div></div>
-
-<p>The default, no-arg <tt>Subject.Builder()</tt> constructor shown above will use the application's currently accessible <tt>SecurityManager</tt> via the <tt>SecurityUtils.getSecurityManager()</tt> method.  You may also specify the <tt>SecurityManager</tt> instance to be used by the additional constructor if desired:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-object">SecurityManager</span> securityManager = <span class="code-comment">//acquired from somewhere
-</span>Subject subject = <span class="code-keyword">new</span> Subject.Builder(securityManager).buildSubject();
-</pre>
-</div></div>
-
-<p>All other <tt>Subject.Builder</tt> methods may be called before the <tt>buildSubject()</tt> method to provide context on how to construct the <tt>Subject</tt> instance.  For example, if you have a session ID and want to acquire the <tt>Subject</tt> that 'owns' that session (assuming the session exists and is not expired):</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Serializable sessionId = <span class="code-comment">//acquired from somewhere
-</span>Subject subject = <span class="code-keyword">new</span> Subject.Builder().sessionId(sessionId).buildSubject();
-</pre>
-</div></div>
-
-<p>Similarly, if you want to create a <tt>Subject</tt> instance that reflects a certain identity:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-<span class="code-object">Object</span> userIdentity = <span class="code-comment">//a <span class="code-object">long</span> ID or <span class="code-object">String</span> username, or whatever the <span class="code-quote">"myRealm"</span> requires
-</span><span class="code-object">String</span> realmName = <span class="code-quote">"myRealm"</span>;
-PrincipalCollection principals = <span class="code-keyword">new</span> SimplePrincipalCollection(userIdentity, realmName);
-Subject subject = <span class="code-keyword">new</span> Subject.Builder().principals(principals).buildSubject();
-</pre>
-</div></div>
-
-<p>You can then use the built <tt>Subject</tt> instance and make calls on it as expected. But <b>note</b>:  </p>
-
-<p>The built <tt>Subject</tt> instance is <b>not</b> automatically bound to the application (thread) for further use.  If you want it to be available to any code that calls <tt>SecurityUtils.getSubject()</tt>, you must ensure a Thread is associated with the constructed <tt>Subject</tt>.</p>
-
-<h3><a name="Subject-ThreadAssociation"></a>Thread Association <a name="Subject-ThreadAssociation"></a></h3>
-
-<p>As stated above, just building a <tt>Subject</tt> instance does not associate it with a thread - a usual requirement if any calls to <tt>SecurityUtils.getSubject()</tt> during thread execution are to work properly.  There are three ways of ensuring a thread is associated with a <tt>Subject</tt>:</p>
-
-<ul><li><b>Automatic Association</b> - A <tt>Callable</tt> or <tt>Runnable</tt> executed via the <tt>Subject.execute</tt>* methods will automatically bind and unbind the Subject to the thread before and after <tt>Callable</tt>/<tt>Runnable</tt> execution.
-<br clear="none" class="atl-forced-newline">
-<br clear="none" class="atl-forced-newline"></li><li><b>Manual Association</b> - You manually bind and unbind the <tt>Subject</tt> instance to the currently executing thread.  This is usually useful for framework developers.
-<br clear="none" class="atl-forced-newline">
-<br clear="none" class="atl-forced-newline"></li><li><b>Different Thread</b> - A <tt>Callable</tt> or <tt>Runnable</tt> is associated with a <tt>Subject</tt> by calling the <tt>Subject.associateWith</tt>* methods and then the returned <tt>Callable</tt>/<tt>Runnable</tt> is executed by another thread.  This is the preferred approach if you need to execute work on another thread as the <tt>Subject</tt>.</li></ul>
-
-
+<p>Ok, so assuming you still need to create custom subject instances, let&rsquo;s see how to do it:</p>
+<a name="Subject-Subject.Builder"></a>
+<h3>Subject.Builder</h3>
+<p>The <code>Subject.Builder</code> class is provided to build <code>Subject</code> instances easily without needing to know construction details.</p>
+<p>The simplest usage of the Builder is to construct an anonymous, session-less <code>Subject</code> instance:</p>
+<pre><code class="java">Subject subject = new Subject.Builder().buildSubject()
+</code></pre>
+<p>The default, no-arg <code>Subject.Builder()</code> constructor shown above will use the application&rsquo;s currently accessible <code>SecurityManager</code> via the <code>SecurityUtils.getSecurityManager()</code> method. You may also specify the <code>SecurityManager</code> instance to be used by the additional constructor if desired:</p>
+<pre><code class="java">SecurityManager securityManager = //acquired from somewhere 
+Subject subject = new Subject.Builder(securityManager).buildSubject();
+</code></pre>
+<p>All other <code>Subject.Builder</code> methods may be called before the <code>buildSubject()</code> method to provide context on how to construct the <code>Subject</code> instance. For example, if you have a session ID and want to acquire the <code>Subject</code> that &lsquo;owns&rsquo; that session (assuming the session exists and is not expired):</p>
+<pre><code class="java">Serializable sessionId = //acquired from somewhere 
+Subject subject = new Subject.Builder().sessionId(sessionId).buildSubject();
+</code></pre>
+<p>Similarly, if you want to create a <code>Subject</code> instance that reflects a certain identity:</p>
+<pre><code class="java">Object userIdentity = //a long ID or String username, or whatever the &quot;myRealm&quot; requires 
+String realmName = &quot;myRealm&quot;;
+PrincipalCollection principals = new SimplePrincipalCollection(userIdentity, realmName);
+Subject subject = new Subject.Builder().principals(principals).buildSubject();
+</code></pre>
+<p>You can then use the built <code>Subject</code> instance and make calls on it as expected. But <strong>note</strong>:</p>
+<p>The built <code>Subject</code> instance is <strong>not</strong> automatically bound to the application (thread) for further use. If you want it to be available to any code that calls <code>SecurityUtils.getSubject()</code>, you must ensure a Thread is associated with the constructed <code>Subject</code>.</p>
+<a name="Subject-ThreadAssociation"></a>
+<h3><a href="#thread-association" name="thread-association">Thread Association</a></h3>
+<p>As stated above, just building a <code>Subject</code> instance does not associate it with a thread - a usual requirement if any calls to <code>SecurityUtils.getSubject()</code> during thread execution are to work properly. There are three ways of ensuring a thread is associated with a <code>Subject</code>:</p>
+<ul>
+  <li>
+  <p><strong>Automatic Association</strong> - A <code>Callable</code> or <code>Runnable</code> executed via the <code>Subject.execute</code>* methods will automatically bind and unbind the Subject to the thread before and after <code>Callable</code>/<code>Runnable</code> execution.</p></li>
+  <li>
+  <p><strong>Manual Association</strong> - You manually bind and unbind the <code>Subject</code> instance to the currently executing thread. This is usually useful for framework developers.</p></li>
+  <li>
+  <p><strong>Different Thread</strong> - A <code>Callable</code> or <code>Runnable</code> is associated with a <code>Subject</code> by calling the <code>Subject.associateWith</code>* methods and then the returned <code>Callable</code>/<code>Runnable</code> is executed by another thread. This is the preferred approach if you need to execute work on another thread as the <code>Subject</code>.</p></li>
+</ul>
 <p>The important thing to know about thread association is that 2 things must always occur:</p>
-
-<ol><li>The Subject is <em>bound</em> to the thread so it is available at all points of the thread's execution.  Shiro does this via its <tt>ThreadState</tt> mechanism which is an abstraction on top of a <tt>ThreadLocal</tt>.</li><li>The Subject is <em>unbound</em> at some point later, even if the thread execution results in an error.  This ensures the thread remains clean and clear of any previous <tt>Subject</tt> state in a pooled/reusable thread environment.</li></ol>
-
-
-<p>These principles are guaranteed to occur in the 3 mechanisms listed above.  Their usage is elaborated next.</p>
-
-<h4><a name="Subject-AutomaticAssociation"></a>Automatic Association </h4>
-
-<p>If you only need a <tt>Subject</tt> to be temporarily associated with the current thread, and you want the thread binding and cleanup to occur automatically, a <tt>Subject</tt>'s direct execution of a <tt>Callable</tt> or <tt>Runnable</tt> is the way to go.  After the <tt>Subject.execute</tt> call returns, the current thread is guaranteed to be in the same state as it was before the execution.  This mechanism is the most widely used of the three.</p>
-
-<p>For example, let's say that you had some logic to perform when the system starts up.  You want to execute a chunk of code as a particular user, but once the logic is finished, you want to ensure the thread/environment goes back to normal automatically.  You would do that by calling the <tt>Subject.execute</tt>* methods:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-comment">//build or acquire subject
-</span>subject.execute( <span class="code-keyword">new</span> <span class="code-object">Runnable</span>() {
-    <span class="code-keyword">public</span> void run() {
-        <span class="code-comment">//subject is 'bound' to the current thread now
-</span>        <span class="code-comment">//any SecurityUtils.getSubject() calls in any
-</span>        <span class="code-comment">//code called from here will work
-</span>    }
+<ol>
+  <li>The Subject is <em>bound</em> to the thread so it is available at all points of the thread&rsquo;s execution. Shiro does this via its <code>ThreadState</code> mechanism which is an abstraction on top of a <code>ThreadLocal</code>.</li>
+  <li>The Subject is <em>unbound</em> at some point later, even if the thread execution results in an error. This ensures the thread remains clean and clear of any previous <code>Subject</code> state in a pooled/reusable thread environment.</li>
+</ol>
+<p>These principles are guaranteed to occur in the 3 mechanisms listed above. Their usage is elaborated next.</p>
+<a name="Subject-AutomaticAssociation"></a>
+<h4><a href="#automatic-association" name="automatic-association">Automatic Association</a></h4>
+<p>If you only need a <code>Subject</code> to be temporarily associated with the current thread, and you want the thread binding and cleanup to occur automatically, a <code>Subject</code>&rsquo;s direct execution of a <code>Callable</code> or <code>Runnable</code> is the way to go. After the <code>Subject.execute</code> call returns, the current thread is guaranteed to be in the same state as it was before the execution. This mechanism is the most widely used of the three.</p>
+<p>For example, let&rsquo;s say that you had some logic to perform when the system starts up. You want to execute a chunk of code as a particular user, but once the logic is finished, you want to ensure the thread/environment goes back to normal automatically. You would do that by calling the <code>Subject.execute</code>* methods:</p>
+<pre><code class="java">Subject subject = //build or acquire subject 
+subject.execute( new Runnable() {
+    public void run() {
+        //subject is &#39;bound&#39; to the current thread now
+        //any SecurityUtils.getSubject() calls in any
+        //code called from here will work
+    }
 });
-<span class="code-comment">//At <span class="code-keyword">this</span> point, the Subject is no longer associated
-</span><span class="code-comment">//with the current thread and everything is as it was before</span>
-</pre>
-</div></div>
-
-<p>Of course <tt>Callable</tt> instances are supported as well so you can have return values and catch exceptions:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-comment">//build or acquire subject
-</span>MyResult result = subject.execute( <span class="code-keyword">new</span> Callable&lt;MyResult&gt;() {
-    <span class="code-keyword">public</span> MyResult call() <span class="code-keyword">throws</span> Exception {
-        <span class="code-comment">//subject is 'bound' to the current thread now
-</span>        <span class="code-comment">//any SecurityUtils.getSubject() calls in any
-</span>        <span class="code-comment">//code called from here will work
-</span>        ...
-        <span class="code-comment">//finish logic as <span class="code-keyword">this</span> Subject
-</span>        ...
-        <span class="code-keyword">return</span> myResult;        
+//At this point, the Subject is no longer associated 
+//with the current thread and everything is as it was before
+</code></pre>
+<p>Of course <code>Callable</code> instances are supported as well so you can have return values and catch exceptions:</p>
+<pre><code class="java">Subject subject = //build or acquire subject 
+MyResult result = subject.execute( new Callable&lt;MyResult&gt;() {
+    public MyResult call() throws Exception {
+        //subject is &#39;bound&#39; to the current thread now
+        //any SecurityUtils.getSubject() calls in any
+        //code called from here will work
+        ...
+        //finish logic as this Subject
+        ...
+        return myResult;
     }
 });
-<span class="code-comment">//At <span class="code-keyword">this</span> point, the Subject is no longer associated
-</span><span class="code-comment">//with the current thread and everything is as it was before</span>
-</pre>
-</div></div>
-
-<p>This approach is also useful in framework development.  For example, Shiro's support for secure Spring remoting ensures the remote invocation is executed as a particular subject:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject.Builder builder = <span class="code-keyword">new</span> Subject.Builder();
-<span class="code-comment">//populate the builder's attributes based on the incoming RemoteInvocation
-</span>...
+//At this point, the Subject is no longer associated 
+//with the current thread and everything is as it was before
+</code></pre>
+<p>This approach is also useful in framework development. For example, Shiro&rsquo;s support for secure Spring remoting ensures the remote invocation is executed as a particular subject:</p>
+<pre><code class="java">Subject.Builder builder = new Subject.Builder();
+//populate the builder&#39;s attributes based on the incoming RemoteInvocation ...
 Subject subject = builder.buildSubject();
 
-<span class="code-keyword">return</span> subject.execute(<span class="code-keyword">new</span> Callable() {
-    <span class="code-keyword">public</span> <span class="code-object">Object</span> call() <span class="code-keyword">throws</span> Exception {
-        <span class="code-keyword">return</span> invoke(invocation, targetObject);
+return subject.execute(new Callable() {
+    public Object call() throws Exception {
+        return invoke(invocation, targetObject);
     }
 });
-</pre>
-</div></div>
-
-<h4><a name="Subject-ManualAssociation"></a>Manual Association</h4>
-
-<p>While the <tt>Subject.execute</tt>* methods automatically clean up the thread state after they return, there might be some scenarios where you want to manage the <tt>ThreadState</tt> yourself.  This is almost always done in framework-level development when integrating w/ Shiro and is rarely used even in bootstrap/daemon scenarios (where the <tt>Subject.execute(callable)</tt> example above is more frequent).</p>
-
+</code></pre>
+<a name="Subject-ManualAssociation"></a>
+<h4><a href="#manual-association" name="manual-association">Manual Association</a></h4>
+<p>While the <code>Subject.execute</code>* methods automatically clean up the thread state after they return, there might be some scenarios where you want to manage the <code>ThreadState</code> yourself. This is almost always done in framework-level development when integrating w/ Shiro and is rarely used even in bootstrap/daemon scenarios (where the <code>Subject.execute(callable)</code> example above is more frequent).</p>
 <div class="panelMacro">
     <table class="noteMacro">
         <colgroup span="1">
@@ -430,26 +327,19 @@ Subject subject = builder.buildSubject()
         </tbody>
     </table>
 </div>
-
-<p>Guaranteeing cleanup is best done in a <tt>try/finally</tt> block:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-keyword">new</span> Subject.Builder()...
-ThreadState threadState = <span class="code-keyword">new</span> SubjectThreadState(subject);
+<p>Guaranteeing cleanup is best done in a <code>try/finally</code> block:</p>
+<pre><code class="java">Subject subject = new Subject.Builder()...
+ThreadState threadState = new SubjectThreadState(subject);
 threadState.bind();
-<span class="code-keyword">try</span> {
-    <span class="code-comment">//execute work as the built Subject
-</span>} <span class="code-keyword">finally</span> {
-    <span class="code-comment">//ensure any state is cleaned so the thread won't be 
-</span>    <span class="code-comment">//corrupt in a reusable or pooled thread environment
-</span>    threadState.clear();
+try {
+    //execute work as the built Subject
+} finally {
+    //ensure any state is cleaned so the thread won&#39;t be
+    //corrupt in a reusable or pooled thread environment
+    threadState.clear();
 }
-</pre>
-</div></div>
-
-<p>Interestingly enough, this is exactly what the <tt>Subject.execute</tt>* methods do - they just perform this logic automatically before and after <tt>Callable</tt> or <tt>Runnable</tt> execution.  It is also nearly identical logic performed by Shiro's <tt>ShiroFilter</tt> for web applications (<tt>ShiroFilter</tt> uses web-specific <tt>ThreadState</tt> implementations outside the scope of this section).</p>
-
+</code></pre>
+<p>Interestingly enough, this is exactly what the <code>Subject.execute</code>* methods do - they just perform this logic automatically before and after <code>Callable</code> or <code>Runnable</code> execution. It is also nearly identical logic performed by Shiro&rsquo;s <code>ShiroFilter</code> for web applications (<code>ShiroFilter</code> uses web-specific <code>ThreadState</code> implementations outside the scope of this section).</p>
 <div class="panelMacro">
     <table class="warningMacro">
         <colgroup span="1">
@@ -465,45 +355,32 @@ threadState.bind();
             <td colspan="1" rowspan="1">
                 <b>Web Use</b>
                 <br clear="none">
-                Don't use the above <tt>ThreadState</tt> code example in a thread that is processing a web request.  Web-specific ThreadState implementations are used during web requests instead.  Instead, ensure the <tt>ShiroFilter</tt> intercepts web requests to ensure Subject building/binding/cleanup is done properly.
+                Don't use the above <code>ThreadState</code> code example in a thread that is processing a web request.  Web-specific ThreadState implementations are used during web requests instead.  Instead, ensure the <code>ShiroFilter</code> intercepts web requests to ensure Subject building/binding/cleanup is done properly.
             </td>
         </tr>
         </tbody>
     </table>
 </div>
-
-<h4><a name="Subject-ADifferentThread"></a>A Different Thread</h4>
-
-<p>If you have a <tt>Callable</tt> or <tt>Runnable</tt> instance that should execute as a <tt>Subject</tt> and you will execute the <tt>Callable</tt> or <tt>Runnable</tt> yourself (or hand it off to a thread pool or <tt>Executor</tt> or <tt>ExecutorService</tt> for example), you should use the <tt>Subject.associateWith</tt>* methods.  These methods ensure that the Subject is retained and accessible on the thread that eventually executes.</p>
-
+<a name="Subject-ADifferentThread"></a>
+<h4><a href="#a-different-thread" name="a-different-thread">A Different Thread</a></h4>
+<p>If you have a <code>Callable</code> or <code>Runnable</code> instance that should execute as a <code>Subject</code> and you will execute the <code>Callable</code> or <code>Runnable</code> yourself (or hand it off to a thread pool or <code>Executor</code> or <code>ExecutorService</code> for example), you should use the <code>Subject.associateWith</code>* methods. These methods ensure that the Subject is retained and accessible on the thread that eventually executes.</p>
 <p>Callable example:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-keyword">new</span> Subject.Builder()...
-Callable work = <span class="code-comment">//build/acquire a Callable instance.
-</span><span class="code-comment">//associate the work with the built subject so SecurityUtils.getSubject() calls works properly:
-</span>work = subject.associateWith(work);
-ExecutorService executorService = <span class="code-keyword">new</span> java.util.concurrent.Executors.newCachedThreadPool();
-<span class="code-comment">//execute the work on a different thread as the built Subject:
-</span>executor.execute(work);
-</pre>
-</div></div>
-
+<pre><code class="java">Subject subject = new Subject.Builder()...
+Callable work = //build/acquire a Callable instance. 
+//associate the work with the built subject so SecurityUtils.getSubject() calls works properly: 
+work = subject.associateWith(work);
+ExecutorService executorService = new java.util.concurrent.Executors.newCachedThreadPool();
+//execute the work on a different thread as the built Subject: 
+executor.execute(work);
+</code></pre>
 <p>Runnable example:</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
-<pre class="code-java">
-Subject subject = <span class="code-keyword">new</span> Subject.Builder()...
-<span class="code-object">Runnable</span> work = <span class="code-comment">//build/acquire a <span class="code-object">Runnable</span> instance.
-</span><span class="code-comment">//associate the work with the built subject so SecurityUtils.getSubject() calls works properly:
-</span>work = subject.associateWith(work);
-Executor executor = <span class="code-keyword">new</span> java.util.concurrent.Executors.newCachedThreadPool();
-<span class="code-comment">//execute the work on a different thread as the built Subject:
-</span>executor.execute(work);
-</pre>
-</div></div>
-
+<pre><code class="java">Subject subject = new Subject.Builder()...
+Runnable work = //build/acquire a Runnable instance. 
+//associate the work with the built subject so SecurityUtils.getSubject() calls works properly: 
+work = subject.associateWith(work);
+Executor executor = new java.util.concurrent.Executors.newCachedThreadPool();
+//execute the work on a different thread as the built Subject: executor.execute(work);
+</code></pre>
 <div class="panelMacro">
     <table class="tipMacro">
         <colgroup span="1">
@@ -517,18 +394,16 @@ Executor executor = <span class="code-ke
             <td colspan="1" rowspan="1">
                 <b>Automatic Cleanup</b>
                 <br clear="none">
-                The <tt>associateWith</tt>* methods perform necessary thread cleanup automatically to ensure threads remain clean in a pooled environment.
+                The <code>associateWith</code>* methods perform necessary thread cleanup automatically to ensure threads remain clean in a pooled environment.
             </td>
         </tr>
         </tbody>
     </table>
 </div>
-
-<h2><a name="Subject-Lendahandwithdocumentation"></a>Lend a hand with documentation </h2>
-
-<p>While we hope this documentation helps you with the work you're doing with Apache Shiro, the community is improving and expanding the documentation all the time.  If you'd like to help the Shiro project, please consider corrected, expanding, or adding documentation where you see a need. Every little bit of help you provide expands the community and in turn improves Shiro. </p>
-
-<p>The easiest way to contribute your documentation is to send it to the <a class="external-link" href="http://shiro-user.582556.n2.nabble.com/" rel="nofollow">User Forum</a> or the <a href="mailing-lists.html" title="Mailing Lists">User Mailing List</a>.</p>
+<a name="Subject-Lendahandwithdocumentation"></a>
+<h2><a href="#lend-a-hand-with-documentation" name="lend-a-hand-with-documentation">Lend a hand with documentation</a></h2>
+<p>While we hope this documentation helps you with the work you&rsquo;re doing with Apache Shiro, the community is improving and expanding the documentation all the time. If you&rsquo;d like to help the Shiro project, please consider corrected, expanding, or adding documentation where you see a need. Every little bit of help you provide expands the community and in turn improves Shiro.</p>
+<p>The easiest way to contribute your documentation is to send it to the <a href="http://shiro-user.582556.n2.nabble.com/">User Forum</a> or the <a href="mailing-lists.html" title="Mailing Lists">User Mailing List</a>.</p>
 
         </div>
 

Modified: shiro/site/publish/team.html
URL: http://svn.apache.org/viewvc/shiro/site/publish/team.html?rev=1766414&r1=1766413&r2=1766414&view=diff
==============================================================================
--- shiro/site/publish/team.html (original)
+++ shiro/site/publish/team.html Mon Oct 24 14:33:52 2016
@@ -78,8 +78,7 @@
 
         <div id="content">
 
-            <h1><a name="Team-ApacheShiroTeam"></a>Apache Shiro Team</h1>
-
+            <h1><a href="#apache-shiro-team" name="apache-shiro-team">Apache Shiro Team</a></h1>
 <p>TODO: list dev team members here</p>
 
         </div>