com.filenet.wcm.toolkit.server.util
Class WcmServerCredentials

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.util.WcmServerCredentials
All Implemented Interfaces:
java.io.Serializable, WcmDataStoreBindingListener, WcmUserInformationInterface

public class WcmServerCredentials
extends java.lang.Object
implements WcmDataStoreBindingListener, WcmUserInformationInterface, java.io.Serializable

WcmServerCredentials maintains credentials required for access to the Content Java API and and the Process Java API.

See Also:
Serialized Form

Field Summary
protected static WcmString classpathWillBeUsed
           
protected static WcmString configUnknown
           
protected  java.util.Map threadMap
           
static java.lang.String USER_CREDENTIALS_KEY
          A web session's user credentials that can be retrieved easily.
 
Constructor Summary
protected WcmServerCredentials()
           
  WcmServerCredentials(WcmDataStore ds, java.lang.String user, java.lang.String password)
          Deprecated. Use constructors with verify argument.
  WcmServerCredentials(WcmDataStore ds, java.lang.String user, java.lang.String password, boolean verify)
          WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.
  WcmServerCredentials(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password)
          Deprecated. Use constructors with verify argument.
  WcmServerCredentials(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password, boolean verify)
          WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.
  WcmServerCredentials(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password, boolean verify, boolean containerJAASMode)
          WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.
  WcmServerCredentials(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password, java.lang.String domain)
          Deprecated.  
 
Method Summary
 void addRouter(java.lang.String routerInfo)
           
static java.util.HashMap decodeSessionToken(WcmDataStore ds, java.lang.String token)
          Static utility method that returns a hashmap containing credentials information found in the specified token.
static java.util.HashMap decodeSessionToken(WcmDataStore ds, java.lang.String decodeAppId, java.lang.String token, long timeout)
          Static utility method that returns a hashmap containing credentials information found in the specified token.
 java.lang.String getAppId()
          Gets the appId that was set for this object.
 java.lang.String getCEServerURI()
          Gets the RemoteServerUrl value from WcmApiConfig.properties that is associated with this object.
static WcmServerCredentials getCurrent(WcmDataStore ds)
          Get the current server credentials object from the data store.
protected  java.util.Set getGroups()
          Returns the Java API groups object when WcmServerCredentials is valid.
 java.lang.String getPassword()
           
 java.lang.String getRawUserId()
          Get the user ID as it was originally passed into the constructor of this object.
 com.filenet.wcm.api.Session getSession()
          Get an instance of Session corresponding to this WcmServerCredentials instance.
static java.lang.String getSessionToken(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password)
          Static utility method that gets a credentials token based on the specified parameters.
static java.lang.String getSessionToken(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password, boolean withPrecompensation)
          Static utility method that gets a credentials token based on the specified parameters.
static java.lang.String getSessionToken(WcmDataStore ds, java.lang.String appId, java.lang.String user, java.lang.String password, java.lang.String domain)
          Deprecated.  
static java.lang.String getTokenEncryptionMode(WcmDataStore ds, java.lang.String appId)
          Return the encryption scheme being used for the specified appId.
 java.lang.String getUser()
          Returns full user name (same as UserObject.getName())
 com.filenet.api.util.UserContext getUserContext()
          Returns the userContext basic property value.
 com.filenet.api.util.UserContext getUserContext(java.lang.String configurationName)
          Get CE JavaAPI UserContext object based on the credentials in this object.
 java.lang.String getUserDisplayName()
           
 java.lang.String getUserDistinguishedName()
           
 java.lang.String getUserDomain()
          Deprecated. Use getUserRealm()
 java.util.Map getUserExtraInformation()
          getUserExtraInformation is available for backward compatibility in this release.
 java.util.Set getUserGroups()
           
 java.lang.String getUserGuid()
           
 java.lang.String getUserId()
          Return the user ID for this instance of WcmServerCredentials.
 com.filenet.wcm.api.User getUserObject()
          Returns user Object
 com.filenet.wcm.api.Realm getUserRealm()
          Returns Realm object for the current user, cached for the session.
 java.lang.String getUserShortName()
           
 java.lang.String getValidationError()
          Get information when the credentials are invalid.
 java.lang.Exception getValidationException()
          Get the validation Exception when the credentials are invalid.
 filenet.vw.api.VWSession getVWSession()
          Get VWSession from WcmServerCredential
 filenet.vw.api.VWSession getVWSession(java.lang.String routerURL)
          Get an instance of VWSession corresponding to this WcmServerCredentials instance.
 java.lang.String getVWSessionError()
          Get information when the VWSession.logon() fails.
 java.lang.Exception getVWSessionException()
          Get the VWException when the VWSession.logon() fails.
