fr.paris.lutece.portal.service.security
Class SecurityService

java.lang.Object
  extended by fr.paris.lutece.portal.service.security.SecurityService

public final class SecurityService
extends java.lang.Object

This class provides a security service to register and check user authentication

Since:
Lutece v1.1
Version:
1.1
Author:
Mairie de Paris

Method Summary
 java.lang.String getAccessControledTemplate()
          Returns the access controled template
 java.lang.String getAccessDeniedTemplate()
          Returns the access denied template
 java.lang.String getDoLoginUrl()
          Returns the DoLogin URL of the Authentication Service
 java.lang.String getDoLogoutUrl()
          Returns the DoLogout URL of the Authentication Service
static SecurityService getInstance()
          Get the unique instance of the Security Service
 java.lang.String getLoginPageUrl()
          Returns the Login page URL of the Authentication Service
 java.lang.String getLostPasswordPageUrl()
          Returns the lost password URL of the Authentication Service
 java.lang.String getNewAccountPageUrl()
          Returns the new account page URL of the Authentication Service
 LuteceUser getRegisteredUser(javax.servlet.http.HttpServletRequest request)
          Gets the Lutece user registered in the Http session
 LuteceUser getRemoteUser(javax.servlet.http.HttpServletRequest request)
          Gets the LuteceUser attached to the current Http session
 java.security.Principal getUserPrincipal(javax.servlet.http.HttpServletRequest request)
          Returns the user's principal
 java.lang.String getViewAccountPageUrl()
          Returns the view account page URL of the Authentication Service
static void init()
          Initialize service
static boolean isAuthenticationEnable()
          Returns the authentication's activation : enable or disable
 boolean isExternalAuthentication()
          Returns the authentication type : External or Lutece portal based
 boolean isPortalAuthenticationRequired()
          Returns whether or not the portal needs authentication
 boolean isUserInRole(javax.servlet.http.HttpServletRequest request, java.lang.String strRole)
          Checks if the user is associated to a given role
 void loginUser(javax.servlet.http.HttpServletRequest request, java.lang.String strUserName, java.lang.String strPassword)
          Checks user's login with the Authentication service.
 void logoutUser(javax.servlet.http.HttpServletRequest request)
          Logout the user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

init

public static void init()
                 throws LuteceInitException
Initialize service

Throws:
LuteceInitException

getInstance

public static SecurityService getInstance()
Get the unique instance of the Security Service

Returns:
The instance

isAuthenticationEnable

public static boolean isAuthenticationEnable()
Returns the authentication's activation : enable or disable

Returns:
true if the authentication is active, false otherwise

getRemoteUser

public LuteceUser getRemoteUser(javax.servlet.http.HttpServletRequest request)
                         throws UserNotSignedException
Gets the LuteceUser attached to the current Http session

Parameters:
request - The Http request
Returns:
A LuteceUser object if found
Throws:
UserNotSignedException - If there is no current user

getUserPrincipal

public java.security.Principal getUserPrincipal(javax.servlet.http.HttpServletRequest request)
                                         throws UserNotSignedException
Returns the user's principal

Parameters:
request - The HTTP request
Returns:
The user's principal
Throws:
UserNotSignedException - The UserNotSignedException

isUserInRole

public boolean isUserInRole(javax.servlet.http.HttpServletRequest request,
                            java.lang.String strRole)
Checks if the user is associated to a given role

Parameters:
request - The Http request
strRole - The Role name
Returns:
Returns true if the user is associated to the given role

loginUser

public void loginUser(javax.servlet.http.HttpServletRequest request,
                      java.lang.String strUserName,
                      java.lang.String strPassword)
               throws javax.security.auth.login.LoginException
Checks user's login with the Authentication service.

Parameters:
request - The Http request
strUserName - The user's login
strPassword - The user's password
Throws:
javax.security.auth.login.LoginException - The LoginException

logoutUser

public void logoutUser(javax.servlet.http.HttpServletRequest request)
Logout the user

Parameters:
request - The HTTP request

getRegisteredUser

public LuteceUser getRegisteredUser(javax.servlet.http.HttpServletRequest request)
Gets the Lutece user registered in the Http session

Parameters:
request - The HTTP request
Returns:
The User registered or null if the user has not been registered

isExternalAuthentication

public boolean isExternalAuthentication()
Returns the authentication type : External or Lutece portal based

Returns:
true if the user is already authenticated or false if it needs to login.

getLoginPageUrl

public java.lang.String getLoginPageUrl()
Returns the Login page URL of the Authentication Service

Returns:
The URL

getDoLoginUrl

public java.lang.String getDoLoginUrl()
Returns the DoLogin URL of the Authentication Service

Returns:
The URL

getDoLogoutUrl

public java.lang.String getDoLogoutUrl()
Returns the DoLogout URL of the Authentication Service

Returns:
The URL

getNewAccountPageUrl

public java.lang.String getNewAccountPageUrl()
Returns the new account page URL of the Authentication Service

Returns:
The URL

getViewAccountPageUrl

public java.lang.String getViewAccountPageUrl()
Returns the view account page URL of the Authentication Service

Returns:
The URL

getLostPasswordPageUrl

public java.lang.String getLostPasswordPageUrl()
Returns the lost password URL of the Authentication Service

Returns:
The URL

getAccessDeniedTemplate

public java.lang.String getAccessDeniedTemplate()
Returns the access denied template

Returns:
The template

getAccessControledTemplate

public java.lang.String getAccessControledTemplate()
Returns the access controled template

Returns:
The template

isPortalAuthenticationRequired

public boolean isPortalAuthenticationRequired()
Returns whether or not the portal needs authentication

Returns:
true if the access needs authentication, otherwise
Since:
1.3.1


Copyright © 2007 Mairie de Paris. All Rights Reserved.