public class DefaultRemoteUserMapper extends Object implements RemoteUserMapper, ActivateableBean
RemoteUserMapper
implementation. Extracts a user ID using
HttpServletRequest.getRemoteUser()
and optionally from a configured request header. If there is no configured
proxy user name, it returns the request header user name if there is one, or the remote user name otherwise. If there
is a configured proxy user, then it returns the request header user name if the remote user matches the proxy user,
or the remote user otherwise. An optional regular expression defining how to convert the header to a user ID can be
configured using setUserIdPattern(String)
. This allows for the secure proxying of requests from a Surf
client such as Alfresco Share using SSL client certificates.Constructor and Description |
---|
DefaultRemoteUserMapper() |
Modifier and Type | Method and Description |
---|---|
String |
getRemoteUser(HttpServletRequest request)
Gets an externally authenticated user ID from an HTTP request.
|
boolean |
isActive()
Determines whether this bean is active.
|
void |
setActive(boolean isEnabled)
Controls whether the mapper is enabled.
|
void |
setPersonService(PersonService personService)
Sets the person service.
|
void |
setProxyHeader(String proxyHeader)
Sets the name of the header containing the ID of a proxied user.
|
void |
setProxyUserName(String proxyUserName)
Sets the name of the remote user used to 'proxy' requests securely in the name of another user.
|
void |
setUserIdPattern(String userIdPattern)
Sets a regular expression for extracting a user ID from the header.
|
public void setProxyUserName(String proxyUserName)
proxyUserName
- the proxy user name. If null
or empty, then the header will be checked regardless of
remote user identity.public void setProxyHeader(String proxyHeader)
proxyHeader
- the proxy header namepublic void setActive(boolean isEnabled)
getRemoteUser(HttpServletRequest)
will always
return null
isEnabled
- Is this mapper enabled?public void setUserIdPattern(String userIdPattern)
userIdPattern
- the regular expressionpublic void setPersonService(PersonService personService)
personService
- the person servicepublic String getRemoteUser(HttpServletRequest request)
RemoteUserMapper
getRemoteUser
in interface RemoteUserMapper
request
- the requestnull
if the user is unauthenticatedpublic boolean isActive()
ActivateableBean
isActive
in interface ActivateableBean
true
if this bean is activeCopyright © 2005–2017 Alfresco Software. All rights reserved.