com.caplin.keymaster.servlet
Class UserCredentialsProvider

java.lang.Object
  extended by com.caplin.keymaster.servlet.UserCredentialsProvider

public class UserCredentialsProvider
extends Object

Class used to provide user credentials to the defined response formatters. When the StandardKeyMaster needs to get the username to send back in the response to the client, it will invoke the getUserName(javax.servlet.http.HttpServletRequest) method of the UserCredentialsProvider that has been configured via the user.credential.provider servlet configuration parameter.

Author:
David Shorten

Constructor Summary
UserCredentialsProvider()
           
 
Method Summary
 boolean getUseRemoteUser()
          Gets whether the RemoteUser header should be used to obtain the username or not.
 String getUserName(javax.servlet.http.HttpServletRequest httpRequest)
          Invoked when the StandardKeyMaster needs to get the username to send back in the response to the client.
 void setUseRemoteUser(boolean useRemoteUser)
          Sets whether the RemoteUser header should be used to obtain the username or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserCredentialsProvider

public UserCredentialsProvider()
Method Detail

getUserName

public String getUserName(javax.servlet.http.HttpServletRequest httpRequest)

Invoked when the StandardKeyMaster needs to get the username to send back in the response to the client. If the setUseRemoteUser(boolean) method has been invoked with a true argument, this method will check whether the RemoteUser has been specified in the request headers - if so it will return the value of the RemoteUser. If the setUseRemoteUser(boolean) method has not been invoked, or a false argument was passed in, this method will return the value of the username request parameter.

Parameters:
httpRequest - The HttpServletRequest which will provide access to all the information required to determine the user credentials.
Returns:
The username that will be used to log in to Liberator with, or null if the required username parameter was not included within the request.

setUseRemoteUser

public void setUseRemoteUser(boolean useRemoteUser)
Sets whether the RemoteUser header should be used to obtain the username or not.

Parameters:
useRemoteUser - true if the RemoteUser header should be used, otherwise false.

getUseRemoteUser

public boolean getUseRemoteUser()
Gets whether the RemoteUser header should be used to obtain the username or not.

Returns:
true if the RemoteUser header should be used, otherwise false.


Please send bug reports and comments to Caplin support