protected  void initialize(WcmDataStore ds)
          Called from all constructors to initialize storage.
 boolean isContainerJAASMode()
          Returns true when container based authentication is configured and being used.
 boolean isGuest()
          Return true if the user is a guest.
 boolean isMemberOf(java.lang.String groupName)
          Returns true if a user is a member of the group groupName
 boolean isMemberOf(java.lang.String[] groupNames)
          Returns true if a user is a member of any of the groups in the groupNames array
 boolean isUsingLDAP()
           
 boolean isValid()
          Verify that this instance of WcmServerCredentials is valid.
static void setCurrent(WcmDataStore ds, WcmServerCredentials sc)
          Set the current server credentials object in the data store.
 void setGuestUser(java.lang.String guestUserNameValue)
           
 boolean setIsGuest(boolean value)
          Mark these credentials as "guest" or not.
 boolean setIsSSOConfigured(boolean value)
          Deprecated. - Use setIsSSOServerPluginMode
 boolean setIsSSOServerPluginMode(boolean serverSSOPluginMode)
          Indicates that the credentials are dependent on a compatible CE/PE server plugin.
 void setLocale(java.util.Locale pLocale)
          Specify the locale for these credentials.
 void valueBound(WcmDataStore ds, java.lang.String key)
          Method called when an object is bound to WcmDataStore.
 void valueUnbound(WcmDataStore ds, java.lang.String key)
          Method called when an object is un-bound from WcmDataStore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classpathWillBeUsed

protected static final WcmString classpathWillBeUsed

configUnknown

protected static final WcmString configUnknown

threadMap

protected java.util.Map threadMap

USER_CREDENTIALS_KEY

public static final java.lang.String USER_CREDENTIALS_KEY
A web session's user credentials that can be retrieved easily. It also contains the user's logon session to be used to pass to the JavaAPI.

See Also:
WcmServerCredentials, Constant Field Values
Constructor Detail

WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String appId,
                            java.lang.String user,
                            java.lang.String password,
                            java.lang.String domain)
                     throws java.lang.Exception
Deprecated.  

WcmServerCredentials constructor that specifies the domain.


WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String appId,
                            java.lang.String user,
                            java.lang.String password)
                     throws java.lang.Exception
Deprecated. Use constructors with verify argument.


WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String user,
                            java.lang.String password)
                     throws java.lang.Exception
Deprecated. Use constructors with verify argument.


WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String appId,
                            java.lang.String user,
                            java.lang.String password,
                            boolean verify)
                     throws java.lang.Exception
WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.

Parameters:
ds - A reference to WcmDataStore.
appId - An application ID key.
user - The user's user ID.
password - Ths user's password.
Throws:
java.lang.Exception

WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String appId,
                            java.lang.String user,
                            java.lang.String password,
                            boolean verify,
                            boolean containerJAASMode)
                     throws java.lang.Exception
WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.

Parameters:
ds - A reference to WcmDataStore.
appId - An application ID key.
user - The user's user ID.
password - Ths user's password.
Throws:
java.lang.Exception

WcmServerCredentials

