org.jboss.security.plugins
Class NullSecurityManager

java.lang.Object
  extended by org.jboss.security.plugins.NullSecurityManager
All Implemented Interfaces:
Serializable, org.jboss.security.AuthenticationManager, org.jboss.security.BaseSecurityManager, org.jboss.security.RealmMapping, org.jboss.security.SubjectSecurityManager

public class NullSecurityManager
extends Object
implements org.jboss.security.SubjectSecurityManager, org.jboss.security.RealmMapping, 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.

Version:
$Revision: 73223 $
Author:
Scott.Stark@jboss.org
See Also:
isValid(Principal, Object, Subject), getPrincipal(Principal), doesUserHaveRole(Principal, Set), Serialized Form

Constructor Summary
NullSecurityManager(String securityDomain)
          Creates a default JaasSecurityManager for with the given securityDomain name.
 
Method Summary
 boolean doesUserHaveRole(Principal principal, Set<Principal> roleNames)
          Does the current Subject have a role(a Principal) that equates to one of the role names.
 Subject getActiveSubject()
          Get the currently authenticated Subject.
 Principal getPrincipal(Principal principal)
          Always returns the argument principal.
 String getSecurityDomain()
          Get the name of the security domain associated with this security mgr.
 Principal getTargetPrincipal(Principal anotherDomainPrincipal, Map<String,Object> contextMap)
           
 Set<Principal> getUserRoles(Principal principal)
          Return the set of domain roles the principal has been assigned.
 boolean isValid(javax.security.auth.message.MessageInfo requestMessage, Subject clientSubject, String layer)
           
 boolean isValid(javax.security.auth.message.MessageInfo requestMessage, Subject clientSubject, String layer, CallbackHandler handler)
           
 boolean isValid(Principal principal, Object credential)
          Validate that the given credential is correct for principal.
 boolean isValid(Principal principal, Object credential, 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(String securityDomain)
Creates a default JaasSecurityManager for with the given securityDomain name.

Method Detail

getSecurityDomain

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

Specified by:
getSecurityDomain in interface org.jboss.security.BaseSecurityManager
Returns:
Name of the security manager security domain.

getActiveSubject

public Subject getActiveSubject()
Get the currently authenticated Subject.

Specified by:
getActiveSubject in interface org.jboss.security.AuthenticationManager
Returns:
Always returns null.

isValid

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

Specified by:
isValid in interface org.jboss.security.AuthenticationManager
Returns:
always returns true.

isValid

public boolean isValid(Principal principal,
                       Object credential,
                       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 org.jboss.security.AuthenticationManager
Returns:
always returns true.

isValid

public boolean isValid(javax.security.auth.message.MessageInfo requestMessage,
                       Subject clientSubject,
                       String layer)
See Also:
AuthenticationManager#isValid(MessageInfo, Subject, String)

isValid

public boolean isValid(javax.security.auth.message.MessageInfo requestMessage,
                       Subject clientSubject,
                       String layer,
                       CallbackHandler handler)
See Also:
AuthenticationManager#isValid(MessageInfo, Subject, String, CallbackHandler)

getTargetPrincipal

public Principal getTargetPrincipal(Principal anotherDomainPrincipal,
                                    Map<String,Object> contextMap)
Specified by:
getTargetPrincipal in interface org.jboss.security.AuthenticationManager
See Also:
AuthenticationManager.getTargetPrincipal(Principal,Map)

getPrincipal

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

Specified by:
getPrincipal in interface org.jboss.security.RealmMapping
Returns:
The argument principal

doesUserHaveRole

public boolean doesUserHaveRole(Principal principal,
                                Set<Principal> 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 org.jboss.security.RealmMapping
Parameters:
principal - - ignored.
roleNames - - ignored.
Returns:
Always returns true.

getUserRoles

public Set<Principal> getUserRoles(Principal principal)
Return the set of domain roles the principal has been assigned.

Specified by:
getUserRoles in interface org.jboss.security.RealmMapping
Returns:
The Set with the AnybodyPrincipal as the sole role.


Copyright © 2009 JBoss Inc.. All Rights Reserved.