| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.dna.graph.JaasSecurityContext
@NotThreadSafe public final class JaasSecurityContext

JAAS-based security context that provides authentication and authorization through the JAAS
 login context.
| Nested Class Summary | |
|---|---|
| static class | JaasSecurityContext.UserPasswordCallbackHandlerA simple callback handlerimplementation that attempts to provide a user ID and password to any
 callbacks that it handles. | 
| Constructor Summary | |
|---|---|
| JaasSecurityContext(LoginContext loginContext)Creates a new JAAS security context based on the given login context. | |
| JaasSecurityContext(String realmName)Create a JaasSecurityContextwith the suppliedapplication
 configuration name. | |
| JaasSecurityContext(String realmName,
                    CallbackHandler callbackHandler)Create a JaasSecurityContextwith the suppliedapplication
 configuration nameand the given callback handler. | |
| JaasSecurityContext(String realmName,
                    String userId,
                    char[] password)Create a JaasSecurityContextwith the suppliedapplication
 configuration nameand aJAAS callback handlerto create a newJAAS
 login contextwith the given user ID and password. | |
| JaasSecurityContext(String realmName,
                    Subject subject)Create a JaasSecurityContextwith the suppliedapplication
 configuration nameand aJAAS subject. | |
| JaasSecurityContext(Subject subject)Creates a new JAAS security context based on the user name and roles from the given subject. | |
| Method Summary | |
|---|---|
|  String | getUserName()Returns the authenticated user's name | 
|  boolean | hasRole(String roleName)Returns whether the authenticated user has the given role. | 
|  void | logout()Logs the user out of the authentication mechanism. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public JaasSecurityContext(String realmName)
                    throws LoginException
JaasSecurityContext with the supplied application
 configuration name.
realmName - the name of the JAAS application configuration name
        ; may not be null
IllegalArgumentException - if the name is null
LoginException - if there name is invalid (or there is no login context named "other"), or if the
         default callback handler JAAS property was not set or could not be loaded
public JaasSecurityContext(String realmName,
                           Subject subject)
                    throws LoginException
JaasSecurityContext with the supplied application
 configuration name and a JAAS subject.
realmName - the name of the JAAS application configuration namesubject - the subject to authenticate
LoginException - if there name is invalid (or there is no login context named "other"), if the default
         callback handler JAAS property was not set or could not be loaded, or if the subject is null or
         unknown
public JaasSecurityContext(String realmName,
                           String userId,
                           char[] password)
                    throws LoginException
JaasSecurityContext with the supplied application
 configuration name and a JAAS callback handler to create a new JAAS
 login context with the given user ID and password.
realmName - the name of the JAAS application configuration nameuserId - the user ID to use for authenticationpassword - the password to use for authentication
LoginException - if there name is invalid (or there is no login context named "other"), or if the
         callbackHandler is null
public JaasSecurityContext(String realmName,
                           CallbackHandler callbackHandler)
                    throws LoginException
JaasSecurityContext with the supplied application
 configuration name and the given callback handler.
realmName - the name of the JAAS application configuration name
        ; may not be nullcallbackHandler - the callback handler to use during the login process; may not be null
LoginException - if there name is invalid (or there is no login context named "other"), or if the
         callbackHandler is null
public JaasSecurityContext(LoginContext loginContext)
                    throws LoginException
login has not already
 been invoked on the login context, this constructor will attempt to invoke it.
loginContext - the login context to use; may not be null
LoginException - if the context has not already had its login method invoked and an
         error occurs attempting to invoke the login method.LoginContextpublic JaasSecurityContext(Subject subject)
subject - the subject to use as the provider of the user name and roles for this security context; may not be null| Method Detail | 
|---|
public String getUserName()
getUserName in interface SecurityContextSecurityContext.getUserName()public boolean hasRole(String roleName)
hasRole in interface SecurityContextroleName - the name of the role to check
SecurityContext.hasRole(String)public void logout()
For some authentication mechanisms, this will be implemented as a no-op.
logout in interface SecurityContextSecurityContext.logout()| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||