public WcmServerCredentials(WcmDataStore ds,
                            java.lang.String user,
                            java.lang.String password,
                            boolean verify)
                     throws java.lang.Exception
WcmServerCredentials constructor that does not specify the domain, and therefore uses the default domain.

This constructor reads the appId via WcmBootstrap.

Parameters:
ds - A reference to WcmDataStore.
user - The user's user ID.
password - Ths user's password.
Throws:
java.lang.Exception

WcmServerCredentials

protected WcmServerCredentials()
                        throws java.lang.Exception
Method Detail

getCurrent

public static WcmServerCredentials getCurrent(WcmDataStore ds)
Get the current server credentials object from the data store.

Parameters:
ds - The current WcmDataSore instance for this session.
Returns:
An instance of WcmServerCredentials or null.

setCurrent

public static void setCurrent(WcmDataStore ds,
                              WcmServerCredentials sc)
                       throws java.lang.Exception
Set the current server credentials object in the data store.

Parameters:
ds - The current WcmDataSore instance for this session.
sc - The new validated server credentials to save.
Throws:
java.lang.Exception

initialize

protected void initialize(WcmDataStore ds)
                   throws java.lang.Exception
Called from all constructors to initialize storage. Overrideable.

Parameters:
ds - - The current WcmDataStore object.
Throws:
java.lang.Exception

setLocale

public void setLocale(java.util.Locale pLocale)
Specify the locale for these credentials.

Parameters:
pLocale - A reference to the Locale to set.

isUsingLDAP

public boolean isUsingLDAP()

isContainerJAASMode

public boolean isContainerJAASMode()
Returns true when container based authentication is configured and being used.

Returns:

getVWSession

public filenet.vw.api.VWSession getVWSession(java.lang.String routerURL)
Get an instance of VWSession corresponding to this WcmServerCredentials instance.

If VWSession.logon failed, the return will be null, and getVWSessionException or getVWSessionError can be called to get information on the failure.

Parameters:
routerURL - The router URL to use.
Returns:
A valid VWSession object, or null.

addRouter

public void addRouter(java.lang.String routerInfo)

getVWSession

public filenet.vw.api.VWSession getVWSession()
                                      throws java.lang.Exception
Get VWSession from WcmServerCredential

Returns:
VWSession object
Throws:
java.lang.Exception - If there are problems retrieving data.

getSession

public com.filenet.wcm.api.Session getSession()
Get an instance of Session corresponding to this WcmServerCredentials instance.

null is returned if the credentials are invalid, and getValidationError or getValidationException can be called to get more information.

Returns:
A valid Session object, or null.

getUserContext

public com.filenet.api.util.UserContext getUserContext(java.lang.String configurationName)
                                                throws javax.security.auth.login.LoginException,
                                                       java.io.IOException
Get CE JavaAPI UserContext object based on the credentials in this object. The configurationName parameter is optional. If specified, it will be used to index into the Java™ Authentication and Authorization Service (JAAS) login configuration file. If null, and WEB-INF/WcmApiConfig.properties exists in the deployed web application, the JAASConfigurationName, if not null or "!" will be used. Otherwise the default JAAS configuration name, typically "other" will be used. When container managed authentication is configured and was used to authenticate the current user session, it is assumed that the CE JavaAPI and CEMP JavaAPI will "discover" the Subject associated with the current Thread context. In this case, this method will return null. In all other cases, a valid non-null UserContext object will be returned. This includes application managed authentication, and user token based authentication.

Parameters:
configurationName - - optional JAAS login configuration name.
Returns:
Valid Subject object or null, depending on configuration.
Throws:
javax.security.auth.login.LoginException
java.io.IOException

getUserContext

public com.filenet.api.util.UserContext getUserContext()
Returns the userContext basic property value. If the userContext class property has not been initialized by a prior call to getUserContext(configurationName, timeZone), this accessor will always return null.


getCEServerURI

