org.jasig.cas.client.tomcat
Class PropertiesCasRealmDelegate

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

public class PropertiesCasRealmDelegate
extends Object
implements CasRealm

CasRealm implementation with users and roles defined by a properties file with the following format:

 username1=role1,role2,role3
 username2=role1
 username3=role2,role3
 
User authentication succeeds if the name of the given principal exists as a username in the properties file.

Since:
3.1.12
Version:
$Revision$
Author:
Middleware

Constructor Summary
PropertiesCasRealmDelegate()
           
 
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 readProperties()
          
 void setPropertiesFilePath(String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesCasRealmDelegate

public PropertiesCasRealmDelegate()
Method Detail

setPropertiesFilePath

public void setPropertiesFilePath(String path)
Parameters:
path - Path to properties file container username/role data.

readProperties

public void readProperties()


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.