Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.adapters
Class AbstractAdapterAuthenticationToken  view AbstractAdapterAuthenticationToken download AbstractAdapterAuthenticationToken.java

java.lang.Object
  extended byorg.acegisecurity.providers.AbstractAuthenticationToken
      extended byorg.acegisecurity.adapters.AbstractAdapterAuthenticationToken
All Implemented Interfaces:
AuthByAdapter, org.acegisecurity.Authentication, java.security.Principal, java.io.Serializable
Direct Known Subclasses:
PrincipalAcegiUserToken

public abstract class AbstractAdapterAuthenticationToken
extends org.acegisecurity.providers.AbstractAuthenticationToken
implements AuthByAdapter

Convenience superclass for AuthByAdapter implementations.

Version:
$Id: AbstractAdapterAuthenticationToken.java,v 1.5 2005/11/17 00:55:49 benalex Exp $

Field Summary
private  GrantedAuthority[] authorities
           
private  int keyHash
           
 
Constructor Summary
protected AbstractAdapterAuthenticationToken()
           
protected AbstractAdapterAuthenticationToken(java.lang.String key, GrantedAuthority[] authorities)
          The only way an AbstractAdapterAuthentication should be constructed.
 
Method Summary
 boolean equals(java.lang.Object obj)
          This method tests another Principal object for equality with this one.
 GrantedAuthority[] getAuthorities()
          Set by an AuthenticationManager to indicate the authorities that the principal has been granted.
 int getKeyHash()
          Returns the hash code of the key that was passed to the constructor of the AuthByAdapter implementation.
 boolean isAuthenticated()
          Always returns true.
 boolean isUserInRole(java.lang.String role)
          Iterates the granted authorities and indicates whether or not the specified role is held.
 void setAuthenticated(boolean ignored)
          Setting is ignored.
 
Methods inherited from class org.acegisecurity.providers.AbstractAuthenticationToken
getDetails, getName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.acegisecurity.Authentication
getCredentials, getDetails, getPrincipal
 
Methods inherited from interface java.security.Principal
getName, hashCode, toString
 

Field Detail

authorities

private GrantedAuthority[] authorities

keyHash

private int keyHash
Constructor Detail

AbstractAdapterAuthenticationToken

protected AbstractAdapterAuthenticationToken()

AbstractAdapterAuthenticationToken

protected AbstractAdapterAuthenticationToken(java.lang.String key,
                                             GrantedAuthority[] authorities)
The only way an AbstractAdapterAuthentication should be constructed.

Method Detail

setAuthenticated

public void setAuthenticated(boolean ignored)
Setting is ignored. Always considered authenticated.

Specified by:
setAuthenticated in interface org.acegisecurity.Authentication

isAuthenticated

public boolean isAuthenticated()
Always returns true.

Specified by:
isAuthenticated in interface org.acegisecurity.Authentication

getAuthorities

public GrantedAuthority[] getAuthorities()
Description copied from interface: org.acegisecurity.Authentication
Set by an AuthenticationManager to indicate the authorities that the principal has been granted. Note that classes should not rely on this value as being valid unless it has been set by a trusted AuthenticationManager.

Specified by:
getAuthorities in interface org.acegisecurity.Authentication

getKeyHash

public int getKeyHash()
Description copied from interface: AuthByAdapter
Returns the hash code of the key that was passed to the constructor of the AuthByAdapter implementation. The implementation should convert the value to a hash code at construction time, rather than storing the key itself.

Specified by:
getKeyHash in interface AuthByAdapter

isUserInRole

public boolean isUserInRole(java.lang.String role)
Iterates the granted authorities and indicates whether or not the specified role is held.

Comparison is based on the String returned by GrantedAuthority#getAuthority.


equals

public boolean equals(java.lang.Object obj)
Description copied from interface: java.security.Principal
This method tests another Principal object for equality with this one.

Specified by:
equals in interface java.security.Principal