public java.lang.String getCEServerURI()
Gets the RemoteServerUrl value from WcmApiConfig.properties that is associated with this object.

Returns:

getUserRealm

public com.filenet.wcm.api.Realm getUserRealm()
Returns Realm object for the current user, cached for the session.

Returns:
user's Realm object

getPassword

public java.lang.String getPassword()

getUserId

public java.lang.String getUserId()
Return the user ID for this instance of WcmServerCredentials.

Specified by:
getUserId in interface WcmUserInformationInterface
Returns:
A String of the user ID.

getRawUserId

public java.lang.String getRawUserId()
Get the user ID as it was originally passed into the constructor of this object. This may or may not include a Win2K or UPN domain qualifier.

Returns:
userId how it was used

getUserObject

public com.filenet.wcm.api.User getUserObject()
Returns user Object

Returns:
User Object

getUser

public java.lang.String getUser()
Returns full user name (same as UserObject.getName())

Returns:
full user name

getUserGuid

public java.lang.String getUserGuid()

getUserShortName

public java.lang.String getUserShortName()

getUserDistinguishedName

public java.lang.String getUserDistinguishedName()
                                          throws com.filenet.wcm.api.PropertyNotFoundException
Throws:
com.filenet.wcm.api.PropertyNotFoundException

getUserDisplayName

public java.lang.String getUserDisplayName()

getUserDomain

public java.lang.String getUserDomain()
Deprecated. Use getUserRealm()


getUserExtraInformation

public java.util.Map getUserExtraInformation()
getUserExtraInformation is available for backward compatibility in this release. It will return key "domain" with a domain name if it was specified in the format "user@domain" during sign-in. Otherwise, it returns an empty map.

Specified by:
getUserExtraInformation in interface WcmUserInformationInterface
Returns:

getUserGroups

public java.util.Set getUserGroups()

getSessionToken

public static java.lang.String getSessionToken(WcmDataStore ds,
                                               java.lang.String appId,
                                               java.lang.String user,
                                               java.lang.String password,
                                               java.lang.String domain)
                                        throws java.lang.Exception
Deprecated.  

Static utility method that gets a credentials token based on the specified parameters.

Throws:
java.lang.Exception

getSessionToken

public static java.lang.String getSessionToken(WcmDataStore ds,
                                               java.lang.String appId,
                                               java.lang.String user,
                                               java.lang.String password)
                                        throws java.lang.Exception
Static utility method that gets a credentials token based on the specified parameters.

Parameters:
ds - A reference to WcmDataStore.
appId - An application ID key.
user - The user's user ID.
password - Ths user's password.
Returns:
A String containing the credentials token.
Throws:
java.lang.Exception

getSessionToken

public static java.lang.String getSessionToken(WcmDataStore ds,
                                               java.lang.String appId,
                                               java.lang.String user,
                                               java.lang.String password,
                                               boolean withPrecompensation)
                                        throws java.lang.Exception
Static utility method that gets a credentials token based on the specified parameters.

Parameters:
ds - A reference to WcmDataStore.
appId - An application ID key.
user - The user's user ID.
password - Ths user's password.
withPrecompensation - When true, a time delta between CE and the web application is factored into the timestamp in the returned token.
Returns:
A String containing the credentials token.
Throws:
java.lang.Exception

getTokenEncryptionMode

public static java.lang.String getTokenEncryptionMode(WcmDataStore ds,
                                                      java.lang.String appId)
                                               throws java.lang.Exception
Return the encryption scheme being used for the specified appId. If appId is null, DEFAULT_APP_NAME is used.

Parameters:
ds -
appId -
Returns:
Throws:
java.lang.Exception

getAppId

public java.lang.String getAppId()
                          throws java.lang.Exception
Gets the appId that was set for this object.

Returns:
The appId value.
Throws:
java.lang.Exception

decodeSessionToken

public static java.util.HashMap decodeSessionToken(WcmDataStore ds,
                                                   java.lang.String token)
                                            throws java.lang.Exception
