public class RMUserContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
P8_STANZA_EJB
Potential value to use for the
stanzaName input parameter of
the createSubject(DomainConnection, String, String, String) method. |
static java.lang.String |
P8_STANZA_WSI
Potential value to use for the
stanzaName input parameter of
the createSubject(DomainConnection, String, String, String) method. |
Modifier and Type | Method and Description |
---|---|
static javax.security.auth.Subject |
createSubject(DomainConnection conn,
java.lang.String username,
java.lang.String password,
java.lang.String stanzaName)
Performs standard JAAS authentication and returns a JAAS
javax.security.auth.Subject instance. |
static RMUserContext |
get()
Returns the
RMUserContext instance that is associated with the
current thread. |
java.util.Locale |
getLocale()
Returns the
Locale associated with this user context. |
static java.lang.String |
getPrincipals(javax.security.auth.Subject subject)
Returns a string containing a list of
java.security.Principal instances for the given
javax.security.auth.Subject instance. |
javax.security.auth.Subject |
getSubject() |
static void |
set(RMUserContext uc)
Associates the specified
RMUserContext instance with the current thread. |
void |
setLocale(java.util.Locale locale)
Sets the
Locale for this user context. |
void |
setSubject(javax.security.auth.Subject subject)
Associates a JAAS
javax.security.auth.Subject instance on this user context for the current thread. |
public static final java.lang.String P8_STANZA_EJB
stanzaName
input parameter of
the createSubject(DomainConnection, String, String, String)
method.
This value indicates that the appropriate JAAS login module P8CE EJB stanza
be used.public static final java.lang.String P8_STANZA_WSI
stanzaName
input parameter of
the createSubject(DomainConnection, String, String, String)
method.
This value indicates that the appropriate JAAS login module P8CE WSI stanza
be used.public void setLocale(java.util.Locale locale)
Locale
for this user context.locale
- the Locale
instance to associate with this user context.
This entry can be null
, in which case the default Locale
for the
JVM is used.public java.util.Locale getLocale()
Locale
associated with this user context. If no Locale
has been
previously set, then the default Locale
for the JVM is returned.Locale
instance.public void setSubject(javax.security.auth.Subject subject)
javax.security.auth.Subject
instance on this user context for the current thread.
For a P8 Content Engine environment, the createSubject(DomainConnection, String, String, String)
method can
be used to create a javax.security.auth.Subject
instance for use by this method.subject
- the javax.security.auth.Subject
instance to associate with the current thread.
This entry can be null
to remove any previously established javax.security.auth.Subject
.public javax.security.auth.Subject getSubject()
javax.security.auth.Subject
instance currently associated with this
user context. This entry can be null
.public static javax.security.auth.Subject createSubject(DomainConnection conn, java.lang.String username, java.lang.String password, java.lang.String stanzaName)
javax.security.auth.Subject
instance.
The client must be property configured for JAAS.
The calling code can optionally provide a JAAS configuration stanza name or pass in
a null
value, in which case default stanza name is used based upon the
Domain type (for example, for P8 Content Engine: "FileNetP8").
The returned javax.security.auth.Subject
instance has no association with the
current user context. It is up to the caller to either set this javax.security.auth.Subject
instance on the RMUserContent
instance, or use the JAAS
Subject.doAs
method.conn
- the DomainConnection
to authenticate with.username
- the username String
to use for authentication.password
- the password String
to use for authentication.stanzaName
- optional JAAS authentication stanza name String
. This entry can be null
,
in which case a domain-type specific default value is used.
P8_STANZA_EJB
and P8_STANZA_WSI
are provided as
convenience constants for P8CE domain environments.javax.security.auth.Subject
instance.public static RMUserContext get()
RMUserContext
instance that is associated with the
current thread.
If no user context has been set on this thread, then a default instance is
established based upon the JVM default Locale
.RMUserContext
associated with the current thread.public static void set(RMUserContext uc)
RMUserContext
instance with the current thread.
This method replaces any previous RMUserContext
instance for the current thread.uc
- The RMUserContext
instance to associate with the
current thread. This entry can be null
, in which case any existing
RMUserContext
instance on the current thread is replaced
by the default instance.public static java.lang.String getPrincipals(javax.security.auth.Subject subject)
java.security.Principal
instances for the given
javax.security.auth.Subject
instance.
This entry is intended for tracing use only.subject
- The java.security.Principal
in question.String
if the subject is null or has no principals associated with it.© Copyright IBM Corp. 2010, 2013. All Rights Reserved.