org.jasig.cas.client.tomcat
Class AssertionCasRealmDelegate

java.lang.Object
  extended by org.jasig.cas.client.tomcat.AssertionCasRealmDelegate
All Implemented Interfaces:
CasRealm

public class AssertionCasRealmDelegate
extends Object
implements CasRealm

CasRealm implementation with prinicpal and role data backed by the Assertion. In particular, an AttributePrincipal is expected from which the values of the role attribute are retrieved. The default role attribute name is "role", but this can be customized via setRoleAttributeName(String).

Authentication always succeeds and simply returns the given principal.

Since:
3.1.12
Version:
$Revision$
Author:
Marvin S. Addison

Field Summary
static String DEFAULT_ROLE_NAME
          Default role attribute name
 
Constructor Summary
AssertionCasRealmDelegate()
           
 
Method Summary
 Principal authenticate(Principal p)
          Authenticates the given principal.
 String[] getRoles(Principal p)
          Gets the roles defined for the given principal.
 boolean hasRole(Principal principal, String role)
          Determines whether the given principal possesses the given role.
 void setRoleAttributeName(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ROLE_NAME

public static final String DEFAULT_ROLE_NAME
Default role attribute name

See Also:
Constant Field Values
Constructor Detail

AssertionCasRealmDelegate

public AssertionCasRealmDelegate()
Method Detail

setRoleAttributeName

public void setRoleAttributeName(String name)
Parameters:
name - Name of the attribute in the principal that contains role data.

authenticate

public Principal authenticate(Principal p)
Authenticates the given principal.

Specified by:
authenticate in interface CasRealm
Parameters:
p - Principal to authenticate.
Returns:
New principal.

getRoles

public String[] getRoles(Principal p)
Gets the roles defined for the given principal.

Specified by:
getRoles in interface CasRealm
Parameters:
p - the principal to retrieve the roles for.
Returns:
Roles for given principal or empty array if none exist.

hasRole

public boolean hasRole(Principal principal,
                       String role)
Determines whether the given principal possesses the given role.

Specified by:
hasRole in interface CasRealm
Parameters:
principal - Principal to evaluate.
role - Role to test for possession.
Returns:
True if principal has given role, false otherwise.


Copyright © 2006-2014 Jasig. All Rights Reserved.