com.silverpeas.authentication
Class SilverpeasSessionOpener

java.lang.Object
  extended by com.silverpeas.authentication.SilverpeasSessionOpener

public class SilverpeasSessionOpener
extends Object

Service used to open an HTTP session in the Silverpeas platform.

It asks for a session opening to the session manager and then it creates all the required session resources for Silverpeas and stores them into the user session.

Author:
ehugonnet

Constructor Summary
SilverpeasSessionOpener()
           
 
Method Summary
 void closeSession(javax.servlet.http.HttpSession session)
          Closes the specified session.
protected  String getAbsoluteUrl(HttpRequest request)
          Computes the beginning of an absolute URL for the home page.
protected  String getErrorPageUrl(HttpRequest request, String authKey)
          The user wasn't yet authenticated then computes the error page.
protected  String getHomePageUrl(HttpRequest request, String redirectURL)
          The user was authenticated and its session in Silverpeas was opened successfully, then computes its home page.
 String openSession(HttpRequest request, String authKey)
          Opens a session in Silverpeas for the authenticated user behinds the specified HTTP request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SilverpeasSessionOpener

public SilverpeasSessionOpener()
Method Detail

openSession

public String openSession(HttpRequest request,
                          String authKey)
Opens a session in Silverpeas for the authenticated user behinds the specified HTTP request.

In order a session to be opened in Silverpeas, the user has to be authenticated. The authentication of the user is represented by an authentication key that is unique for each user so that a user can be also identified by its key.

With its authentication key and some attributes from the request,a session in Silverpeas can be opened and set for the user.

In the case a session was already opened for the user with the same web browser, the current session is then taken into account and the user access information is updated. In this case, no new session is opened and the previous one isn't invalidated. If this behavior isn't what you expect, then you have to close explicitly the current session of the user before calling this method. In the case the user is already connected but with another web browser, a new session is opened without invalidating the other one.

Parameters:
request - the HTTP request asking a session opening.
authKey - the authentication key computed from a user authentication process and that is unique to the user.
Returns:
the URL of the user home page in Silverpeas or the URL of an error page if a problem occurred during the session opening (for example, the user wasn't authenticated).

closeSession

public void closeSession(javax.servlet.http.HttpSession session)
Closes the specified session. All the resources allocated for the maintain the user session in Silverpeas are then freed.

Parameters:
session - the HTTP session to close.

getErrorPageUrl

protected String getErrorPageUrl(HttpRequest request,
                                 String authKey)
The user wasn't yet authenticated then computes the error page.

Parameters:
request - the HTTP request asking a session opening.
authKey - the authentication key computed from a user authentication process and that is unique to the user.
Returns:
the URL of an error page.

getHomePageUrl

protected String getHomePageUrl(HttpRequest request,
                                String redirectURL)
The user was authenticated and its session in Silverpeas was opened successfully, then computes its home page.

Parameters:
request - the HTTP request asking a session opening.
redirectURL - a redirection URL.
Returns:
the URL of the user home page in Silverpeas.

getAbsoluteUrl

protected String getAbsoluteUrl(HttpRequest request)
Computes the beginning of an absolute URL for the home page.

Parameters:
request - the HTTP request asking for a session opening.
Returns:
an absolute URL from which the user home page will be computed.


Copyright © 2016 Silverpeas. All Rights Reserved.