org.jboss.security.plugins
Class NullSecurityManager

java.lang.Object
  extended byorg.jboss.security.plugins.NullSecurityManager
All Implemented Interfaces:
AuthenticationManager (src) , RealmMapping (src) , java.io.Serializable, SubjectSecurityManager (src)

public class NullSecurityManager
extends java.lang.Object
implements SubjectSecurityManager (src) , RealmMapping (src) , java.io.Serializable

An implementation of SubjectSecurityManager, RealmMapping that authenticates everyone and for which Principals have any role requested. It can be used as a pass-through security manager when you want noop security.

See Also:
isValid(Principal, Object), getPrincipal(Principal), doesUserHaveRole(Principal, Set), Serialized Form

Constructor Summary
NullSecurityManager(java.lang.String securityDomain)
          Creates a default JaasSecurityManager for with the given securityDomain name.
 
Method Summary
 boolean doesUserHaveRole(java.security.Principal principal, java.util.Set roleNames)
          Does the current Subject have a role(a Principal) that equates to one of the role names.
 javax.security.auth.Subject getActiveSubject()
          Get the currently authenticated Subject.
 java.security.Principal getPrincipal(java.security.Principal principal)
          Always returns the argument principal.
 java.lang.String getSecurityDomain()
          Get the name of the security domain associated with this security mgr.
 java.util.Set getUserRoles(java.security.Principal principal)
          Return the set of domain roles the principal has been assigned.
 boolean isValid(java.security.Principal principal, java.lang.Object credential)
          Validate that the given credential is correct for principal.
 boolean isValid(java.security.Principal principal, java.lang.Object credential, javax.security.auth.Subject activeSubject)
          Validate that the given credential is correct for principal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullSecurityManager

public NullSecurityManager(java.lang.String securityDomain)
Creates a default JaasSecurityManager for with the given securityDomain name.

Method Detail

getSecurityDomain

public java.lang.String getSecurityDomain()
Get the name of the security domain associated with this security mgr.

Specified by:
getSecurityDomain in interface AuthenticationManager (src)
Returns:
Name of the security manager security domain.

getActiveSubject

public javax.security.auth.Subject getActiveSubject()
Get the currently authenticated Subject.

Specified by:
getActiveSubject in interface AuthenticationManager (src)
Returns:
Always returns null.
See Also:
AuthenticationManager.isValid(java.security.Principal, Object), AuthenticationManager.isValid(java.security.Principal, Object, javax.security.auth.Subject)

isValid

public boolean isValid(java.security.Principal principal,
                       java.lang.Object credential)
Validate that the given credential is correct for principal.

Specified by:
isValid in interface AuthenticationManager (src)
Parameters:
principal - - the user identity in the operation environment
credential - - the proof of user identity as known in the operation environment
Returns:
always returns true.

isValid

public boolean isValid(java.security.Principal principal,
                       java.lang.Object credential,
                       javax.security.auth.Subject activeSubject)
Validate that the given credential is correct for principal. This does not populate the activeSubject with any state since no authentication is performed.

Specified by:
isValid in interface AuthenticationManager (src)
Parameters:
principal - - the user identity in the operation environment
credential - - the proof of user identity as known in the operation environment
Returns:
always returns true.

getPrincipal

public java.security.Principal getPrincipal(java.security.Principal principal)
Always returns the argument principal.

Specified by:
getPrincipal in interface RealmMapping (src)
Parameters:
principal - the caller principal as known in the operation environment.
Returns:
The argument principal

doesUserHaveRole

public boolean doesUserHaveRole(java.security.Principal principal,
                                java.util.Set roleNames)
Does the current Subject have a role(a Principal) that equates to one of the role names. This method always returns true.

Specified by:
doesUserHaveRole in interface RealmMapping (src)
Parameters:
principal - - ignored.
roleNames - - ignored.
Returns:
Always returns true.

getUserRoles

public java.util.Set getUserRoles(java.security.Principal principal)
Return the set of domain roles the principal has been assigned.

Specified by:
getUserRoles in interface RealmMapping (src)
Returns:
The Set with the AnybodyPrincipal as the sole role.