Static utility method that returns a hashmap containing credentials information found in the specified token.

Parameters:
ds - A reference to WcmDataStore.
token - A JavaAPI Session token containing encoded credentials.
Returns:
A HashMap containing credentials information keyed by Session static constant keys.
Throws:
java.lang.Exception

decodeSessionToken

public static java.util.HashMap decodeSessionToken(WcmDataStore ds,
                                                   java.lang.String decodeAppId,
                                                   java.lang.String token,
                                                   long timeout)
                                            throws java.lang.Exception
Static utility method that returns a hashmap containing credentials information found in the specified token.

Parameters:
ds - A reference to WcmDataStore.
token - A JavaAPI Session token containing encoded credentials.
Returns:
A HashMap containing credentials information keyed by Session static constant keys.
Throws:
java.lang.Exception

isValid

public boolean isValid()
Verify that this instance of WcmServerCredentials is valid.

Returns:
true or false

getValidationError

public java.lang.String getValidationError()
Get information when the credentials are invalid.

Returns:
A string describing the credentials validation error. Returns null if the credentials are valid.

getValidationException

public java.lang.Exception getValidationException()
Get the validation Exception when the credentials are invalid.

Returns:
A string describing the credentials validation exception. Returns null if the credentials are valid.

getVWSessionError

public java.lang.String getVWSessionError()
Get information when the VWSession.logon() fails.

Returns:
A string describing the VWSession.logon() error. Returns null if the VWSession.logon() succeeded.

getVWSessionException

public java.lang.Exception getVWSessionException()
Get the VWException when the VWSession.logon() fails.

Returns:
A reference to the VWException describing the VWSession.logon() exception. Returns null if the VWSession.logon() succeeded.

getGroups

protected java.util.Set getGroups()
Returns the Java API groups object when WcmServerCredentials is valid. Overrideable.

Returns:
The Groups object containing all the known groups.

isMemberOf

public boolean isMemberOf(java.lang.String groupName)
Returns true if a user is a member of the group groupName

Specified by:
isMemberOf in interface WcmUserInformationInterface
Parameters:
groupName -
Returns:
true or false

isMemberOf

public boolean isMemberOf(java.lang.String[] groupNames)
Returns true if a user is a member of any of the groups in the groupNames array

Specified by:
isMemberOf in interface WcmUserInformationInterface
Parameters:
groupNames -
Returns:
true or false

setIsGuest

public boolean setIsGuest(boolean value)
Mark these credentials as "guest" or not.

Parameters:
value -
Returns:
The previous value.

setIsSSOServerPluginMode

public boolean setIsSSOServerPluginMode(boolean serverSSOPluginMode)
Indicates that the credentials are dependent on a compatible CE/PE server plugin.

Parameters:
serverSSOPluginMode -
Returns:

setIsSSOConfigured

public boolean setIsSSOConfigured(boolean value)
Deprecated. - Use setIsSSOServerPluginMode


isGuest

public boolean isGuest()
Return true if the user is a guest.

Specified by:
isGuest in interface WcmUserInformationInterface
Returns:
true or false

setGuestUser

public void setGuestUser(java.lang.String guestUserNameValue)

valueBound

public void valueBound(WcmDataStore ds,
                       java.lang.String key)
Description copied from interface: WcmDataStoreBindingListener
Method called when an object is bound to WcmDataStore.

Specified by:
valueBound in interface WcmDataStoreBindingListener
Parameters:
ds - A reference to the datastore that the key is being added to.
key - The key being bound.

valueUnbound

public void valueUnbound(WcmDataStore ds,
                         java.lang.String key)
Description copied from interface: WcmDataStoreBindingListener
Method called when an object is un-bound from WcmDataStore.

Specified by:
valueUnbound in interface WcmDataStoreBindingListener
Parameters:
ds - A reference to the datastore that the key is being removed from.
key - The key being unbound.


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.