org.olat.basesecurity
Class AuthHelper

java.lang.Object
  extended by org.olat.basesecurity.AuthHelper

public class AuthHelper
extends java.lang.Object

Description:

Author:
Felix Jost

Field Summary
static int LOGIN_NOTAVAILABLE
           
static int LOGIN_OK
           
static java.lang.String LOGOUT_PAGE
          LOGOUT_PAGE
 
Constructor Summary
AuthHelper()
           
 
Method Summary
static Identity createAndPersistIdentityAndUser(java.lang.String loginName, java.lang.String pwd, User newUser)
          Persists the given user and creates an identity for it
static Identity createAndPersistIdentityAndUserWithUserGroup(java.lang.String loginName, java.lang.String pwd, User newUser)
          Persists the given user, creates an identity for it and adds the user to the users system group
static int doAnonymousLogin(UserRequest ureq, java.util.Locale locale)
          Logs in as anonymous user using the given language key.
static int doLogin(Identity identity, java.lang.String authProvider, UserRequest ureq)
          Used by DMZDispatcher to do regular logins and by ShibbolethDispatcher which is somewhat special because logins are handled asynchronuous -> therefore a dedicated dispatcher is needed which also has to have access to the doLogin() method.
static void doLogout(UserRequest ureq)
          This is a convenience method to log out.
static int getMaxSessions()
           
static boolean isLoginBlocked()
           
static boolean isRejectDMZRequests()
           
static void setLoginBlocked(boolean newLoginBlocked)
           
static void setMaxSessions(int maxSession)
           
static void setRejectDMZRequests(boolean newRejectDMZRequests)
           
static void setSessionInfoFor(Identity identity, java.lang.String authProvider, UserRequest ureq)
          Build session info
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGOUT_PAGE

public static final java.lang.String LOGOUT_PAGE
LOGOUT_PAGE

See Also:
Constant Field Values

LOGIN_OK

public static final int LOGIN_OK
See Also:
Constant Field Values

LOGIN_NOTAVAILABLE

public static final int LOGIN_NOTAVAILABLE
See Also:
Constant Field Values
Constructor Detail

AuthHelper

public AuthHelper()
Method Detail

doLogin

public static int doLogin(Identity identity,
                          java.lang.String authProvider,
                          UserRequest ureq)
Used by DMZDispatcher to do regular logins and by ShibbolethDispatcher which is somewhat special because logins are handled asynchronuous -> therefore a dedicated dispatcher is needed which also has to have access to the doLogin() method.

Parameters:
identity -
authProvider -
ureq -
Returns:
True if success, false otherwise.

doAnonymousLogin

public static int doAnonymousLogin(UserRequest ureq,
                                   java.util.Locale locale)
Logs in as anonymous user using the given language key. If the current installation does not support this language, the systems default language is used instead

Parameters:
ureq - The user request
lang - The language of the anonymous user or null if system default should be used
Returns:
true if login was successful, false otherwise

createAndPersistIdentityAndUser

public static Identity createAndPersistIdentityAndUser(java.lang.String loginName,
                                                       java.lang.String pwd,
                                                       User newUser)
Persists the given user and creates an identity for it

Parameters:
loginName -
pwd - null: no OLAT authentication is generated. If not null, the password will be encrypted and and an OLAT authentication is generated.
newUser - unpersisted user
Returns:
Identity

createAndPersistIdentityAndUserWithUserGroup

public static Identity createAndPersistIdentityAndUserWithUserGroup(java.lang.String loginName,
                                                                    java.lang.String pwd,
                                                                    User newUser)
Persists the given user, creates an identity for it and adds the user to the users system group

Parameters:
loginName -
pwd - null: no OLAT authentication is generated. If not null, the password will be encrypted and and an OLAT authentication is generated.
newUser - unpersisted users
Returns:
Identity

doLogout

public static void doLogout(UserRequest ureq)
This is a convenience method to log out. IMPORTANT: This method initiates a redirect and RETURN. Make sure you return the call hierarchy gracefully. Most of all, don't touch HttpServletRequest or the Session after you call this method.

Parameters:
ureq -

setSessionInfoFor

public static void setSessionInfoFor(Identity identity,
                                     java.lang.String authProvider,
                                     UserRequest ureq)
Build session info

Parameters:
identity -
authProvider -
ureq -

setLoginBlocked

public static void setLoginBlocked(boolean newLoginBlocked)

isLoginBlocked

public static boolean isLoginBlocked()

setRejectDMZRequests

public static void setRejectDMZRequests(boolean newRejectDMZRequests)

isRejectDMZRequests

public static boolean isRejectDMZRequests()

setMaxSessions

public static void setMaxSessions(int maxSession)

getMaxSessions

public static int getMaxSessions()