issrg.simplePERMIS
Class SimplePERMISTokenParser

java.lang.Object
  extended by issrg.simplePERMIS.SimplePERMISTokenParser
All Implemented Interfaces:
AuthzTokenParser, RoleBasedAuthzTokenParser

public class SimplePERMISTokenParser
extends java.lang.Object
implements RoleBasedAuthzTokenParser

This class implements the RoleBasedAuthTokenParser interface. It extracts role attributes from SimplePERMISToken objects and creates parsed token objects. It is the default token parser defined in issrg.pba.rbac.CustomisePERMIS.

Author:
Romain & Gansen
See Also:
CustomisePERMIS

Field Summary
protected  RoleHierarchyPolicy roleHierarchy
           
 
Constructor Summary
SimplePERMISTokenParser()
           
 
Method Summary
 ParsedToken decode(java.lang.Object creds)
          This method decodes the credentials of type SimplePERMISToken.
 ParsedToken decode(java.lang.Object creds, java.util.Date notBefore, java.util.Date notAfter)
          This method decodes the credentials of type SimplePERMISToken.
 java.util.Map getAuthzTokenParsingRules()
          This method returns the Authorisation Token Parsing Rules, as a Map with a single entry with the key issrg.pba.rbac.RoleHierarchyPolicy.class and the value being the RoleHierarchyPolicy used by this SimplePERMISTokenParser.
 SignatureVerifier getSignatureVerifier()
          This method gets the Signature Verifier used by the Token Parser.
 void setAuthzTokenParsingRules(java.util.Map m)
          This method sets the Auth Token parsing rules.
 void setRoleHierarchy(RoleHierarchyPolicy rhp)
          Set the Role Hierarchy Policy.
 void setSignatureVerifier(SignatureVerifier sv)
          This method sets the signature verifier for the parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

roleHierarchy

protected RoleHierarchyPolicy roleHierarchy
Constructor Detail

SimplePERMISTokenParser

public SimplePERMISTokenParser()
Method Detail

setRoleHierarchy

public void setRoleHierarchy(RoleHierarchyPolicy rhp)
Set the Role Hierarchy Policy. The policy defines the types of the roles, the values of the roles of each type, and the hierarchical relationship between them.

Specified by:
setRoleHierarchy in interface RoleBasedAuthzTokenParser
Parameters:
rhp - is a reference to the Role Hierarchy

setAuthzTokenParsingRules

public void setAuthzTokenParsingRules(java.util.Map m)
This method sets the Auth Token parsing rules.

Specified by:
setAuthzTokenParsingRules in interface AuthzTokenParser
Parameters:
m - is the parsing rules of type Map with a single entry with the key issrg.pba.rbac.RoleHierarchyPolicy.class and the value being the RoleHierarchyPolicy to be used by this SimplePERMISTokenParser.

getAuthzTokenParsingRules

public java.util.Map getAuthzTokenParsingRules()
This method returns the Authorisation Token Parsing Rules, as a Map with a single entry with the key issrg.pba.rbac.RoleHierarchyPolicy.class and the value being the RoleHierarchyPolicy used by this SimplePERMISTokenParser.

Specified by:
getAuthzTokenParsingRules in interface AuthzTokenParser
Returns:
The parsing rules of type Map.

decode

public ParsedToken decode(java.lang.Object creds)
                   throws PbaException
This method decodes the credentials of type SimplePERMISToken. If the credential is already parsed, it returns, otherwise, it returns an object of type ParsedToken.

Specified by:
decode in interface AuthzTokenParser
Parameters:
creds - - The credential to be parsed. It should be an instance of SimplePERMISToken.
Returns:
The parsed form of the credential.
Throws:
PbaException - if the credential in input is not a SimplePERMISToken.

decode

public ParsedToken decode(java.lang.Object creds,
                          java.util.Date notBefore,
                          java.util.Date notAfter)
                   throws PbaException
This method decodes the credentials of type SimplePERMISToken. If the credential is already parsed, it returns, otherwise, it returns an object of type ParsedToken.

Parameters:
creds - - The credential to be parsed. It should be an instance of SimplePERMISToken.
notBefore - - the token validity period starting date
notAfter - - the token validity period expiry date
Returns:
The parsed form of the credential.
Throws:
PbaException - if the credential in input is not a SimplePERMISToken.

setSignatureVerifier

public void setSignatureVerifier(SignatureVerifier sv)
This method sets the signature verifier for the parser. Since SimplePERMISTokenParser does not care about signatures (SimplePERMISToken doesn't provide any signature), the method simply discards the input parameter and return true.

Specified by:
setSignatureVerifier in interface AuthzTokenParser

getSignatureVerifier

public SignatureVerifier getSignatureVerifier()
Description copied from interface: AuthzTokenParser
This method gets the Signature Verifier used by the Token Parser. Token Parsers for tokens that do not have signatures may return null. If the Signature Verifier has not been set yet, the method may return null.

Specified by:
getSignatureVerifier in interface AuthzTokenParser