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

 Methods

Check if user is logged and make appropriate actions

auth(boolean $checkCredentials = TRUE, boolean $initApplication = TRUE, boolean $redirect = FALSE) : \sso\AuthUser
Inherited

Redirect user to login page if not

Parameters

$checkCredentials

boolean

(default TRUE) FALSE for do not check credentials (only check sso login)

$initApplication

boolean

(default TRUE) FALSE for do not call application handler

$redirect

boolean

(default FALSE) TRUE for redirect to application

Returns

\sso\AuthUserreturn current user if logged

Retrieve all auth methods for a user

authMethods(string $user) : array<mixed,\sso\SsoAuthMethod>

Parameters

$user

string

the user

Returns

array<mixed,\sso\SsoAuthMethod>list of AuthMethod to use

Check a login/password. Can send HTTP header for redirect user if needed

authUser(string $user, string $password, boolean $sessionOnly) : string

Parameters

$user

string

the user

$password

string

the password

$sessionOnly

boolean

TRUE for restrict login to session

Exceptions

\sso\BusinessException if all auth method failed, return the first exception

Returns

stringerror message if any, or NULL if OK.

Check user can access to an application path

checkCredentials(string $appli) 

currentApplication became $appli if user have access

see
inherited_from \sso\SsoClient::checkCredentials()

Parameters

$appli

string

application path

Redirect to login page when error occured during client init

clientError(integer $code, string $message, string $file, integer $line) 
Inherited

Parameters

$code

integer

error code

$message

string

error message

$file

string

file name

$line

integer

line number

Redirect to login page when exception occured during client init

clientException(\sso\Exception $ex) 
Inherited

Parameters

$ex

\sso\Exception

the exception

Display the SSO menu in page without the CSS in header.

displayFullMenuAfterBody() 
Inherited

CSS will be added by javascript during page load

display the SSO menu

