org.jboss.security.plugins
Class NullSecurityManager

java.lang.Object
  |
  +--org.jboss.security.plugins.NullSecurityManager
All Implemented Interfaces:
AuthenticationManager, RealmMapping, java.io.Serializable, SubjectSecurityManager

public class NullSecurityManager
extends java.lang.Object
implements SubjectSecurityManager, RealmMapping, 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.

Version:
$Revision: 1.1.2.1 $
Author:
Scott_Stark@displayscape.com
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.
 
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 SubjectSecurityManager
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 SubjectSecurityManager
Returns:
Always returns null.

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
Returns:
true if the principal was authenticated, false otherwise.

getPrincipal

public java.security.Principal getPrincipal(java.security.Principal principal)
Always returns the argument principal.
Specified by:
getPrincipal in interface RealmMapping
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
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
Returns:
The Set with the AnybodyPrincipal as the sole role.


Copyright © 2000 The JBoss Organization. All Rights Reserved.