http://git-wip-us.apache.org/repos/asf/shiro-site/blob/a2ce402a/authorization.md.vtl
----------------------------------------------------------------------
diff --git a/authorization.md.vtl b/authorization.md.vtl
new file mode 100644
index 0000000..179af93
--- /dev/null
+++ b/authorization.md.vtl
@@ -0,0 +1,636 @@
+<!-- Work around for table styling until, all pages are updated. -->
+#mdStyle()
+
+<a name="Authorization-ApacheShiroAuthorization"></a>
+Apache Shiro Authorization
+==========================
+
+*   [Elements of Authorization](#Authorization-ElementsofAuthorization)
+
+    *   [Permissions](#Authorization-Permissions)
+
+        *   [Permission Granularity](#Authorization-PermissionGranularity)
+
+    *   [Roles](#Authorization-Roles)
+    *   [Users](#Authorization-Users)
+
+*   [Authorizing Subjects](#Authorization-AuthorizingSubjects)
+
+    *   [Programmatic Authorization](#Authorization-ProgrammaticAuthorization)
+
+        *   [Role-Based Authorization](#Authorization-RoleBasedAuthorization)
+    
+            *   [Role Checks](#Authorization-RoleChecks)
+            *   [Role Assertions](#Authorization-RoleAssertions)
+
+        *   [Permission-Based 
Authorization](#Authorization-PermissionBasedAuthorization)
+    
+            *   [Permission Checks](#Authorization-PermissionChecks)
+    
+                *   [Object-based Permission 
Checks](#Authorization-ObjectbasedPermissionChecks)
+                *   [String-based permission 
checks](#Authorization-Stringbasedpermissionchecks)
+
+            *   [Permission Assertions](#Authorization-PermissionAssertions)
+
+    *   [Annotation-based 
Authorization](#Authorization-AnnotationbasedAuthorization)
+
+        *   [Configuration](#Authorization-Configuration)
+        *   [The `RequiresAuthentication` 
annotation](#Authorization-The%7B%7BRequiresAuthentication%7D%7Dannotation)
+        *   [The `RequiresGuest` 
annotation](#Authorization-The%7B%7BRequiresGuest%7D%7Dannotation)
+        *   [The `RequiresPermissions` 
annotation](#Authorization-The%7B%7BRequiresPermissions%7D%7Dannotation)
+        *   [The `RequiresRoles` 
permission](#Authorization-The%7B%7BRequiresRoles%7D%7Dpermission)
+        *   [The `RequiresUser` 
annotation](#Authorization-The%7B%7BRequiresUser%7D%7Dannotation)
+
+    *   [JSP TagLib Authorization](#Authorization-JSPTagLibAuthorization)
+
+*   [Authorization Sequence](#Authorization-AuthorizationSequence)
+
+    *   
[`ModularRealmAuthorizer`](#Authorization-%7B%7BModularRealmAuthorizer%7D%7D)
+
+        *   [Realm Authorization Order](#Authorization-RealmAuthorizationOrder)
+        *   [Configuring a global 
`PermissionResolver`](#Authorization-Configuringaglobal%7B%7BPermissionResolver%7D%7D)
+        *   [Configuring a global 
`RolePermissionResolver`](#Authorization-Configuringaglobal%7B%7BRolePermissionResolver%7D%7D)
+
+    *   [Custom Authorizer](#Authorization-CustomAuthorizer)
+
+<img style="margin:0px auto;display:block" 
src="assets/images/ShiroFeatures_Authorization.png"/>
+
+Authorization, also known as _access control_, is the process of managing 
access to resources. In other words, controlling _who_ has access to _what_ in 
an application.
+
+Examples of authorization checks are: Is the user allowed to look at this 
webpage, edit this data, view this button, or print to this printer? Those are 
all decisions determining what a user has access to.
+
+<a name="Authorization-ElementsofAuthorization"></a>
+Elements of Authorization
+-------------------------
+
+Authorization has three core elements that we reference quite a bit in Shiro: 
permissions, roles, and users.
+
+<a name="Authorization-Permissions"></a>
+#[[###Permissions]]#
+
+Permissions in Apache Shiro represent the most atomic element of a security 
policy. They are fundamentally statements about behavior and represent 
explicitly what can be done in an application. A well-formed permission 
statement essentially describes resources and what actions are possible when a 
`Subject` interacts with those resources.
+
+Some examples of permission statements:
+
+*   Open a file
+*   View the '/user/list' web page
+*   Print documents
+*   Delete the 'jsmith' user
+
+Most resources will support the typical CRUD (create, read, update, delete) 
actions, but any action that makes sense for a particular resource type is ok. 
The fundamental idea is that permission statements at a minimum are based on 
_Resources_ and _Actions_.
+
+When looking at permissions, probably the most important thing to realize is 
that permission statements have no representation of _who_ can perform the 
represented behavior. They are only statements of _what_ can be done in an 
application.
+
+#info('Permissions represent behavior only', 'Permission statements reflect 
behavior (actions associated with resource types) <em>only</em>.  They do not 
reflect <em>who</em> is able to perform such behavior.')
+
+Defining _who_ (users) is allowed to do _what_ (permissions) is an exercise of 
assigning permissions to users in some way. This is always done by the 
application's data model and can vary greatly across applications.
+
+For example, permissions can be grouped in a Role and that Role could be 
associated with one or more User objects. Or some applications can have a Group 
of users and a Group can be assigned a Role, which by transitive association 
would mean that all the Users in that Group are implicitly granted the 
permissions in the Role.
+
+There are many variations for how permissions could be granted to users - the 
application determines how to model this based on the application requirements.
+
+We'll cover how Shiro determines if a `Subject` is permitted to do something 
or not later.
+
+<a name="Authorization-PermissionGranularity"></a>
+#[[####Permission Granularity]]#
+
+The permission examples above all specify actions (open, read, delete, etc) on 
a resource type (door, file, customer, etc). In some cases, they even specify 
very fine-grained _instance-level_ behavior - for example, 'delete' (action) 
the 'user' (resource type) with username 'jsmith' (instance identifier). In 
Shiro, you have the ability to define exactly how granular those statements can 
be.
+
+We cover permission granularity and 'levels' of permission statements in much 
more detail in Shiro's [Permissions Documentation](permissions.html 
"Permissions").
+
+<a name="Authorization-Roles"></a>
+#[[###Roles]]#
+
+A Role is a named entity that typically represents a set of behaviors or 
responsibilities. Those behaviors translate to things you can or can't do with 
a software application. Roles are typically assigned to user accounts, so by 
association, users can 'do' the things attributed to various roles.
+
+There are effectively two types of Roles, and Shiro supports both concepts:
+
+*   **Implicit Roles**: Most people use roles as an _implicit_ construct: 
where your application _implies_ a set of behaviors (i.e. permissions) based on 
a role name only. With implicit roles, there is nothing at the software level 
that says "role X is allowed to perform behavior A, B and C". Behavior is 
implied by a name alone.
+
+#warning('Potentially Brittle Security', 'While the simpler and most common 
approach, implicit roles potentially impose a lot of software maintenance and 
management problems.
+
+<p>For example, what if you just want to add or remove a role, or redefine a 
role''s behavior later?  You''ll have to go back into your source code and 
change all your role checks to reflect the change in your security model, every 
time such a change is required!  Not to mention the operational costs this 
would incur (re-test, go through QA, shut down the app, upgrade the software 
with the new role checks, restart the app, etc).</p>
+<p>This is probably ok for very simple applications (e.g. maybe there is an 
''admin'' role and ''everyone else'').  But for more complicated or 
configurable applications, this can be a major major problem throughout the 
life of your application and drive a large maintenance cost for your 
software.</p>')
+
+*   **Excplict Roles**: An explicit role however is essentially a named 
collection of actual permission statements. In this form, the application (and 
Shiro) knows _exactly_ what it means to have a particular role or not. Because 
it is known the _exact_ behavior that can be performed or not, there is no 
guessing or implying what a particular role can or can not do.
+
+The Shiro team advocates using permissions and explicit roles instead of the 
older implicit approach. You will have much greater control over your 
application's security experience.
+
+#tip('Resource-Based Access Control', 'Be sure to read Les Hazlewood''s 
article, <a class="external-link" 
href="https://stormpath.com/blog/new-rbac-resource-based-access-control"; 
rel="nofollow">The New RBAC: Resource-Based Access Control</a>, which covers 
in-depth the benefits of using permissions and explicit roles (and their 
positive impact on source code) instead of the older implicit role approach.')
+
+<a name="Authorization-Users"></a>
+#[[###Users]]#
+
+A user essentially is the 'who' of an application. As we've covered previously 
however, the `Subject` is really Shiro's 'User' concept.
+
+Users (Subjects) are allowed to perform certain actions in your application 
through their association with roles or direct permissions. Your application's 
data model defines exactly how a `Subject` is allowed to do something or not.
+
+For example, in your data model, perhaps you have an actual `User` class and 
you assign permissions directly to `User` instances. Or maybe you assign 
permissions only to `Roles` directly, and then assign Roles to `Users`, so by 
association, `Users` transitively 'have' the permissions assigned to their 
roles. Or you could represent these things with a 'Group' concept. It is up to 
you - use what makes sense for your application.
+
+Your data model defines exactly how authorization will function. Shiro relies 
on a [Realm](realm.html "Realm") implementation to translate your data model 
association details into a format Shiro understands. We'll cover how Realms do 
this a little later.
+
+#info('Note', 'Ultimately, your <a href="realm.html" title="Realm">Realm</a> 
implementation is what communicates with your data source (RDBMS, LDAP, etc). 
So your realm is what will tell Shiro whether or not roles or permissions 
exist. You have full control over how your authorization model is structured 
and defined.')
+
+<a name="Authorization-AuthorizingSubjects"></a>
+Authorizing Subjects
+--------------------
+
+Performing authorization in Shiro can be done in 3 ways:
+
+*   Programmatically - You can perform authorization checks in your java code 
with structures like `if` and `else` blocks.
+*   JDK annotations - You can attach an authorization annotation to your Java 
methods
+*   JSP/GSP TagLibs - You can control JSP or GSP page output based on roles 
and permissions
+
+<a name="Authorization-ProgrammaticAuthorization"></a>
+#[[###Programmatic Authorization]]#
+
+Probably the easiest and most common way to perform authorization is to 
programatically interact with the current `Subject` instance directly.
+
+<a name="Authorization-RoleBasedAuthorization"></a>
+#[[####Role-Based Authorization]]#
+
+If you want to control access based on simpler/traditional implicit role 
names, you can execute role checks:
+
+<a name="Authorization-RoleChecks"></a>
+#[[#####Role Checks]]#
+
+If you want to simply check to see if the current `Subject` has a role or not, 
you can call the variant `hasRole*` methods on the `Subject` instance.
+
+For example, to see if a `Subject` has a particular (single) role, you can 
call the `subject.` 
[`hasRole(roleName)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#hasRole-java.lang.String-)
 method, and react accordingly:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+if (currentUser.hasRole("administrator")) {
+    //show the admin button 
+} else {
+    //don't show the button?  Grey it out? 
+}
+```
+
+There are few role-oriented `Subject` methods you can call, depending on your 
needs:
+
+| Subject Method | Description |
+| -------------- | ----------- |
+| [`hasRole(String 
roleName)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#hasRolejava.lang.String-)
 | Returns `true` if the `Subject` is assigned the specified role, `false` 
otherwise. |
+| [`hasRoles(List<String> 
roleNames)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#hasRoles-java.util.List-)
 | Returns a array of `hasRole` results corresponding to the indices in the 
method argument. Useful as a performance enhancement if many role checks need 
to be performed (e.g. when customizing a complex view) |
+| [`hasAllRoles(Collection<String> 
roleNames)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#hasAllRoles-java.util.Collection-)
 | Returns `true` if the `Subject` is assigned _all_ of the specified roles, 
`false` otherwise. |
+
+<a name="Authorization-RoleAssertions"></a>
+#[[#####Role Assertions]]#
+
+An alternative to checking a `boolean` to see if the `Subject` has a role or 
not, you can simply assert that they have an expected role before logic is 
executed. If the `Subject` does not have the expected role, an 
[`AuthorizationException`](static/current/apidocs/org/apache/shiro/authz/AuthorizationException.html)
 will be thrown. If they do have the expected role, the assertion will execute 
quietly and logic will continue as expected.
+
+For example:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+//guarantee that the current user is a bank teller and 
+//therefore allowed to open the account: 
+currentUser.checkRole("bankTeller");
+openBankAccount();
+```
+
+A benefit of this approach over the `hasRole*` methods is that code can be a 
bit cleaner in that you don't have to construct your own 
`AuthorizationExceptions` if the current `Subject` does not meet expected 
conditions (if you don't want to).
+
+There are few role-oriented `Subject` assertion methods you can call, 
depending on your needs:
+
+| Subject Method | Description |
+| -------------- | ----------- |
+| [`checkRole(String 
roleName)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkRole-java.lang.String-)
 | Returns quietly if the `Subject` is assigned the specified role or throws an 
`AuthorizationException` if not. |
+| [`checkRoles(Collection<String> 
roleNames)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkRoles-java.util.Collection-)
 | Returns quietly if the `Subject` is assigned _all_ of the specified role or 
throws an `AuthorizationException` if not. |
+| [`checkRoles(String... 
roleNames)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkRoles-java.lang.String...-)
 | Same effect as the `checkRoles` method above, but allows Java 5 var-args 
style arguments. |
+
+<a name="Authorization-PermissionBasedAuthorization"></a>
+#[[####Permission-Based Authorization]]#
+
+As stated above in our overview of Roles, often a better way of performing 
access control is through permission-based authorization. Permission-based 
authorization, because it is strongly associated with your application's raw 
functionality (and the behavior on an application's core resources), 
permission-based authorization source code changes when your functionality 
changes, not when there is a security policy change. This means code is 
impacted much-less frequently than similar role-based authorization code.
+
+<a name="Authorization-PermissionChecks"></a>
+#[[#####Permission Checks]]#
+
+If you want to check to see if a `Subject` is permitted to do something or 
not, you can call any of the various `isPermitted*` method variants. There are 
two primary means of checking permissions - with object-based `Permission` 
instances or with Strings that represent `Permissions`
+
+<a name="Authorization-ObjectbasedPermissionChecks"></a>
+#[[######Object-based Permission Checks]]#
+
+One possible way of performing permission checks is to instantiate an instance 
of Shiro's 
[`org.apache.shiro.authz.Permission`](static/current/apidocs/org/apache/shiro/authz/Permission.html)
 interface and pass it to the `*isPermitted` methods that accept permission 
instances.
+
+For example, consider the following scenario: There is a `Printer` in an 
office with a unique identifier `laserjet4400n`. Our software needs to check to 
see if the current user is allowed print documents on that printer before we 
allow them to press a 'print' button. The permission check to see if this 
possible could be formulated like this:
+
+``` java
+Permission printPermission = new PrinterPermission("laserjet4400n", "print");
+
+Subject currentUser = SecurityUtils.getSubject();
+
+if (currentUser.isPermitted(printPermission)) {
+    //show the Print button 
+} else {
+    //don't show the button?  Grey it out?
+}
+```
+
+In this example, we also see an example of a very powerful _instance-level_ 
access control check - the ability to restrict behavior based on _individual 
data instances_.
+
+Object-based `Permissions` are useful if:
+
+*   You want compile-time type-safety
+*   You want to guarantee permissions are represented and used correctly
+*   You want explicit control of how permission resolution logic (called 
permission implication logic, based on the Permission interface's 
[`implies`](static/current/apidocs/org/apache/shiro/authz/Permission.html#[[#]]#implies-org.apache.shiro.authz.Permission-)
 method) executes.
+*   You want to guarantee Permissions reflect application resources accurately 
(for example, maybe Permission classes can be auto-generated during a project's 
build based on a project's domain model).
+
+There are few Object permission-oriented `Subject` methods you can call, 
depending on your needs:
+
+| Subject Method | Description |
+| -------------- | ----------- |
+| [`isPermitted(Permission 
p)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermitted-org.apache.shiro.authz.Permission-)
 | Returns `true` if the `Subject` is permitted to perform an action or access 
a resource summarized by the specified `Permission` instance, `false` 
otherwise. |
+| [`isPermitted(List<Permission> 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermitted-java.util.List-)
 | Returns an array of `isPermitted` results corresponding to the indices in 
the method argument. Useful as a performance enhancement if many permission 
checks need to be performed (e.g. when customizing a complex view) |
+| [`isPermittedAll(Collection<Permission> 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermittedAll-java.util.Collection-)
 | Returns `true` if the `Subject` is permitted _all_ of the specified 
permissions, `false` otherwise. |
+
+<a name="Authorization-Stringbasedpermissionchecks"></a>
+#[[######String-based permission checks]]#
+
+While Object-based permissions can be useful (compile-time type-safety, 
guaranteed behavior, customized implication logic, etc), they can sometimes 
feel a bit 'heavy handed' for many applications. An alternative is to use 
normal `Strings` to represent a permission instance.
+
+For example, based on the print permission example above, we can re-formulate 
that same check as a `String`-based permission check:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+if (currentUser.isPermitted("printer:print:laserjet4400n")) {
+    //show the Print button
+} else {
+    //don't show the button?  Grey it out? 
+}
+```
+
+This example still shows the same instance-level permission check, but 
important parts of the permission - `printer` (resource type), `print` 
(action), and `laserjet4400n` (instance id) - were all represented in a String.
+
+This particular example shows a special colon-delimited format defined by 
Shiro's default 
[`org.apache.shiro.authz.permission.WildcardPermission`](static/current/apidocs/org/apache/shiro/authz/permission/WildcardPermission.html)
 implementation, which most people will find suitable.
+
+That is, the above code block is (mostly) a shortcut for the following:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+Permission p = new WildcardPermission("printer:print:laserjet4400n");
+
+if (currentUser.isPermitted(p) {
+    //show the Print button
+} else {
+    //don't show the button?  Grey it out?
+}
+```
+
+The `WildcardPermission` token format and formation options are covered 
in-depth in Shiro's [Permission documentation](permissions.html "Permissions").
+
+And while the above String defaults to the `WildcardPermission` format, you 
can actually invent your own String format and use that if you prefer. We'll 
cover how to do this as part of the Realm Authorization section below.
+
+String-based permissions are beneficial in that you are not forced to 
implement an interface and simple strings are often easy to read. The downside 
is that you don't have type safety and if you needed more complicated behavior 
that are outside the scope of what the Strings represent, you're going to want 
to implement your own permission objects based on the permission interface. In 
practice, most Shiro end-users choose the String-based approach for their 
simplicity, but ultimately your application's requirements will dictate which 
is better.
+
+Like the Object-based permission check methods, there are String variants to 
support String-based permission checks:
+
+| Subject Method | Description |
+| -------------- | ----------- |
+| [`isPermitted(String 
perm)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermitted-java.lang.String-)
 | Returns `true` if the `Subject` is permitted to perform an action or access 
a resource summarized by the specified `String` permission, `false` otherwise. |
+| [`isPermitted(String... 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermitted-java.util.List-)
 | Returns an array of `isPermitted` results corresponding to the indices in 
the method argument. Useful as a performance enhancement if many `String` 
permission checks need to be performed (e.g. when customizing a complex view) |
+| [`isPermittedAll(String... 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#isPermittedAll-java.lang.String...-)
 | Returns `true` if the `Subject` is permitted _all_ of the specified `String` 
permissions, `false` otherwise. |
+
+<a name="Authorization-PermissionAssertions"></a>
+#[[#####Permission Assertions]]#
+
+As an alternative to checking a `boolean` to see if the `Subject` is permitted 
to do something or not, you can simply assert that they have an expected 
permission before logic is executed. If the `Subject` is not permitted, an 
[`AuthorizationException`](static/current/apidocs/org/apache/shiro/authz/AuthorizationException.html)
 will be thrown. If they are permitted as expected, the assertion will execute 
quietly and logic will continue as expected.
+
+For example:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+//guarantee that the current user is permitted 
+//to open a bank account: 
+Permission p = new AccountPermission("open");
+currentUser.checkPermission(p);
+openBankAccount();
+```
+
+or, the same check, using a String permission:
+
+``` java
+Subject currentUser = SecurityUtils.getSubject();
+
+//guarantee that the current user is permitted 
+//to open a bank account: 
+currentUser.checkPermission("account:open");
+openBankAccount();
+```
+
+A benefit of this approach over the `isPermitted*` methods is that code can be 
a bit cleaner in that you don't have to construct your own 
`AuthorizationExceptions` if the current `Subject` does not meet expected 
conditions (if you don't want to).
+
+There are few permission-oriented `Subject` assertion methods you can call, 
depending on your needs:
+
+| Subject Method | Description |
+| -------------- | ----------- |
+| [`checkPermission(Permission 
p)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkPermission-org.apache.shiro.authz.Permission-)
 | Returns quietly if the `Subject` is permitted to perform an action or access 
a resource summarized by the specified `Permission` instance, or throws an 
`AuthorizationException` if not. |
+| [`checkPermission(String 
perm)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkPermission-java.lang.String-)
 | Returns quietly if the `Subject` is is permitted to perform an action or 
access a resource summarized by the specified `String` permission, or throws an 
`AuthorizationException` if not. |
+| [`checkPermissions(Collection<Permission> 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkPermissions-java.util.Collection-)
 | Returns quietly if the `Subject` is permitted _all_ the specified 
permissions, or throws an `AuthorizationException` if not. |
+| [`checkPermissions(String... 
perms)`](static/current/apidocs/org/apache/shiro/subject/Subject.html#[[#]]#checkPermissions-java.lang.String...-)
 | Same effect as the `checkPermissions` method above, but using `String`-based 
permissions. |
+
+<a name="Authorization-AnnotationbasedAuthorization"></a>
+#[[###Annotation-based Authorization]]#
+
+In addition to the `Subject` API calls, Shiro provides a collection of Java 5+ 
annotations if you prefer meta-based authorization control.
+
+<a name="Authorization-Configuration"></a>
+#[[####Configuration]]#
+
+Before you can use Java annotations, you'll need to enable AOP support in your 
application. There are a number of different AOP frameworks so, unfortunately, 
there is no standard way to enable AOP in an application.
+
+For AspectJ, you can review our [AspectJ sample 
application](https://github.com/apache/shiro/tree/master/samples/aspectj).
+
+For Spring applications, you can look into our [Spring 
Integration](spring.html "Spring") documentation.
+
+For Guice applications, you can look into our [Guice Integration](guice.html 
"Guice") documentation.
+
+<a name="Authorization-The%7B%7BRequiresAuthentication%7D%7Dannotation"></a>
+#[[####The `RequiresAuthentication` annotation]]#
+
+The 
[RequiresAuthentication](static/current/apidocs/org/apache/shiro/authz/annotation/RequiresAuthentication.html)
 annotation requires the current `Subject` to have been authenticated during 
their current session for the annotated class/instance/method to be accessed or 
invoked.
+
+For example:
+
+``` java
+@RequiresAuthentication
+public void updateAccount(Account userAccount) {
+    //this method will only be invoked by a
+    //Subject that is guaranteed authenticated
+    ...
+}
+```
+
+This is mostly equivalent to the following Subject-based logic:
+
+``` java
+public void updateAccount(Account userAccount) {
+    if (!SecurityUtils.getSubject().isAuthenticated()) {
+        throw new AuthorizationException(...);
+    }
+
+    //Subject is guaranteed authenticated here
+    ...
+}
+```
+
+<a name="Authorization-The%7B%7BRequiresGuest%7D%7Dannotation"></a>
+#[[####The `RequiresGuest` annotation]]#
+
+The 
[RequiresGuest](static/current/apidocs/org/apache/shiro/authz/annotation/RequiresGuest.html)
 annotation requires the current Subject to be a "guest", that is, they are not 
authenticated or remembered from a previous session for the annotated 
class/instance/method to be accessed or invoked.
+
+For example:
+
+``` java
+@RequiresGuest
+public void signUp(User newUser) {
+    //this method will only be invoked by a
+    //Subject that is unknown/anonymous
+    ...
+}
+```
+
+This is mostly equivalent to the following Subject-based logic:
+
+``` java
+public void signUp(User newUser) {
+    Subject currentUser = SecurityUtils.getSubject();
+    PrincipalCollection principals = currentUser.getPrincipals();
+    if (principals != null && !principals.isEmpty()) {
+        //known identity - not a guest:
+        throw new AuthorizationException(...);
+    }
+
+    //Subject is guaranteed to be a 'guest' here
+    ...
+}
+```
+
+<a name="Authorization-The%7B%7BRequiresPermissions%7D%7Dannotation"></a>
+#[[####The `RequiresPermissions` annotation]]#
+
+The 
[RequiresPermissions](static/current/apidocs/org/apache/shiro/authz/annotation/RequiresPermissions.html)
 annotation requires the current Subject be permitted one or more permissions 
in order to execute the annotated method.
+
+For example:
+
+``` java
+@RequiresPermissions("account:create")
+public void createAccount(Account account) {
+    //this method will only be invoked by a Subject
+    //that is permitted to create an account
+    ...
+}
+```
+
+This is mostly equivalent to the following Subject-based logic:
+
+``` java
+public void createAccount(Account account) {
+    Subject currentUser = SecurityUtils.getSubject();
+    if (!subject.isPermitted("account:create")) {
+        throw new AuthorizationException(...);
+    }
+
+    //Subject is guaranteed to be permitted here
+    ...
+}
+```
+
+<a name="Authorization-The%7B%7BRequiresRoles%7D%7Dpermission"></a>
+#[[####The `RequiresRoles` permission]]#
+
+The 
[RequiresRoles](static/current/apidocs/org/apache/shiro/authz/annotation/RequiresRoles.html)
 annotation requires the current Subject to have all of the specified roles. If 
they do not have the role(s), the method will not be executed and an 
AuthorizationException is thrown.
+
+For example:
+
+``` java
+@RequiresRoles("administrator")
+public void deleteUser(User user) {
+    //this method will only be invoked by an administrator
+    ...
+}
+```
+
+This is mostly equivalent to the following Subject-based logic:
+
+``` java
+public void deleteUser(User user) {
+    Subject currentUser = SecurityUtils.getSubject();
+    if (!subject.hasRole("administrator")) {
+        throw new AuthorizationException(...);
+    }
+
+    //Subject is guaranteed to be an 'administrator' here
+    ...
+}
+```
+
+<a name="Authorization-The%7B%7BRequiresUser%7D%7Dannotation"></a>
+#[[####The `RequiresUser` annotation]]#
+
+The 
[RequiresUser](static/current/apidocs/org/apache/shiro/authz/annotation/RequiresUser.html)*
 annotation requires the current Subject to be an application user for the 
annotated class/instance/method to be accessed or invoked. An 'application 
user' is defined as a `Subject` that has a known identity, either known due to 
being authenticated during the current session or remembered from 'RememberMe' 
services from a previous session.
+
+``` java
+@RequiresUser
+public void updateAccount(Account account) {
+    //this method will only be invoked by a 'user'
+    //i.e. a Subject with a known identity
+    ...
+}
+```
+
+This is mostly equivalent to the following Subject-based logic:
+
+``` java
+public void updateAccount(Account account) {
+    Subject currentUser = SecurityUtils.getSubject();
+    PrincipalCollection principals = currentUser.getPrincipals();
+    if (principals == null || principals.isEmpty()) {
+        //no identity - they're anonymous, not allowed:
+        throw new AuthorizationException(...);
+    }
+
+    //Subject is guaranteed to have a known identity here
+    ...
+}
+```
+
+<a name="Authorization-JSPTagLibAuthorization"></a>
+#[[###JSP TagLib Authorization]]#
+
+Shiro offers a Tag Library for controlling JSP/GSP page output based on 
`Subject` state. This is covered in the [Web](web.html "Web") chapter's 
[JSP/GSP Tag Library](web.html#[[#]]#Web-taglibrary) section.
+
+<a name="Authorization-AuthorizationSequence"></a>
+Authorization Sequence
+----------------------
+
+Now that we've seen how to perform authorization based on the current 
`Subject`, let's take a look at what happens inside Shiro whenever an 
authorization call is made.
+
+We've taken our previous architecture diagram from the 
[Architecture](architecture.html "Architecture") chapter, and left only the 
components relevant to authorization highlighted. Each number represents a step 
during an authorization operation:
+
+<img style="margin:0px auto;display:block" 
src="assets/images/ShiroAuthorizationSequence.png"/>
+
+**Step 1**: Application or framework code invokes any of the `Subject` 
`hasRole*`, `checkRole*`, `isPermitted*`, or `checkPermission*` method 
variants, passing in whatever permission or role representation is required.
+
+**Step 2**: The `Subject` instance, typically a 
[`DelegatingSubject`](static/current/apidocs/org/apache/shiro/subject/support/DelegatingSubject.html)
 (or a subclass) delegates to the application's `SecurityManager` by calling 
the `securityManager`'s nearly identical respective `hasRole*`, `checkRole*`, 
`isPermitted*`, or `checkPermission*` method variants (the `securityManager` 
implements the 
[`org.apache.shiro.authz.Authorizer`](static/current/apidocs/org/apache/shiro/authz/Authorizer.html)
 interface, which defines all Subject-specific authorization methods).
+
+**Step 3**: The `SecurityManager`, being a basic 'umbrella' component, 
relays/delegates to its internal 
[`org.apache.shiro.authz.Authorizer`](static/current/apidocs/org/apache/shiro/authz/Authorizer.html)
 instance by calling the `authorizer`'s respective `hasRole*`, `checkRole*`, 
`isPermitted*`, or `checkPermission*` method. The `authorizer` instance is by 
default a 
[`ModularRealmAuthorizer`](static/current/apidocs/org/apache/shiro/authz/ModularRealmAuthorizer.html)
 instance, which supports coordinating one or more `Realm` instances during any 
authorization operation.
+
+**Step 4**: Each configured `Realm` is checked to see if it implements the 
same 
[`Authorizer`](static/current/apidocs/org/apache/shiro/authz/Authorizer.html) 
interface. If so, the Realm's own respective `hasRole*`, `checkRole*`, 
`isPermitted*`, or `checkPermission*` method is called.
+
+<a name="Authorization-%7B%7BModularRealmAuthorizer%7D%7D"></a>
+#[[###`ModularRealmAuthorizer`]]#
+
+As mentioned earlier, the Shiro `SecurityManager` implementations default to 
using a 
[`ModularRealmAuthorizer`](static/current/apidocs/org/apache/shiro/authz/ModularRealmAuthorizer.html)
 instance. The `ModularRealmAuthorizer` equally supports applications with 
single Realm as well as those with multiple realms.
+
+For any authorization operation, the `ModularRealmAuthorizer` will iterate 
over its internal collection of `Realms` and interact with each one in 
iteration order. Each `Realm` interaction functions as follows:
+
+1.  If the `Realm` itself implements the 
[`Authorizer`](static/current/apidocs/org/apache/shiro/authz/Authorizer.html) 
interface, its respective `Authorizer` method (`hasRole*`, `checkRole*`, 
`isPermitted*`, or `checkPermission*`) is called.
+
+    1.  If the Realm's method results in an exception, the exception is 
propagated as an 
[`AuthorizationException`](static/current/apidocs/org/apache/shiro/authc/AuthenticationException.html)
 to the `Subject` caller. This short-circuits the authorization process and any 
remaining Realms will not be consulted for that authorization operation.
+    
+    2.  If the Realm's method is a `hasRole*` or `isPermitted*` variant that 
returns a boolean and that return value is `true`, the `true` value is returned 
immediately and any remaining Realms are short circuited. This behavior exists 
as a performance enhancement, as typically if permitted by one Realm, it is 
implied that the Subject is permitted. This favors security policies where 
everything is prohibited by default and things are explicitly allowed, the most 
secure type of security policy.
+
+2.  If the Realm does not implement the `Authorizer` interface, it is ignored.
+
+<a name="Authorization-RealmAuthorizationOrder"></a>
+#[[####Realm Authorization Order]]#
+
+It is important to point out that, exactly like authentication, the 
`ModularRealmAuthorizer` will interact with Realm instances in _iteration_ 
order.
+
+The `ModularRealmAuthorizer` has access to the `Realm` instances configured on 
the `SecurityManager`. When executing an authorization operation, it will 
iterate over that collection, and for each `Realm` that implements the 
`Authorizer` interface itself, invoke the Realm's respective `Authorizer` 
method (e.g. `hasRole*`, `checkRole*`, `isPermitted*`, or `checkPermission*`).
+
+<a name="Authorization-Configuringaglobal%7B%7BPermissionResolver%7D%7D"></a>
+#[[####Configuring a global `PermissionResolver`]]#
+
+When performing a `String`-based permission check, most of Shiro's default 
`Realm` implementations convert this String into an actual 
[`Permission`](static/current/apidocs/org/apache/shiro/authz/Permission.html) 
instance first before performing permission _implication_ logic.
+
+This is because Permissions are evaluated based on implication logic and not a 
direct equality check (see the [Permission](permissions.html "Permissions") 
documentation for more about implication vs. equality). Implication logic is 
better represented in code than via String comparisons. Therefore, most Realms 
need to convert, or _resolve_ a submitted permission string into a 
corresponding representative `Permission` instance.
+
+To aid in this conversion, Shiro supports the notion of a 
[`PermissionResolver`](static/current/apidocs/org/apache/shiro/authz/permission/PermissionResolver.html).
 Most `Shiro` Realm implementations use a `PermissionResolver` to support their 
implementation of the `Authorizer` interface's `String`-based permission 
methods: when one of these methods is invoked on the Realm, it will use the 
`PermissionResolver` to convert the string into a Permission instance, and 
perform the check that way.
+
+All Shiro `Realm` implementations default to an internal 
[WildcardPermissionResolver](static/current/apidocs/org/apache/shiro/authz/permission/WildcardPermissionResolver.html)
 which assumes Shiro's 
[`WildcardPermission`](static/current/apidocs/org/apache/shiro/authz/permission/WildcardPermission.html)
 String format.
+
+If you want to create your own `PermissionResolver` implementation, perhaps to 
support your own Permission string syntax, and you want all configured `Realm` 
instances to support that syntax, you can set your `PermissionResolver` 
globally for all `Realms` that can be configured with one.
+
+For example, in `shiro.ini`:
+
+**shiro.ini**
+``` java
+globalPermissionResolver = com.foo.bar.authz.MyPermissionResolver
+...
+securityManager.authorizer.permissionResolver = $globalPermissionResolver
+...
+```
+
+#warning('PermissionResolverAware', 'If you want to configure a global 
<code>PermissionResolver</code>, each <code>Realm</code> that is to receive the 
configured <code>PermissionResolver</code> <b><em>must</em></b> implement the 
<a class="external-link" 
href="static/current/apidocs/src-html/org/apache/shiro/authz/permission/PermissionResolverAware.html"><code>PermisionResolverAware</code></a>
 interface.  This guarantees that the configured instance can be relayed to 
each <code>Realm</code> that supports such configuration.')
+
+If you don't want to use a global `PermissionResolver` or you don't want to be 
bothered with the `PermissionResolverAware` interface, you can always configure 
a realm with a `PermissionResolver` instance explicitly (assuming there is a 
JavaBeans-compatible setPermissionResolver method):
+
+``` java
+permissionResolver = com.foo.bar.authz.MyPermissionResolver
+
+realm = com.foo.bar.realm.MyCustomRealm
+realm.permissionResolver = $permissionResolver
+...
+```
+
+<a 
name="Authorization-Configuringaglobal%7B%7BRolePermissionResolver%7D%7D"></a>
+#[[####Configuring a global `RolePermissionResolver`]]#
+
+Similar in concept to a `PermissionResolver`, a 
[`RolePermissionResolver`](static/current/apidocs/org/apache/shiro/authz/permission/RolePermissionResolver.html)
 has the ability to represent `Permission` instances needed by a `Realm` to 
perform permission checks.
+
+The key difference with a `RolePermissionResolver` however is that the input 
`String` is a _role name_, and _not_ a permission string.
+
+A `RolePermissionResolver` can be used by a `Realm` internally when needing to 
translate a role name into a concrete set of `Permission` instances.
+
+This is a particularly useful feature for supporting legacy or inflexible data 
sources that may have no notion of permissions.
+
+For example, many LDAP directories store role names (or group names) but do 
not support association of role names to concrete permissions because they have 
no 'permission' concept. A Shiro-based application can use the role names 
stored in LDAP, but implement a `RolePermissionResolver` to convert the LDAP 
name into a set of explicit permissions to perform preferred explicit access 
control. The permission associations would be stored in another data store, 
probably a local database.
+
+Because this notion of converting role names to permissions is very 
application specific, Shiro's default `Realm` implementations do not use them.
+
+However, if you want to create your own `RolePermissionResolver` and have more 
than one `Realm` implementation that you want to configure with it, you can set 
your `RolePermissionResolver` globally for all `Realms` that can be configured 
with one.
+
+**shiro.ini**
+
+``` java
+globalRolePermissionResolver = com.foo.bar.authz.MyPermissionResolver
+...
+securityManager.authorizer.rolePermissionResolver = 
$globalRolePermissionResolver
+...
+```
+
+#warning('RolePermissionResolverAware', 'If you want to configure a global 
<code>RolePermissionResolver</code>, each <code>Realm</code> that is to receive 
the configured <code>RolePermissionResolver</code> <b><em>must</em></b> 
implement the <a class="external-link" 
href="static/current/apidocs/org/apache/shiro/authz/permission/RolePermissionResolverAware.html"><code>RolePermisionResolverAware</code></a>
 interface.  This guarantees that the configured global 
<code>RolePermissionResolver</code> instance can be relayed to each 
<code>Realm</code> that supports such configuration.')
+
+If you don't want to use a global `RolePermissionResolver` or you don't want 
to be bothered with the `RolePermissionResolverAware` interface, you can always 
configure a realm with a `RolePermissionResolver` instance explicitly (assuming 
there is a JavaBeans-compatible setRolePermissionResolver method):
+
+``` ini
+rolePermissionResolver = com.foo.bar.authz.MyRolePermissionResolver
+
+realm = com.foo.bar.realm.MyCustomRealm
+realm.rolePermissionResolver = $rolePermissionResolver
+...
+```
+
+<a name="Authorization-CustomAuthorizer"></a>
+#[[###Custom Authorizer]]#
+
+If your application uses more than one realm to perform authorization and the 
`ModularRealmAuthorizer`'s default simple iteration-based, short-circuiting 
authorization behavior does not suit your needs, you will probably want to 
create a custom `Authorizer` and configure the `SecurityManager` accordingly.
+
+For example, in `shiro.ini`:
+
+``` ini
+[main]
+...
+authorizer = com.foo.bar.authz.CustomAuthorizer
+
+securityManager.authorizer = $authorizer
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/shiro-site/blob/a2ce402a/cas.html
----------------------------------------------------------------------
diff --git a/cas.html b/cas.html
deleted file mode 100644
index 21cfe88..0000000
--- a/cas.html
+++ /dev/null
@@ -1,182 +0,0 @@
-<h1><a name="CAS-IntegratingApacheShirowithCASSSOserver"></a>Integrating 
Apache Shiro with CAS SSO server</h1>
-
-<div class="warning">
-    <span>NOTE:</span>
-    Shiro-CAS support is deprecated, support has been moved to the Apache 
Shiro based <a href="https://github.com/bujiio/buji-pac4j";>buji-pac4j</a> 
project.
-</div>
-
-<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>
-<div id="border">
-       
-       <h2>Related Content</h2>
-  <h3><a href="web-features.html">Web Apps with Shiro</a></h3>
-  <p>Learn more about integrating Shiro into web applications. </br><span 
style="font-size:11"><a href="web-features.html">Read More 
&gt;&gt;</a></span></p>
-       
-</div>
-</td>
-</tr>
-</table>
-
-
-<p>The <em>shiro-cas</em> module is made to protect a web application with a 
<a class="external-link" href="https://wiki.jasig.org/display/CAS/Home"; 
rel="nofollow">Jasig CAS</a> SSO server. It enables a Shiro-enabled application 
to be a CAS client.</p>
-
-<h2><a name="CAS-BasicunderstandingoftheCASprotocol"></a>Basic understanding 
of the CAS protocol</h2>
-
-<p>1. If you want to access an application protected by a CAS client and if 
you are not authenticated in this application, you are redirected by the CAS 
client to the CAS server login page. A service parameter in the CAS login url 
defines the application the user wants to login.</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">http:<span 
class="code-comment">//application.examples.com/<span 
class="code-keyword">protected</span>/index.jsp &#8594; HTTP 302
-</span>&#8594; https:<span 
class="code-comment">//server.cas.com/login?service=http://application.examples.com/shiro-cas</span></pre>
-</div></div>
-
-<p>2. You fill the login and password and authenticate in CAS server which 
then redirects the user to the application (the service url) with a service 
ticket in url. The service ticket is a short-lived one-time-use token 
redeemable at the CAS server for a user identifier (and optionally, user 
attributes).</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">https:<span 
class="code-comment">//server.cas.com/login?service=http://application.examples.com/shiro-cas
 &#8594; HTTP 302
-</span>&#8594; http:<span 
class="code-comment">//application.examples.com/shiro-cas?ticket=ST-4545454542121-cas</span></pre>
-</div></div>
-
-<p>3. The application asks directly the CAS server if the service ticket is 
valid and the CAS server responds by the identity of the authenticated user. 
Generally, the CAS client forwards the user to the originally called protected 
page.</p>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">http:<span 
class="code-comment">//application.examples.com/shiro-cas?ticket=ST-4545454542121-cas
 &#8594; HTTP 302
-</span>&#8594; http:<span 
class="code-comment">//application.examples.com/<span 
class="code-keyword">protected</span>/index.jsp</span></pre>
-</div></div>
-
-
-<h2><a name="CAS-HowtoconfigureshirotoworkwithCASserver%3F"></a>How to 
configure shiro to work with CAS server ?</h2>
-
-<h3><a name="CAS-Dependency"></a>Dependency</h3>
-
-<p>You need to add the <em>shiro-cas</em> Maven dependency in your application 
:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;dependency&gt;</span>
-    <span class="code-tag">&lt;groupId&gt;</span>org.apache.shiro<span 
class="code-tag">&lt;/groupId&gt;</span>
-    <span class="code-tag">&lt;artifactId&gt;</span>shiro-cas<span 
class="code-tag">&lt;/artifactId&gt;</span>
-    <span class="code-tag">&lt;version&gt;</span>version<span 
class="code-tag">&lt;/version&gt;</span>
-<span class="code-tag">&lt;/dependency&gt;</span></pre>
-</div></div>
-<p>(<em>version</em> &gt;= 1.2.0).</p>
-
-<h3><a name="CAS-CasFilter"></a>CasFilter</h3>
-
-<p>You have to define the service url of your application (which has to be 
declared also in the CAS server). This url will be used to receive CAS service 
ticket. For example&#160;: <a class="external-link" 
href="http://application.examples.com/shiro-cas"; 
rel="nofollow">http://application.examples.com/shiro-cas</a></p>
-
-<p>In your shiro configuration, you have to define the 
<tt>CasFilter</tt>&#160;:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[main]
-casFilter = org.apache.shiro.cas.CasFilter
-casFilter.failureUrl = /error.jsp</pre>
-</div></div>
-<p>(the failure url is called when the service ticket validation fails).</p>
-
-<p>And the url on which it is available&#160;:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[urls]
-/shiro-cas = casFilter</pre>
-</div></div>
-
-<p>This way, when the user is redirected to the application service url 
(<em>/shiro-cas</em>) by the CAS server with a valid service ticket (after 
authentication), this filter receives the service ticket and creates a 
<tt>CasToken</tt> which can be used by the <tt>CasRealm</tt>.</p>
-
-<h3><a name="CAS-CasRealm"></a>CasRealm</h3>
-
-<p>The <tt>CasRealm</tt> uses the <tt>CasToken</tt> created by the 
<tt>CasFilter</tt> to authenticate the user by validating the CAS service 
ticket against the CAS server.</p>
-
-<p>In your shiro configuration, you have to add the 
<tt>CasRealm</tt>&#160;:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[main]
-casRealm = org.apache.shiro.cas.CasRealm
-casRealm.defaultRoles = ROLE_USER
-#casRealm.defaultPermissions
-#casRealm.roleAttributeNames
-#casRealm.permissionAttributeNames
-#casRealm.validationProtocol = SAML
-casRealm.casServerUrlPrefix =&#160;https:<span 
class="code-comment">//server.cas.com/
-</span>casRealm.casService =&#160;http:<span 
class="code-comment">//application.examples.com/shiro-cas</span></pre>
-</div></div>
-
-<p>The <em>casServerUrlPrefix</em> is the url of the CAS server (for 
example&#160;: <a class="external-link" href="https://server.cas.com"; 
rel="nofollow">https://server.cas.com</a>).<br clear="none">
-The <em>casService</em> is the application service url, the url on wich the 
application receives CAS service ticket (for example&#160;: <a 
class="external-link" href="http://application.examples.com/shiro-cas"; 
rel="nofollow">http://application.examples.com/shiro-cas</a>).<br clear="none">
-The <em>validationProcol</em> can be SAML or CAS (default)&#160;: attributes 
and remember me information are only pushed throught the SAML validation 
procotol (except specific customizations). It depends on the version of the CAS 
server&#160;: SAML protocol can be used with CAS server version &gt;= 3.1.</p>
-<div class="panelMacro"><table class="warningMacro"><colgroup span="1"><col 
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1" 
valign="top"><img align="middle" 
src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.png"; 
width="16" height="16" alt="" border="0"></td><td colspan="1" rowspan="1">If 
you choose SAML validation, you need some more specific dependencies 
:</td></tr></table></div>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-xml">
-<span class="code-tag">&lt;dependency&gt;</span>
-    <span class="code-tag">&lt;groupId&gt;</span>commons-codec<span 
class="code-tag">&lt;/groupId&gt;</span>
-    <span class="code-tag">&lt;artifactId&gt;</span>commons-codec<span 
class="code-tag">&lt;/artifactId&gt;</span>
-<span class="code-tag">&lt;/dependency&gt;</span>
-<span class="code-tag">&lt;dependency&gt;</span>
-    <span class="code-tag">&lt;groupId&gt;</span>org.opensaml<span 
class="code-tag">&lt;/groupId&gt;</span>
-    <span class="code-tag">&lt;artifactId&gt;</span>opensaml<span 
class="code-tag">&lt;/artifactId&gt;</span>
-    <span class="code-tag">&lt;version&gt;</span>1.1<span 
class="code-tag">&lt;/version&gt;</span>
-<span class="code-tag">&lt;/dependency&gt;</span>
-<span class="code-tag">&lt;dependency&gt;</span>
-    <span class="code-tag">&lt;groupId&gt;</span>org.apache.santuario<span 
class="code-tag">&lt;/groupId&gt;</span>
-    <span class="code-tag">&lt;artifactId&gt;</span>xmlsec<span 
class="code-tag">&lt;/artifactId&gt;</span>
-    <span class="code-tag">&lt;version&gt;</span>1.4.3<span 
class="code-tag">&lt;/version&gt;</span>
-<span class="code-tag">&lt;/dependency&gt;</span></pre>
-</div></div>
-<p>The <em>defaultRoles</em> is the default roles given to the authenticated 
user after CAS authentication success.<br clear="none">
-The <em>defaultPermissions</em> is the default permissions given to the 
authenticated user after CAS authentication success.<br clear="none">
-The <em>roleAttributeNames</em> defines the names of the attributes received 
from CAS response which define roles to give to the authenticated user (the 
roles are separated by comas).<br clear="none">
-The <em>permissionAttributeNames</em> defines the names of the attributes 
received from CAS response which define permissions to give to the 
autnewhenticated user (the permissions are separated by comas).</p>
-
-<h3><a name="CAS-CasSubjectFactory"></a>CasSubjectFactory</h3>
-
-<p>In CAS server, you can have "remember me" support. This information is 
pushed through SAML validation or CAS customized validation.<br clear="none">
-To reflect the CAS-remember me status in Shiro, you have to define a specific 
<tt>CasSubjectFactory</tt> in your Shiro configuration :</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[main]
-casSubjectFactory = org.apache.shiro.cas.CasSubjectFactory
-securityManager.subjectFactory = $casSubjectFactory</pre>
-</div></div>
-
-<h3><a name="CAS-Security%C2%A0oftheapplication"></a>Security&#160;of the 
application</h3>
-
-<p>Finally, you have to define the security of your application.</p>
-
-<p>In your Shiro configuration, you have to protect url with roles&#160;(for 
example) :</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[urls]
-/<span class="code-keyword">protected</span>/** = roles[ROLE_USER]
-/** = anon</pre>
-</div></div>
-
-<p>And the login url if the user is not authenticated is to be defined on the 
CAS server with the application service url&#160;:</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[main]
-roles.loginUrl = https:<span 
class="code-comment">//server.cas.com/login?service=http://application.examples.com/shiro-cas</span></pre>
-</div></div>
-
-<p>This way, if you are not authenticated and try to acces a 
<em>/protected/**</em> url, you are redirected to the CAS server for 
authentication.</p>
-
-<h3><a name="CAS-Completeconfigurationsample"></a>Complete configuration 
sample</h3>
-
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">[main]
-casFilter = org.apache.shiro.cas.CasFilter
-casFilter.failureUrl = /error.jsp
-
-casRealm = org.apache.shiro.cas.CasRealm
-casRealm.defaultRoles = ROLE_USER
-casRealm.casServerUrlPrefix =&#160;https:<span 
class="code-comment">//server.cas.com/
-</span>casRealm.casService =&#160;http:<span 
class="code-comment">//application.examples.com/shiro-cas
-</span>
-casSubjectFactory = org.apache.shiro.cas.CasSubjectFactory
-securityManager.subjectFactory = $casSubjectFactory
-
-roles.loginUrl = https:<span 
class="code-comment">//server.cas.com/login?service=http://application.examples.com/shiro-cas
-</span>
-[urls]
-/shiro-cas = casFilter
-/<span class="code-keyword">protected</span>/** = roles[ROLE_USER]
-/** = anon</pre>
-</div></div>
-
-<h2><a name="CAS-History"></a>History</h2>
-
-<p><em>Version 1.2.0</em>&#160;: first release of the <em>shiro-cas</em> 
module.</p>

http://git-wip-us.apache.org/repos/asf/shiro-site/blob/a2ce402a/cas.md.vtl
----------------------------------------------------------------------
diff --git a/cas.md.vtl b/cas.md.vtl
new file mode 100644
index 0000000..d50aeb3
--- /dev/null
+++ b/cas.md.vtl
@@ -0,0 +1,188 @@
+<a name="CAS-IntegratingApacheShirowithCASSSOserver"></a>
+Integrating Apache Shiro with CAS SSO server
+============================================
+
+#warning('NOTE:', 'Shiro-CAS support is deprecated, support has been moved to 
the Apache Shiro based <a 
href="https://github.com/bujiio/buji-pac4j";>buji-pac4j</a> project.')
+
+<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">
+       
+  <h2>Related Content</h2>
+  <h3><a href="web-features.html">Web Apps with Shiro</a></h3>
+  <p>Learn more about integrating Shiro into web applications. <br><span 
style="font-size:11"><a href="web-features.html">Read More 
&gt;&gt;</a></span></p>
+       
+</div>
+</td></tr></tbody></table>
+
+The _shiro-cas_ module is made to protect a web application with a [Jasig 
CAS](https://wiki.jasig.org/display/CAS/Home) SSO server. It enables a 
Shiro-enabled application to be a CAS client.
+
+<a name="CAS-BasicunderstandingoftheCASprotocol"></a>
+Basic understanding of the CAS protocol
+---------------------------------------
+
+1. If you want to access an application protected by a CAS client and if you 
are not authenticated in this application, you are redirected by the CAS client 
to the CAS server login page. A service parameter in the CAS login url defines 
the application the user wants to login.
+
+``` nohighlight
+http://application.examples.com/protected/index.jsp → HTTP 302 → 
https://server.cas.com/login?service=http://application.examples.com/shiro-cas
+```
+
+2. You fill the login and password and authenticate in CAS server which then 
redirects the user to the application (the service url) with a service ticket 
in url. The service ticket is a short-lived one-time-use token redeemable at 
the CAS server for a user identifier (and optionally, user attributes).
+
+``` nohighlight
+https://server.cas.com/login?service=http://application.examples.com/shiro-cas 
→ HTTP 302 → 
http://application.examples.com/shiro-cas?ticket=ST-4545454542121-cas
+```
+
+3. The application asks directly the CAS server if the service ticket is valid 
and the CAS server responds by the identity of the authenticated user. 
Generally, the CAS client forwards the user to the originally called protected 
page.
+
+``` nohighlight
+http://application.examples.com/shiro-cas?ticket=ST-4545454542121-cas → HTTP 
302 → http://application.examples.com/protected/index.jsp
+```
+
+<a name="CAS-HowtoconfigureshirotoworkwithCASserver%3F"></a>
+How to configure shiro to work with CAS server ?
+------------------------------------------------
+
+<a name="CAS-Dependency"></a>
+#[[###Dependency]]#
+
+You need to add the _shiro-cas_ Maven dependency in your application :
+
+``` xml
+<dependency>
+    <groupId>org.apache.shiro</groupId>
+    <artifactId>shiro-cas</artifactId>
+    <version>version</version>
+</dependency>
+```
+
+(_version_ >= 1.2.0).
+
+<a name="CAS-CasFilter"></a>
+#[[###CasFilter]]#
+
+You have to define the service url of your application (which has to be 
declared also in the CAS server). This url will be used to receive CAS service 
ticket. For example : 
[http://application.examples.com/shiro-cas](http://application.examples.com/shiro-cas)
+
+In your shiro configuration, you have to define the <tt>CasFilter</tt> :
+
+``` ini
+[main]
+casFilter = org.apache.shiro.cas.CasFilter
+casFilter.failureUrl = /error.jsp
+```
+
+(the failure url is called when the service ticket validation fails).
+
+And the url on which it is available :
+
+``` ini
+[urls]
+/shiro-cas = casFilter
+```
+
+This way, when the user is redirected to the application service url 
(_/shiro-cas_) by the CAS server with a valid service ticket (after 
authentication), this filter receives the service ticket and creates a 
<tt>CasToken</tt> which can be used by the <tt>CasRealm</tt>.
+
+<a name="CAS-CasRealm"></a>
+#[[###CasRealm]]#
+
+The <tt>CasRealm</tt> uses the <tt>CasToken</tt> created by the 
<tt>CasFilter</tt> to authenticate the user by validating the CAS service 
ticket against the CAS server.
+
+In your shiro configuration, you have to add the <tt>CasRealm</tt> :
+
+``` ini
+[main]
+casRealm = org.apache.shiro.cas.CasRealm
+casRealm.defaultRoles = ROLE_USER
+#casRealm.defaultPermissions
+#casRealm.roleAttributeNames
+#casRealm.permissionAttributeNames
+#casRealm.validationProtocol = SAML
+casRealm.casServerUrlPrefix = https://server.cas.com/ casRealm.casService = 
http://application.examples.com/shiro-cas
+```
+
+The _casServerUrlPrefix_ is the url of the CAS server (for example : 
[https://server.cas.com](https://server.cas.com)).
+The _casService_ is the application service url, the url on wich the 
application receives CAS service ticket (for example : 
[http://application.examples.com/shiro-cas](http://application.examples.com/shiro-cas)).
+The _validationProcol_ can be SAML or CAS (default) : attributes and remember 
me information are only pushed throught the SAML validation procotol (except 
specific customizations). It depends on the version of the CAS server : SAML 
protocol can be used with CAS server version >= 3.1.
+
+#danger('NOTE:' 'If you choose SAML validation, you need some more specific 
dependencies :')
+
+``` xml
+<dependency>
+    <groupId>commons-codec</groupId>
+    <artifactId>commons-codec</artifactId>
+</dependency>
+<dependency>
+    <groupId>org.opensaml</groupId>
+    <artifactId>opensaml</artifactId>
+    <version>1.1</version>
+</dependency>
+<dependency>
+    <groupId>org.apache.santuario</groupId>
+    <artifactId>xmlsec</artifactId>
+    <version>1.4.3</version>
+</dependency>
+```
+
+The _defaultRoles_ is the default roles given to the authenticated user after 
CAS authentication success.
+The _defaultPermissions_ is the default permissions given to the authenticated 
user after CAS authentication success.
+The _roleAttributeNames_ defines the names of the attributes received from CAS 
response which define roles to give to the authenticated user (the roles are 
separated by comas).
+The _permissionAttributeNames_ defines the names of the attributes received 
from CAS response which define permissions to give to the autnewhenticated user 
(the permissions are separated by comas).
+
+<a name="CAS-CasSubjectFactory"></a>
+#[[###CasSubjectFactory]]#
+
+In CAS server, you can have "remember me" support. This information is pushed 
through SAML validation or CAS customized validation.
+To reflect the CAS-remember me status in Shiro, you have to define a specific 
<tt>CasSubjectFactory</tt> in your Shiro configuration :
+
+``` ini
+[main]
+casSubjectFactory = org.apache.shiro.cas.CasSubjectFactory
+securityManager.subjectFactory = $casSubjectFactory
+```
+
+<a name="CAS-Security%C2%A0oftheapplication"></a>
+#[[###Security of the application]]#
+
+Finally, you have to define the security of your application.
+
+In your Shiro configuration, you have to protect url with roles (for example) 
:
+
+``` ini
+[urls]
+/protected/** = roles[ROLE_USER]
+/** = anon
+```
+
+And the login url if the user is not authenticated is to be defined on the CAS 
server with the application service url :
+
+``` ini
+[main]
+roles.loginUrl = 
https://server.cas.com/login?service=http://application.examples.com/shiro-cas
+```
+
+This way, if you are not authenticated and try to acces a _/protected/**_ url, 
you are redirected to the CAS server for authentication.
+
+<a name="CAS-Completeconfigurationsample"></a>
+#[[###Complete configuration sample]]#
+
+``` ini
+[main]
+casFilter = org.apache.shiro.cas.CasFilter
+casFilter.failureUrl = /error.jsp
+
+casRealm = org.apache.shiro.cas.CasRealm
+casRealm.defaultRoles = ROLE_USER
+casRealm.casServerUrlPrefix = https://server.cas.com/ casRealm.casService = 
http://application.examples.com/shiro-cas 
+casSubjectFactory = org.apache.shiro.cas.CasSubjectFactory
+securityManager.subjectFactory = $casSubjectFactory
+
+roles.loginUrl = 
https://server.cas.com/login?service=http://application.examples.com/shiro-cas 
+[urls]
+/shiro-cas = casFilter
+/protected/** = roles[ROLE_USER]
+/** = anon
+```
+
+<a name="CAS-History"></a>
+#[[##History]]#
+
+_Version 1.2.0_ : first release of the _shiro-cas_ module.
\ No newline at end of file

Reply via email to