net.sf.jguard.principals
Class SubjectAsPrincipal

java.lang.Object
  extended by net.sf.jguard.principals.SubjectAsPrincipal
All Implemented Interfaces:
java.io.Serializable, java.security.Principal

public class SubjectAsPrincipal
extends java.lang.Object
implements java.security.Principal, java.io.Serializable

acts as a bridge between the Subject in JAAS j2se which contains the user and the Principal in j2ee which contains the user. (in JAAS, the Principal should be a role and not a user.....).

Author:
Charles Gay
See Also:
Serialized Form

Constructor Summary
SubjectAsPrincipal(javax.security.auth.Subject subj)
          constructor.
 
Method Summary
 boolean equals(SubjectAsPrincipal subjAsPrincipal)
          compare two SubjectAsPrincipal objects(compare their Subject).
 java.lang.String getName()
           
 javax.security.auth.Subject getSubject()
          return the wrapped Subject object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Principal
equals, hashCode, toString
 

Constructor Detail

SubjectAsPrincipal

public SubjectAsPrincipal(javax.security.auth.Subject subj)
constructor.

Parameters:
subj - subject to wrap.
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface java.security.Principal
Returns:
the value of a credential present in the public credentials ' set of the Subject, if its 'id' is "name".
See Also:
JGuardCredential

equals

public boolean equals(SubjectAsPrincipal subjAsPrincipal)
compare two SubjectAsPrincipal objects(compare their Subject).

Parameters:
subjAsPrincipal -
Returns:
true if the contained Subject is equals to the one contained in the SubjectAsPrincipal instance as parameter;otherwise, false.

getSubject

public javax.security.auth.Subject getSubject()
return the wrapped Subject object.

Returns:
wrapped Subject
See Also:
Subject