org.eclipse.higgins.saml2idp.server.util
Class StateUtil

java.lang.Object
  extended byorg.eclipse.higgins.saml2idp.server.util.StateUtil

public class StateUtil
extends Object


Method Summary
static int getFailures(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the recorded number of failed login attempts.
static Date getLastFailureDate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the time/date of the last failed login attempt.
static String getPass(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the password of the currently logged in user.
static org.eclipse.higgins.util.saml.SAML2AuthnRequest getSAMLRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
static String getUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Get the currently logged in user.
static void incFailures(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Increment the recorded number of failed login attempts.
static void loginUser(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String username, String password)
          Logs in a user in the GIB.
static void logout(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Logs out a user from the GIB.
static void resetFailures(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Resets the recorded number of failed login attempts.
static void setSAMLRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.eclipse.higgins.util.saml.SAML2AuthnRequest samlAuthnRequest)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loginUser

public static void loginUser(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             String username,
                             String password)
Logs in a user in the GIB. This is done by storing an attribute in the session. Next time a SAML request comes in, the user is immediately authenticated without the need to provide credentials.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.
username - The name of the user to log in.
password - The password of the user to log in.

logout

public static void logout(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
Logs out a user from the GIB. This is done by removing an attribute from the session. Next time a SAML request comes in, the user is asked to provide credentials again.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.

getUser

public static String getUser(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Get the currently logged in user. This is done by checking if a certain key is present in the session.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.
Returns:
The username of the currently logged in user.

getPass

public static String getPass(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
Get the password of the currently logged in user. This is done by checking if a certain key is present in the session.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.
Returns:
The password of the currently logged in user.

incFailures

public static void incFailures(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
Increment the recorded number of failed login attempts. This is done by checking a map in the servlet context. This map holds the number of failures for the remote IP address.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.

getFailures

public static int getFailures(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
Get the recorded number of failed login attempts. This is done by checking a map in the servlet context. This map holds the number of failures for the remote IP address.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.
Returns:
The number of login failures for the remote IP address of the current request.

resetFailures

public static void resetFailures(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response)
Resets the recorded number of failed login attempts. This is done by checking a map in the servlet context. This map holds the number of failures for the remote IP address.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.

getLastFailureDate

public static Date getLastFailureDate(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
Get the time/date of the last failed login attempt. This is done by checking a map in the servlet context. This map holds the last failure date/time for the remote IP address.

Parameters:
request - The current HttpServletRequest object.
response - The current HttpServletResponse object.
Returns:
The number of login failures for the remote IP address of the current request.

setSAMLRequest

public static void setSAMLRequest(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response,
                                  org.eclipse.higgins.util.saml.SAML2AuthnRequest samlAuthnRequest)

getSAMLRequest

public static org.eclipse.higgins.util.saml.SAML2AuthnRequest getSAMLRequest(javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response)