Main SSO class
Can by used by client application
| package | sso\lib |
|---|
auth(boolean $checkCredentials= TRUE, boolean $initApplication= TRUE, boolean $redirect= FALSE) : \sso\AuthUser
Redirect user to login page if not
boolean(default TRUE) FALSE for do not check credentials (only check sso login)
boolean(default TRUE) FALSE for do not call application handler
boolean(default FALSE) TRUE for redirect to application
\sso\AuthUserreturn current user if loggedclientError(integer $code, string $message, string $file, integer $line)
integererror code
stringerror message
stringfile name
integerline number
clientException(\sso\Exception $ex)
\sso\Exceptionthe exception
displayFullMenuAfterBody()
CSS will be added by javascript during page load
displayMenu(boolean $hidden = FALSE)
booleanTRUE for do not display menu
displayMenuCssHeader(boolean $hidden = FALSE)
booleanTRUE for do not display menu
getInstance(string $path = NULL) : \sso\SsoClient
stringweb path of SSO. Needed for retrieve SSO from client application
\sso\SsoClientcurrent instancegetLogin() : string
stringlogin user namegetLogoutReason(integer $reason) : string
integerself::AUTHKO*
stringlogout reasongetUser() : \sso\AuthUser
\sso\AuthUserthe AuthUser returned by an auth methodgetUserName() : string
stringuser name for displayisLogged() : boolean
booleanTRUE if user is logged and enabledisSsoAdmin() : boolean
booleanTRUE if logged user is an SSO adminisSubPath(string $fullPath, string $basePath) : TRUE
Examples :
/a/b/c is a subpath of /a/b
/a/b is a subpath of /a/b
/a/bc is NOT a subpath of /a/b
stringfull path to check
stringthe base path the full path have to begin with
TRUEif $fullPath start with $basePath and match exactly for last path element.pagesList() : array<mixed,string>
array<mixed,string>key => textregisterGlobals(array<mixed,mixed> $variables)
Variables will be restored at each page in global variables
array<mixed,mixed>variableName => variableValue
setRedirectUrl(string $url, boolean $init = FALSE)
stringURL for redirect after login
booleanset to TRUE for initialize application before redirect
technicalRedirectTo(string $page, integer $code= 303, boolean $allowCaching= FALSE)
stringthe page, from server root
integerHTTP code, default 303
booleanFALSE by default, set to TRUE for not send HTTP headers prevent redirection caching
checkCredentials(string $appli) : boolean
currentApplication became $appli if user have access
stringapplication path
booleanTRUE if user can access to this application, FALSE otherwisegetClientHandler(string $appli = NULL) : \sso\Handler
stringapplication path, or NULL for use current application
\sso\Handlerthe Handler instance for this application. Can be NULLloadClientHandler(string $handler, string $appli) : \sso\Handler
stringhandler class name
stringapplication path
\sso\Handlerinstance__construct(string $path = NULL)
stringweb path of SSO
checkUserAuth() : integer
integerstatus of session : self::AUTH_*getMenuId(boolean $hidden = FALSE) : string
booleanTRUE for do not display menu
stringan ID prefixed by destination : application=IDinitApplication()
\sso\Exception |
if something go wrong during init |
|---|
isSsoPage(string $url = NULL) : boolean
stringURL to check, NULL will check current page
booleanTRUE if it's an SSO pageresumeApplication()
If user have credentials for this application, call the init handler and redirect.
If not, redirect to Application List page
$session : \sso\Session
$currentApplication : string
NULL$instance : \sso\SsoClient
NULL$logoutReasons : array<mixed,string>
array(self::AUTH_KO_AGENT => \sso\L::logout_reason_invalid, self::AUTH_KO_IP => \sso\L::logout_reason_invalid, self::AUTH_KO_NO_SESSION => \sso\L::logout_reason_not_exists, self::AUTH_KO_TIMEOUT => \sso\L::logout_reason_expire, self::AUTH_KO_UNKNOWN => \sso\L::logout_reason_unknown, self::AUTH_KO_INIT_APP => \sso\L::logout_reason_auth)AUTH_KO_AGENT = 21
AUTH_KO_INIT_APP = 40
AUTH_KO_IP = 20
AUTH_KO_NO_SESSION = 11
AUTH_KO_TIMEOUT = 30
AUTH_KO_UNKNOWN = 99
AUTH_OK = 10