Sso "private" class : can be used in SSO but not in Applications
Can by used by client application
| package | sso\lib |
|---|---|
| inherited_from | \sso\SsoClient |
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 loggedauthMethods(string $user) : array<mixed,\sso\SsoAuthMethod>
stringthe user
array<mixed,\sso\SsoAuthMethod>list of AuthMethod to useauthUser(string $user, string $password, boolean $sessionOnly) : string
stringthe user
stringthe password
booleanTRUE for restrict login to session
\sso\BusinessException |
if all auth method failed, return the first exception |
|---|
stringerror message if any, or NULL if OK.checkCredentials(string $appli)
clientError(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 => textpingServer(string $host, integer $port, integer $timeout = 1) : TRUE
stringthe host to check
integerthe port to use
integertimeout in seconds, 1 by default
TRUEsi the server is listening on that port, FALSE otherwiseredirectApplications()
refreshUser(boolean $sessionOnly = FALSE)
booleanTRUE for restrict login to session
registerGlobals(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
authDbUser(string $user, string $password) : \sso\AuthUser | NULL
stringthe user
stringthe password
\sso\AuthUserNULLthe AuthUser for database usercheckUserAuth() : 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 pageregisterUserLogin(string $login, \sso\AuthUser $user, boolean $sessionOnly)
stringuser ID
\sso\AuthUserthe AuthUser object
booleanTRUE for restrict logion to session
resumeApplication()
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