public class ProfileTools extends GenericService
The class atg.userprofiling.Profile
, used in many methods as a parameter,
is the class which represents the instance of the session-scoped Profile object,
located at the Nucleus path /atg/userprofiling/Profile
. The methods
which contain this parameter signature should only be used when it is required to
manipulate the session-scoped Profile object. Typically one will have a property reference
to the object or resolve the object through the request. Developers should not needlessly
construct new Profile instances (i.e. Profile p = new Profile()
) and pass
it as a parameter. Remember this object is only a placeholder to put in the component
tree. The _real_ profile is an atg.repository.RepositoryItem
instance, which
is wrapped through the dataSource
property of the atg.userprofiling.Profile
class.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
DPS_VERSION
Full Product Version Identifier
|
static java.lang.String |
DPS_VERSION_NUM
Version number for this product
|
protected atg.userprofiling.PasswordGenerator |
mPasswordGenerator |
protected atg.security.PasswordRuleChecker |
mPasswordRuleChecker |
protected atg.security.PreviousNPasswordManager |
mPreviousNPasswordManager |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
ProfileTools()
Constructs an instanceof ProfileTools
|
Modifier and Type | Method and Description |
---|---|
void |
addMultiPropertyValues(java.lang.String pPropertyName,
RepositoryItem pSourceItem,
RepositoryItem pTargetItem)
Adds a specific multi-valued property's values from the given source
user to the given target user
|
boolean |
assumeSecurityIdentity(Profile pProfile)
Takes the given profile and makes the current Thread's User have
the persona of this profile.
|
boolean |
assumeSecurityIdentity(Profile pProfile,
IdentityManager pIdentityManager)
Takes the given profile and IdentityManager and makes the current
Thread's User have the persona of this profile.
|
java.util.Collection |
buildPropertyUpdatesForDictionary(RepositoryItem pItem,
java.util.Dictionary pValues)
Builds a collection of PropertyUpdate objects that reflect the updates in the value
dictionary.
|
protected java.util.Collection |
buildPropertyUpdatesForRepositoryFormList(RepositoryItem pItemWithMultiValuedProperty,
RepositoryFormList pRepositoryFormList)
Builds a collection of PropertyUpdate objects for the updates in the RepositoryFormList.
|
protected java.util.Collection |
buildPropertyUpdatesForRepositoryFormMap(RepositoryItem pItem,
RepositoryFormMap pRepositoryFormMap)
Builds a collection of PropertyUpdate objects for the updates in the RepositoryFormMap.
|
void |
buildUpdateMessage(RepositoryItem repItem,
java.util.Dictionary newValues,
java.util.Vector propertyUpdatesVector,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Operation called to set up the event data to be fired in the postUpdateUser method.
|
void |
buildUpdateMessage(RepositoryItem repItem,
RepositoryItemDescriptor pItemDescriptor,
java.util.Dictionary newValues,
java.util.Vector propertyUpdatesVector,
java.lang.String pPropertyPath,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Operation called to set up the event data to be fired in the postUpdateUser method.
|
java.util.Dictionary |
calculateNewPropertiesForBatchUpdate(java.lang.String pLogin,
java.lang.String pSalt,
java.lang.String pPassword,
java.lang.String pUserPasswordHasherComponentsString) |
void |
changePassword(RepositoryItem pProfile,
java.lang.String pNewPassword,
java.lang.String pConfirmNewPassword,
java.lang.String pConfirmOldPassword,
boolean pMustConfirmNewPassword,
boolean pMustConfirmOldPassword)
Changes the password for the profile, if certain criteria are met:
If requiring a confirmation password, then pNewPassword and pConfirmPassword must match.
|
void |
changePassword(RepositoryItem pProfile,
java.lang.String pLogin,
java.lang.String pNewPassword,
java.lang.String pConfirmNewPassword,
java.lang.String pConfirmOldPassword,
boolean pMustConfirmNewPassword,
boolean pMustConfirmOldPassword)
version fo changePassword that accepts a login param for salting the
password in the case where the passed in profile item may not have
a login property value set
|
java.lang.String |
convertNewValueToString(atg.userprofiling.PropertyUpdate pPropertyUpdate)
Converts the PropertyUpdate's new value to
a String representation.
|
java.lang.String |
convertOldValueToString(atg.userprofiling.PropertyUpdate pPropertyUpdate)
Converts the PropertyUpdate's old value to
a String representation.
|
java.lang.String |
convertPropertyUpdateValueToString(java.lang.Object pValue)
Converts the given PropertyUpdate value to
a String representation.
|
boolean |
createNewUser(java.lang.String pUserType,
Profile pProfile)
Creates a new user and loads it into the session-scoped Profile object.
|
boolean |
createNewUser(java.lang.String pProfileId,
java.lang.String pUserType,
Profile pProfile)
Creates a new user and loads it into the Profile object.
|
protected atg.userprofiling.PropertyUpdate |
createPropertyUpdate(int pUpdateType,
java.lang.String pPropertyName,
java.lang.String pOldValue,
java.lang.String pNewValue)
Creates a property update object using the values provided.
|
void |
doStartService()
Called after the service has been created, placed into the
naming hierarchy, and initialized with its configured property
values.
|
java.lang.String |
formatMultiValueUpdateString(java.lang.String pPropertyName,
java.lang.String pKey,
java.lang.Object pReferencedObject)
Creates a formatted string that denotes an item within a multi-valued property(collection, map or object []).
|
protected Query |
generateEmailQuery(java.lang.String pEmail,
QueryBuilder pQueryBuilder)
Deprecated.
As of DPS 5.5, this method has been moved to
RepositoryProfileItemFinder . If you call this
method, you should change your code to instead call
getProfileItemFinder().generateEmailQuery . If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder component's method. |
protected Query |
generateLoginQuery(java.lang.String pLogin,
java.lang.String pPassword,
QueryBuilder pQueryBuilder)
Deprecated.
As of DPS 5.5, this method has been moved to
RepositoryProfileItemFinder . If you call this
method, you should change your code to instead call
getProfileItemFinder().generateLoginQuery . If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder component's method. |
protected Query |
generateNameQuery(java.lang.String pFirstName,
java.lang.String pLastName,
QueryBuilder pQueryBuilder)
Deprecated.
As of DPS 5.5, this method has been moved to
RepositoryProfileItemFinder . If you call this
method, you should change your code to instead call
getProfileItemFinder().generateNameQuery . If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder component's method. |
java.lang.String |
generateNewPasswordForProfile(RepositoryItem pProfile)
Creates a randomly generated password for the profile.
|
java.lang.Boolean |
getAutoLogin(Profile pProfile)
Gets the auto-login property of the given profile.
|
CookieManager |
getCookieManager()
Returns property CookieManager
|
java.lang.String |
getDefaultProfileType()
Returns property DefaultProfileType
|
atg.repository.nucleus.RepositoryGroupContainer |
getGroupContainer()
Returns property GroupContainer
|
atg.core.util.StringMatcher |
getIllegalPasswordChecker()
Returns current value of the illegal string checker
|
RepositoryItem |
getItem(java.lang.String pLogin,
java.lang.String pPassword)
Returns a RepositoryItem which represents a profile.
|
RepositoryItem |
getItem(java.lang.String pLogin,
java.lang.String pPassword,
java.lang.String pProfileType)
Returns a RepositoryItem which represents a profile.
|
RepositoryItem |
getItemFromEmail(java.lang.String pEmail)
Returns a RepositoryItem which represents a profile.
|
RepositoryItem |
getItemFromEmail(java.lang.String pEmail,
java.lang.String pProfileType)
Returns a RepositoryItem which represents a profile.
|
RepositoryItem[] |
getItems(java.lang.String pFirstName,
java.lang.String pLastName)
Returns an list of RepositoryItems which represents profiles found
for the first and last names entered.
|
RepositoryItem[] |
getItems(java.lang.String pFirstName,
java.lang.String pLastName,
java.lang.String pProfileType)
Returns an list of RepositoryItems which represents profiles found
for the first and last names entered.
|
RepositoryItem[] |
getItemsFromEmail(java.lang.String pEmail)
Returns a RepositoryItem which represents a profile.
|
RepositoryItem[] |
getItemsFromEmail(java.lang.String pEmail,
java.lang.String pProfileType)
Returns a RepositoryItem which represents a profile.
|
java.lang.String |
getLoggingIdentifier() |
java.lang.String |
getLogin(RepositoryItem pProfile)
Gets the login of the given profile.
|
atg.userdirectory.UserDirectoryLoginUserAuthority |
getLoginUserAuthority()
Returns property UserAuthority
|
MutableRepositoryItem |
getMutableItem(RepositoryItem pItem)
Gets the mutable form of the given repository item, assuming
that there is one.
|
java.lang.String |
getPassword(RepositoryItem pProfile)
Gets the password of the given profile.
|
int |
getPasswordGenerationTriesLimit()
Returns count of tries of password generation.
|
atg.userprofiling.PasswordGenerator |
getPasswordGenerator() |
PasswordHasher |
getPasswordHasherForUserItem(RepositoryItem pUserItem)
This method return the password hasher for a given user repository Item.
|
atg.security.PasswordRuleChecker |
getPasswordRuleChecker() |
atg.security.PreviousNPasswordManager |
getPreviousNPasswordManager() |
ProfileEventTrigger |
getProfileEventTrigger()
Returns property ProfileEventTrigger
|
RepositoryProfileItemFinder |
getProfileItemFinder()
Returns property PropertyManager
|
ProfileRealmManager |
getProfileRealmManager()
get ProfileRealmManager
|
MutableRepository |
getProfileRepository()
Returns property ProfileRepository
|
PropertyManager |
getPropertyManager()
Returns property PropertyManager
|
java.lang.Integer |
getSecurityStatus(Profile pProfile)
Gets the security status of the given profile, if there is
such a property
|
UserLoginManager |
getUserLoginManager()
Returns the value of the property LoginUserAuthority.
|
boolean |
isAutoLoginSecurityStatus(int pSecurityStatus)
Returns true if the given security status indicates an auto login
|
boolean |
isEnableSecurityStatus() |
boolean |
isValidCredentials(java.lang.String pLogin)
Determines if the given login represents
a valid credential for a user, according to a configured
IdentityManager.
|
boolean |
isValidCredentials(java.lang.String pLogin,
IdentityManager pIdentityManager)
Determines if the given login represents
a valid credential for a user.
|
boolean |
isValidCredentials(java.lang.String pLogin,
java.lang.String pCleartextPassword)
Determines if the given login and cleartext password represent
a valid pair of credentials for a user, according to a configured
IdentityManager.
|
boolean |
isValidCredentials(java.lang.String pLogin,
java.lang.String pCleartextPassword,
IdentityManager pIdentityManager)
Determines if the given login and cleartext password represent
a valid pair of credentials for a user.
|
boolean |
isValidCredentialsEncrypted(java.lang.String pLogin,
java.lang.String pEncryptedPassword,
java.lang.String pHashKey)
This method validates the given credentials, assuming that the
given password has been encrypted according to the profile password
hasher algorithm, and further encrypted using the given pHashKey.
|
boolean |
locateUserFromEmail(java.lang.String pEmail,
Profile pProfile)
A query is built to look for users with the given email.
|
boolean |
locateUserFromEmail(java.lang.String pEmail,
Profile pProfile,
java.lang.String pProfileType)
A query is built to look for users with the given email.
|
boolean |
locateUserFromId(java.lang.String pId,
Profile pProfile)
A profile is attempted to be loaded by their user id.
|
boolean |
locateUserFromId(java.lang.String pId,
Profile pProfile,
java.lang.String pProfileType)
A profile is attempted to be loaded by their user id.
|
boolean |
locateUserFromLogin(java.lang.String pLogin,
Profile pProfile)
A query is built to look for users with the given login.
|
boolean |
locateUserFromLogin(java.lang.String pLogin,
Profile pProfile,
java.lang.String pProfileType)
A query is built to look for users with the given login.
|
boolean |
locateUserFromLogin(java.lang.String pLogin,
java.lang.String pPassword,
Profile pProfile)
A query is built to look for users with the given login and password.
|
boolean |
locateUserFromLogin(java.lang.String pLogin,
java.lang.String pPassword,
Profile pProfile,
java.lang.String pProfileType)
A query is built to look for users with the given login and password.
|
static void |
main(java.lang.String[] pArgs)
Print out the version of DPS
|
java.lang.String |
passwordHashersForLogin(java.lang.String pLogin)
get the password hasher components path for a corresponding login.Multiple
password hashers may be available if there are multiple password
upgrdations after user last login.
|
java.lang.String |
passwordSaltForLogin(java.lang.String pLogin)
get the password salt for a corresponding login.
|
void |
prefixPropertyNames(java.util.Collection pPropertyUpdates,
java.lang.String pPropertyNamePrefix)
Iterates through the property updates and modifies the propertyName property to be prefixed by
the pPropertyNamePrefix.
|
void |
propagateLocale(Profile pProfile,
atg.servlet.RequestLocale pRequestLocale,
DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Tests to see if the locale of the profile and the locale of the
current request are different, and if so, whether or not the
caller should change the locale to that of the profile's
|
boolean |
revokeSecurityIdentity()
Revokes the identity(ies) of the current user.
|
boolean |
revokeSecurityIdentity(IdentityManager pIdentityManager)
Takes the given IdentityManager and revokes the managed
User's persona(s) i.e.
|
void |
sendEmailToUser(MutableRepositoryItem pProfile,
boolean pRunInSeparateThread,
boolean pPersist,
TemplateEmailSender pTemplateEmailSender,
TemplateEmailInfo pTemplateEmailInfo,
java.util.Map pTemplateParameters)
Sends email to the user using the provided email template and parameters.
|
void |
setAutoLoginSecurityStatus(Profile pProfile,
ProfileRequest pProfileRequest)
Sets the security status property of the profile.
|
void |
setCookieManager(CookieManager pCookieManager)
Sets property CookieManager
|
void |
setDefaultProfileType(java.lang.String pDefaultProfileType)
Sets property DefaultProfileType
|
void |
setEnableSecurityStatus(boolean pEnableSecurityStatus) |
void |
setGroupContainer(atg.repository.nucleus.RepositoryGroupContainer pGroupContainer)
Sets property GroupContainer
|
void |
setIllegalPasswordChecker(atg.core.util.StringMatcher pIllegalPasswordChecker)
Sets new value of the illegal string checker
|
void |
setLoginSecurityStatus(Profile pProfile,
DynamoHttpServletRequest pRequest)
Sets the security status property of the profile.
|
void |
setLoginUserAuthority(atg.userdirectory.UserDirectoryLoginUserAuthority pUserAuthority)
Sets property UserAuthority
|
void |
setPasswordGenerationTriesLimit(int pPasswordGenerationTriesLimit)
Sets new value of count of tries in password generation
|
void |
setPasswordGenerator(atg.userprofiling.PasswordGenerator pPasswordGenerator)
Sets the property PasswordGenerator
|
void |
setPasswordRuleChecker(atg.security.PasswordRuleChecker pPasswordRuleChecker)
Sets the property PasswordRuleChecker
|
void |
setPreviousNPasswordManager(atg.security.PreviousNPasswordManager pPreviousNPasswordManager)
Sets the property PreviousNPasswordManager
|
void |
setProfileEventTrigger(ProfileEventTrigger pProfileEventTrigger)
Sets property ProfileEventTrigger
|
void |
setProfileItemFinder(RepositoryProfileItemFinder pProfileItemFinder)
Sets property ProfileItemFinder
|
void |
setProfileRealmManager(ProfileRealmManager pProfileRealmManager)
set ProfileRealmManager
|
void |
setProfileRepository(MutableRepository pProfileRepository)
Sets property ProfileRepository
|
void |
setPropertyManager(PropertyManager pPropertyManager)
Sets property PropertyManager
|
void |
setSecurityStatus(Profile pProfile,
int pValue)
Sets the security status property of the profile.
|
void |
setUserLoginManager(UserLoginManager pUserLoginManager)
Sets the property LoginUserAuthority.
|
boolean |
shouldSendProfileCookies(Profile pProfile)
Determines if profile cookies should be sent to the given profile's
web client
|
java.lang.String |
toString() |
void |
updatePasswordHasherComponent(RepositoryItem user,
java.lang.String pLogin)
This method checks if the password hasher value associated with item is
null or not.If it is null it updates with latest password hasher component
path.
|
void |
updateProperties(java.util.Dictionary pPropertyTable,
RepositoryItem pItem)
Attempts to update the profile with the given set of changed property values.
|
void |
updateProperty(java.lang.String pPropertyName,
java.lang.Object pPropertyValue,
RepositoryItem pItem)
Attempts to update the named property for the profile.
|
boolean |
upgradePassword(RepositoryItem user,
java.lang.String pLogin,
java.lang.String pPassword)
After successful user authentication it checks whether the password hasher
associated with the user profile is same as the password hasher in the
PropertyManager.passwordHahser property.
|
boolean |
upgradePasswordUsingBatch(RepositoryItem user,
java.lang.String pLogin,
java.lang.String pSalt,
java.lang.String pPassword)
Rehashes specified user's hashed password using password hasher in
PropertyManager.passwordHahser property.It also stores the new salt along
with old slat to the data base using "-" separator.
|
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static java.lang.String CLASS_VERSION
public static final java.lang.String DPS_VERSION_NUM
public static final java.lang.String DPS_VERSION
protected atg.userprofiling.PasswordGenerator mPasswordGenerator
protected atg.security.PreviousNPasswordManager mPreviousNPasswordManager
protected atg.security.PasswordRuleChecker mPasswordRuleChecker
public void setPasswordGenerator(atg.userprofiling.PasswordGenerator pPasswordGenerator)
public atg.userprofiling.PasswordGenerator getPasswordGenerator()
public void setProfileRepository(MutableRepository pProfileRepository)
public MutableRepository getProfileRepository()
public void setDefaultProfileType(java.lang.String pDefaultProfileType)
public java.lang.String getDefaultProfileType()
public void setCookieManager(CookieManager pCookieManager)
public CookieManager getCookieManager()
public void setPropertyManager(PropertyManager pPropertyManager)
public PropertyManager getPropertyManager()
public void setProfileItemFinder(RepositoryProfileItemFinder pProfileItemFinder)
public RepositoryProfileItemFinder getProfileItemFinder()
public void setProfileEventTrigger(ProfileEventTrigger pProfileEventTrigger)
public ProfileEventTrigger getProfileEventTrigger()
public void setGroupContainer(atg.repository.nucleus.RepositoryGroupContainer pGroupContainer)
public atg.repository.nucleus.RepositoryGroupContainer getGroupContainer()
public void setLoginUserAuthority(atg.userdirectory.UserDirectoryLoginUserAuthority pUserAuthority)
public atg.userdirectory.UserDirectoryLoginUserAuthority getLoginUserAuthority()
public void setUserLoginManager(UserLoginManager pUserLoginManager)
public UserLoginManager getUserLoginManager()
public void setPreviousNPasswordManager(atg.security.PreviousNPasswordManager pPreviousNPasswordManager)
public atg.security.PreviousNPasswordManager getPreviousNPasswordManager()
public void setPasswordRuleChecker(atg.security.PasswordRuleChecker pPasswordRuleChecker)
public atg.security.PasswordRuleChecker getPasswordRuleChecker()
public atg.core.util.StringMatcher getIllegalPasswordChecker()
public void setIllegalPasswordChecker(atg.core.util.StringMatcher pIllegalPasswordChecker)
pIllegalPasswordChecker
- new value of the illegal string checkerpublic int getPasswordGenerationTriesLimit()
public void setPasswordGenerationTriesLimit(int pPasswordGenerationTriesLimit)
pPasswordGenerationTriesLimit
- new value of count of tries in password
generationpublic void setProfileRealmManager(ProfileRealmManager pProfileRealmManager)
pProfileRealmManager
- the ProfileRealmManagerpublic ProfileRealmManager getProfileRealmManager()
public void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- if the service had a problem
starting uppublic boolean createNewUser(java.lang.String pUserType, Profile pProfile)
MutableRepository.createItem
method
and sets the Profile.dataSource
property to the newly
constructed RepositoryItem
.
/atg/userprofiling/Profile
.pUserType
- the type of profile to construct, which maps to an ItemDescriptor typepProfile
- the session-scoped Profile instancepublic boolean createNewUser(java.lang.String pProfileId, java.lang.String pUserType, Profile pProfile)
MutableRepository.createItem
method
and sets the Profile.dataSource
property to the newly
constructed RepositoryItem
.pProfileId
- The id of the profile to create. It's the caller's responsibility
to ensure this is a valid profile id.pUserType
- the type of profile to construct, which maps to an ItemDescriptor typepProfile
- the Profile instance to load the new created user item.public boolean locateUserFromLogin(java.lang.String pLogin, java.lang.String pPassword, Profile pProfile)
dataSource
property of the
session-scoped Profile is updated to point to the found user.
/atg/userprofiling/Profile
.pLogin
- the login name of the user to findpPassword
- the matching password of the user to loadpProfile
- the session-scoped Profile instancepublic boolean locateUserFromLogin(java.lang.String pLogin, java.lang.String pPassword, Profile pProfile, java.lang.String pProfileType)
dataSource
property of the
session-scoped Profile is updated to point to the found user.
/atg/userprofiling/Profile
.pLogin
- the login name of the user to findpPassword
- the matching password of the user to loadpProfile
- the session-scoped Profile instancepProfileType
- the name of item descriptor to use to look for the profilepublic boolean locateUserFromLogin(java.lang.String pLogin, Profile pProfile)
dataSource
property of the session-scoped Profile is
updated to point to the found user.
/atg/userprofiling/Profile
.pLogin
- the login name of the user to findpProfile
- the session-scoped Profile instancepublic boolean locateUserFromLogin(java.lang.String pLogin, Profile pProfile, java.lang.String pProfileType)
dataSource
property of the session-scoped Profile is
updated to point to the found user.
/atg/userprofiling/Profile
.pLogin
- the login name of the user to findpProfile
- the session-scoped Profile instancepProfileType
- the name of item descriptor to use to look for the profilepublic boolean locateUserFromId(java.lang.String pId, Profile pProfile)
dataSource
property of the session-scoped Profile is
updated to point to the found user.
/atg/userprofiling/Profile
.pId
- the user id of the profile to loadpProfile
- the session-scoped Profile instancepublic boolean locateUserFromId(java.lang.String pId, Profile pProfile, java.lang.String pProfileType)
dataSource
property of the session-scoped Profile is
updated to point to the found user.
/atg/userprofiling/Profile
.pId
- the user id of the profile to loadpProfile
- the session-scoped Profile instancepProfileType
- the name of item descriptor to use to look for the profilepublic boolean locateUserFromEmail(java.lang.String pEmail, Profile pProfile)
dataSource
property of the session-scoped Profile is
updated to point to the found user. Note that if multiple users exist with
the same email address, only one of them will be found.
/atg/userprofiling/Profile
.pEmail
- the email address of the user to findpProfile
- the session-scoped Profile instancepublic boolean locateUserFromEmail(java.lang.String pEmail, Profile pProfile, java.lang.String pProfileType)
dataSource
property of the session-scoped Profile is
updated to point to the found user. Note that if multiple users exist with
the same email address, only one of them will be found.
/atg/userprofiling/Profile
.pEmail
- the email address of the user to findpProfile
- the session-scoped Profile instancepProfileType
- the name of item descriptor to use to look for the profilepublic void updateProperty(java.lang.String pPropertyName, java.lang.Object pPropertyValue, RepositoryItem pItem) throws RepositoryException
pPropertyName
- the name of the propertypPropertyValue
- the value of the property to changepItem
- the profile to updateRepositoryException
- if there was a problem updating the profilepublic void updateProperties(java.util.Dictionary pPropertyTable, RepositoryItem pItem) throws RepositoryException
pPropertyTable
- a dictionary of property names and new property valuespItem
- the profile to updateRepositoryException
- if there was a problem updating the profilepublic RepositoryItem getItem(java.lang.String pLogin, java.lang.String pPassword)
dataSource
property. A query is built using the supplied login to find the data source. If
the pPassword parameter is not null then an extra constraint is added
to the query operation to make sure the correct password is given.pLogin
- what the user claims is their loginpPassword
- the user's passwordprotected Query generateLoginQuery(java.lang.String pLogin, java.lang.String pPassword, QueryBuilder pQueryBuilder) throws RepositoryException
RepositoryProfileItemFinder
. If you call this
method, you should change your code to instead call
getProfileItemFinder().generateLoginQuery
. If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder
component's method.(login == pLogin) AND (password == pPassword)
.
If the password is null then just (login == pLogin)
is returned.RepositoryException
RepositoryProfileItemFinder.generateLoginQuery
public RepositoryItem getItem(java.lang.String pLogin, java.lang.String pPassword, java.lang.String pProfileType)
dataSource
property. A query is built using the supplied login to find the data source. If
the pPassword parameter is not null then an extra constraint is added
to the query operation to make sure the correct password is given.pLogin
- what the user claims is their loginpPassword
- the user's passwordpProfileType
- the name of item descriptor to use to look for the profilepublic RepositoryItem[] getItems(java.lang.String pFirstName, java.lang.String pLastName)
pFirstName
- the first name to query onpLastName
- the last name to query onpublic RepositoryItem[] getItems(java.lang.String pFirstName, java.lang.String pLastName, java.lang.String pProfileType)
pFirstName
- the first name to query onpLastName
- the last name to query onprotected Query generateNameQuery(java.lang.String pFirstName, java.lang.String pLastName, QueryBuilder pQueryBuilder) throws RepositoryException
RepositoryProfileItemFinder
. If you call this
method, you should change your code to instead call
getProfileItemFinder().generateNameQuery
. If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder
component's method.(firstName ==
pFirstName) AND (lastName == pLastName)
.
If the firstName is null then just (lastName == pLLastName)
is returned.RepositoryException
RepositoryProfileItemFinder.generateNameQuery
public RepositoryItem getItemFromEmail(java.lang.String pEmail)
dataSource
property. A query is built using the supplied email to find the data source.
Note that if multiple users exist with the same email address, only one of
them will be returned.pEmail
- the email address of the user to findpublic RepositoryItem getItemFromEmail(java.lang.String pEmail, java.lang.String pProfileType)
dataSource
property. A query is built using the supplied email to find the data source.
Note that if multiple users exist with the same email address, only one of
them will be returned.pEmail
- the email address of the user to findpProfileType
- the name of item descriptor to use to look for the profilepublic RepositoryItem[] getItemsFromEmail(java.lang.String pEmail)
dataSource
property. A query is built using the supplied email to find the data source.
Note that if multiple users exist with the same email address, only one of
them will be returned.pEmail
- the email address of the user to findpublic RepositoryItem[] getItemsFromEmail(java.lang.String pEmail, java.lang.String pProfileType)
dataSource
property. A query is built using the supplied email to find the data source.
Note that if multiple users exist with the same email address, only one of
them will be returned.pEmail
- the email address of the user to findpProfileType
- the name of item descriptor to use to look for the profileprotected Query generateEmailQuery(java.lang.String pEmail, QueryBuilder pQueryBuilder) throws RepositoryException
RepositoryProfileItemFinder
. If you call this
method, you should change your code to instead call
getProfileItemFinder().generateEmailQuery
. If you
override this method in this class, you should instead override
the RepositoryProfileItemFinder
component's method.RepositoryException
RepositoryProfileItemFinder.generateEmailQuery
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getLoggingIdentifier()
public static void main(java.lang.String[] pArgs)
public void setEnableSecurityStatus(boolean pEnableSecurityStatus)
public boolean isEnableSecurityStatus()
public void setLoginSecurityStatus(Profile pProfile, DynamoHttpServletRequest pRequest) throws RepositoryException
pProfile
- the profile to updatepRequest
- the request.RepositoryException
public void setAutoLoginSecurityStatus(Profile pProfile, ProfileRequest pProfileRequest) throws RepositoryException
pProfile
- the profile to updatepProfileRequest
- used only when pExplicit is false. we use it to get the request sourceRepositoryException
public boolean isAutoLoginSecurityStatus(int pSecurityStatus)
pSecurityStatus
- the security status to examinepSecurityStatus
indicates an auto login,
false otherwisepublic void setSecurityStatus(Profile pProfile, int pValue) throws RepositoryException
pProfile
- the profile to updatepValue
- what to set the property value to.RepositoryException
public void buildUpdateMessage(RepositoryItem repItem, java.util.Dictionary newValues, java.util.Vector propertyUpdatesVector, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RepositoryException
repItem
- the item as it is in the repository before the updatenewValues
- the dictionary containing the updated profile propertiespropertyUpdatesVector
- a place to hold the updated properties as we recursepRequest
- the servlet's requestpResponse
- the servlet's responseRepositoryException
public void buildUpdateMessage(RepositoryItem repItem, RepositoryItemDescriptor pItemDescriptor, java.util.Dictionary newValues, java.util.Vector propertyUpdatesVector, java.lang.String pPropertyPath, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws RepositoryException
repItem
- the item as it is in the repository before the updatenewValues
- the dictionary containing the updated profile propertiespropertyUpdatesVector
- a place to hold the updated properties as we recursepRequest
- the servlet's requestpResponse
- the servlet's responseRepositoryException
public boolean assumeSecurityIdentity(Profile pProfile)
pProfile
- the profile of the persona the current user is to
be associated withpProfile
, false otherwisepublic boolean assumeSecurityIdentity(Profile pProfile, IdentityManager pIdentityManager)
pProfile
- the profile of the persona the current user is to
be associated withpIdentityManager
- the service that holds references to the
current user and the user authority needed to make the persona
associationpProfile
, false otherwisepublic boolean revokeSecurityIdentity()
userLoginManager
property of this componentpublic boolean revokeSecurityIdentity(IdentityManager pIdentityManager)
pIdentityManager
- the service that holds references to the
current user and the user authority needed to revoke all associated
personaspublic boolean shouldSendProfileCookies(Profile pProfile)
pProfile
- the profile of the user to send the cookies topRequest
- the current requestpResponse
- the current responsecookieManager
is not null, is
configured to send cookies, and pProfile
does
not have an autoLogin property or the autoLogin property is set
to true.public boolean isValidCredentials(java.lang.String pLogin)
pLogin
- the login of the person to validatepublic boolean isValidCredentials(java.lang.String pLogin, java.lang.String pCleartextPassword)
pLogin
- the login of the person to validatepCleartextPassword
- the unencrypted password of the person
to validatepublic boolean isValidCredentials(java.lang.String pLogin, IdentityManager pIdentityManager)
pLogin
- the login of the person to validatepIdentityManager
- the identity manager used to validate
the given credentialspublic boolean isValidCredentials(java.lang.String pLogin, java.lang.String pCleartextPassword, IdentityManager pIdentityManager)
pLogin
- the login of the person to validatepCleartextPassword
- the unencrypted password of the person
to validatepIdentityManager
- the identity manager used to validate
the given credentialspublic boolean isValidCredentialsEncrypted(java.lang.String pLogin, java.lang.String pEncryptedPassword, java.lang.String pHashKey)
pLogin
- the login to validatepEncryptedPassword
- a password encrypted using the algorithm
configured by the propertyManager.passwordHasher
property,
and further encrypted with the given pHashKey
pHashKey
- the hashkey used to further encrypt a password hashed
according to the algorithm configured by
propertyManager.passwordHasher
public java.lang.Integer getSecurityStatus(Profile pProfile) throws PropertyNotFoundException
pProfile
- the profile to get the security status ofPropertyNotFoundException
public java.lang.String getLogin(RepositoryItem pProfile) throws PropertyNotFoundException
propertyManager.loginPropertyName
pProfile
- the profile to get the login ofPropertyNotFoundException
public java.lang.String getPassword(RepositoryItem pProfile) throws PropertyNotFoundException
propertyManager.passwordPropertyName
pProfile
- the profile to get the login ofPropertyNotFoundException
public java.lang.Boolean getAutoLogin(Profile pProfile) throws PropertyNotFoundException
propertyManager.autoLoginPropertyName
. This property
must be specified as a boolean in the profile repositorypProfile
- the profile to get the auto-login ofpProfile
's auto-login property.
This property must be defined as a Boolean in your profile repository.
If your repository does not define it as such, do not use this method.PropertyNotFoundException
public void propagateLocale(Profile pProfile, atg.servlet.RequestLocale pRequestLocale, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
pProfile
- the profile whose locale will be usedpRequestLocale
- the request locale that could be altered
according to the profile's locale propertypRequest
- the current requestpResponse
- the current responsepublic MutableRepositoryItem getMutableItem(RepositoryItem pItem) throws RepositoryException
pItem
- the item to return in mutable formpItem
in mutable formRepositoryException
- if an error occurs trying to get
the item for updatepublic void addMultiPropertyValues(java.lang.String pPropertyName, RepositoryItem pSourceItem, RepositoryItem pTargetItem) throws PropertyNotFoundException
pPropertyName
- the name of a multi-valued property whose values
will be copied from the source user and added to the target userpSourceItem
- the user to copy values frompTargetItem
- the user to copy values toPropertyNotFoundException
public java.util.Collection buildPropertyUpdatesForDictionary(RepositoryItem pItem, java.util.Dictionary pValues)
pItem
- the item for which the changes in the dictionary applypValues
- the value dictionary.protected java.util.Collection buildPropertyUpdatesForRepositoryFormMap(RepositoryItem pItem, RepositoryFormMap pRepositoryFormMap)
pItem
- the item for which the changes in the map applypRepositoryFormMap
- the RepositoryFormMap.protected java.util.Collection buildPropertyUpdatesForRepositoryFormList(RepositoryItem pItemWithMultiValuedProperty, RepositoryFormList pRepositoryFormList)
Note that ReposioryFormList is used for Sets, Lists and Object[]
pItemWithMultiValuedProperty
- the item for which has the multi-valued property that is being updated.pRepositoryFormList
- the RepositoryFormList.public java.lang.String formatMultiValueUpdateString(java.lang.String pPropertyName, java.lang.String pKey, java.lang.Object pReferencedObject)
pPropertyName
- the property name where the object was containedpKey
- the map key. This is only used for maps.pReferencedObject
- the object referenced by the propertyprotected atg.userprofiling.PropertyUpdate createPropertyUpdate(int pUpdateType, java.lang.String pPropertyName, java.lang.String pOldValue, java.lang.String pNewValue)
pUpdateType
- the type of updatepPropertyName
- the property name affected by the udpatepOldValue
- the old value of the propertypNewValue
- the new value of the propertypublic java.lang.String convertNewValueToString(atg.userprofiling.PropertyUpdate pPropertyUpdate)
convertPropertyUpdateValueToString(Object)
public java.lang.String convertOldValueToString(atg.userprofiling.PropertyUpdate pPropertyUpdate)
convertPropertyUpdateValueToString(Object)
public java.lang.String convertPropertyUpdateValueToString(java.lang.Object pValue)
By default this method will return pValue.toString().
If pValue
is a Date
it is formatted using
a DateFormatter
and the default Locale
If pValue
is a RepositoryItem
it's JNDI URI is returned
pValue
- public void prefixPropertyNames(java.util.Collection pPropertyUpdates, java.lang.String pPropertyNamePrefix)
pPropertyNamePrefix
- pPropertyName
- public java.lang.String generateNewPasswordForProfile(RepositoryItem pProfile) throws RepositoryException
Updates the profile's password property.
Updates the profile's generatedPassword boolean property.
The caller is responsible for transaction demarcation.
pProfile
- the affected profileRepositoryException
- If any repository related error occursPasswordGenerator.generatePassword()
public java.lang.String passwordSaltForLogin(java.lang.String pLogin)
pLogin
- the user loginRepositoryException
- if there was a repository error getting
the password salt for the given loginpublic java.lang.String passwordHashersForLogin(java.lang.String pLogin)
pLogin
- the user loginRepositoryException
- if there was a repository error getting the password hasher
component for the given loginpublic void changePassword(RepositoryItem pProfile, java.lang.String pNewPassword, java.lang.String pConfirmNewPassword, java.lang.String pConfirmOldPassword, boolean pMustConfirmNewPassword, boolean pMustConfirmOldPassword) throws atg.userprofiling.PasswordChangeException, RepositoryException, PropertyNotFoundException
In the past the check that the new password does not match the current password was performed explicitly in the form handler's version of this method. With the move from form handler to this utility class, the method has changed so that we allow the PasswordRuleChecker's PreviousNPasswordManager to check that.
As a side effect, this method will update several user properties: previousNPasswords, generatedPassword, passwordLastUpdated
The caller is responsible for transaction demarcation, and for removing the passwordexpired flag from the session.
pProfile
- the affected profilepNewPassword
- the new password in clear textpConfirmNewPassword
- a repeat of the new password, used for confirmation if pMustConfirmNewPasswordpConfirmOldPassword
- clear text of old password, used for confirmation if pMustConfirmOldPasswordpMustConfirmNewPassword
- true if you make the user type in the new password twicepMustConfirmOldPassword
- true if you make the user type in the old password in order to change itPasswordChangeException
- if the new password violates any of the rules of the password rule checkerRepositoryException
- if the property values can't be read or written for some reasonPropertyNotFoundException
- if the login or password properties can't be found in the profile itemPasswordGenerator.generatePassword()
public void changePassword(RepositoryItem pProfile, java.lang.String pLogin, java.lang.String pNewPassword, java.lang.String pConfirmNewPassword, java.lang.String pConfirmOldPassword, boolean pMustConfirmNewPassword, boolean pMustConfirmOldPassword) throws atg.userprofiling.PasswordChangeException, RepositoryException, PropertyNotFoundException
atg.userprofiling.PasswordChangeException
RepositoryException
PropertyNotFoundException
public PasswordHasher getPasswordHasherForUserItem(RepositoryItem pUserItem)
pUserItem
- the user repositoryItem whose associated password hasher are
required.PropertyNotFoundException
public void sendEmailToUser(MutableRepositoryItem pProfile, boolean pRunInSeparateThread, boolean pPersist, TemplateEmailSender pTemplateEmailSender, TemplateEmailInfo pTemplateEmailInfo, java.util.Map pTemplateParameters) throws TemplateEmailException
pProfile
- the affected user profilepRunInSeparateThread
- determines if the email is sent in a separate threadpPersist
- determines if the email is persisted before it is sentpTemplateEmailInfo
- the template used to generate the email.pTemplateEmailSender
- the template email sender object that is used to send the templated email.pTemplateParameters
- a map of template parameters that are associated with the pTemplateEmailInfoImplTemplateEmailException
public boolean upgradePassword(RepositoryItem user, java.lang.String pLogin, java.lang.String pPassword)
user
- -user repository Item which would be updated with the new double
hashed passwordpLogin
- -users login which would be used to fetch password hasher
component pathsalt
- -user salt storedpPassword
- -plain password provided for user authenticationpublic void updatePasswordHasherComponent(RepositoryItem user, java.lang.String pLogin)
user
- --Repository Item which need to be updated with the latest
password hasher.pLogin
- -- The user whose password hasher fetched from DB and checked for
null value.public boolean upgradePasswordUsingBatch(RepositoryItem user, java.lang.String pLogin, java.lang.String pSalt, java.lang.String pPassword) throws RepositoryException
user
- -user repository Item which would be updated with the new double
hashed passwordpLogin
- -users login which would be used to fetch password hasher
component pathsalt
- -user salt storedpPassword
- -hashed password retrieved from the data base of the user.RepositoryException
public java.util.Dictionary calculateNewPropertiesForBatchUpdate(java.lang.String pLogin, java.lang.String pSalt, java.lang.String pPassword, java.lang.String pUserPasswordHasherComponentsString)