displayMenu(boolean $hidden = FALSE
Inherited

Parameters

$hidden

boolean

TRUE for do not display menu

Return HTML link tag for CSS SSO menu

displayMenuCssHeader(boolean $hidden = FALSE
Inherited

Parameters

$hidden

boolean

TRUE for do not display menu

Retrieve SsoClient instance

getInstance(string $path = NULL) : \sso\SsoClient
InheritedStatic

Parameters

$path

string

web path of SSO. Needed for retrieve SSO from client application

Returns

\sso\SsoClientcurrent instance

Retrieve login user name

getLogin() : string
Inherited

Returns

stringlogin user name

Retrieve the logout reason

getLogoutReason(integer $reason) : string
InheritedStatic

Parameters

$reason

integer

self::AUTHKO*

Returns

stringlogout reason

Retrieve AuthUser

getUser() : \sso\AuthUser
Inherited

Returns

\sso\AuthUserthe AuthUser returned by an auth method

Retrieve user name

getUserName() : string
Inherited

Returns

stringuser name for display

Check user is logged

isLogged() : boolean
Inherited

Returns

booleanTRUE if user is logged and enabled

Check user is SSO Admin

isSsoAdmin() : boolean
Inherited

Returns

booleanTRUE if logged user is an SSO admin

Check a fullpath is a subpath of a basepath

isSubPath(string $fullPath, string $basePath) : TRUE
Inherited

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

Parameters

$fullPath

string

full path to check

$basePath

string

the base path the full path have to begin with

Returns

TRUEif $fullPath start with $basePath and match exactly for last path element.

SSO pages list

pagesList() : array<mixed,string>
Inherited

Returns

array<mixed,string>key => text

Check a server is listening

pingServer(string $host, integer $port, integer $timeout = 1) : TRUE
Static

Parameters

$host

string

the host to check

$port

integer

the port to use

$timeout

integer

timeout in seconds, 1 by default

Returns

TRUEsi the server is listening on that port, FALSE otherwise

Redirect to application list

redirectApplications() 

Refresh user data after credentials change for example

refreshUser(boolean $sessionOnly = FALSE

Parameters

$sessionOnly

boolean

TRUE for restrict login to session

Register variables in session

registerGlobals(array<mixed,mixed> $variables) 
Inherited

Variables will be restored at each page in global variables

Parameters

$variables

array<mixed,mixed>

variableName => variableValue

Set the URL for redirect after login

setRedirectUrl(string $url, boolean $init = FALSE
Inherited

Parameters

$url

string

URL for redirect after login

$init

boolean

set to TRUE for initialize application before redirect

Redirect to another page

technicalRedirectTo(string $page, integer $code = 303, boolean $allowCaching = FALSE
Inherited

Parameters

$page

string

the page, from server root

$code

integer

HTTP code, default 303

$allowCaching

boolean

FALSE by default, set to TRUE for not send HTTP headers prevent redirection caching

Check user can access to an application path

checkCredentials(string $appli) : boolean
Inherited

currentApplication became $appli if user have access

Parameters

$appli

string

application path

Returns

booleanTRUE if user can access to this application, FALSE otherwise

Retrieve handler for application (or current application)

getClientHandler(string $appli = NULL) : \sso\Handler
Inherited

Parameters

$appli

string

application path, or NULL for use current application

Returns

\sso\Handlerthe Handler instance for this application. Can be NULL

Initialize an application Handler

loadClientHandler(string $handler, string $appli) : \sso\Handler
Inherited

Parameters

$handler

string

handler class name

$appli

string

application path

Returns

\sso\Handlerinstance

Build a new SsoClient instance

__construct(string $path = NULL
Inherited

Parameters

$path

string

web path of SSO

Check user with database credentials

authDbUser(string $user, string $password) : \sso\AuthUser | NULL

Parameters

$user

string

the user

$password

string

the password

Returns

\sso\AuthUserNULLthe AuthUser for database user

Check session validity

checkUserAuth() : integer
Inherited

Returns

integerstatus of session : self::AUTH_*

Retrieve an ID that identify the SSO menu (for handle browser cache)

getMenuId(boolean $hidden = FALSE) : string
Inherited

Parameters

$hidden

boolean

TRUE for do not display menu

Returns

stringan ID prefixed by destination : application=ID

Try to init a client application

initApplication() 
Inherited

Exceptions

\sso\Exception if something go wrong during init

Check current or provided page is a SSO page

isSsoPage(string $url = NULL) : boolean
Inherited

Parameters

$url

string

URL to check, NULL will check current page

Returns

booleanTRUE if it's an SSO page

Register a logged user in session

registerUserLogin(string $login, \sso\AuthUser $user, boolean $sessionOnly) 

Parameters

$login

string

user ID

$user

\sso\AuthUser

the AuthUser object

$sessionOnly

boolean

TRUE for restrict logion to session

Redirect to current application (setted by setRedirectUrl() in session->SSO_REDIRECT)

resumeApplication() 
Inherited

If user have credentials for this application, call the init handler and redirect.
If not, redirect to Application List page

 Properties

 

current session

$session : \sso\Session

Default

 

current application path

$currentApplication : string

Default

NULL
 

current instance

$instance : \sso\SsoClient

Default

NULL
Static
 

all logout reason : int (self::AUTH<em>KO</em>*) => logout reason

$logoutReasons : array<mixed,string>

Default

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)
Static

 Constants

 

Auth status : User Agent check failed

AUTH_KO_AGENT = 21 
 

Auth status : error occured during application init

AUTH_KO_INIT_APP = 40 
 

Auth status : IP check failed

AUTH_KO_IP = 20 
 

Auth status : session does not exists anymore

AUTH_KO_NO_SESSION = 11 
 

Auth status : session has expired

AUTH_KO_TIMEOUT = 30 
 

Auth status : unknown error occured

AUTH_KO_UNKNOWN = 99 
 

Auth status : OK

AUTH_OK = 10