PHP Класс SimpleSAML_Auth_Simple, simplesamlphp

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $authSource ) Create an instance with the specified authsource.
getAttributes ( ) : array Retrieve attributes of the current user.
getAuthData ( string $name ) : mixed | null Retrieve authentication data.
getAuthDataArray ( ) : array | null Retrieve all authentication data.
getAuthSource ( ) : SimpleSAML_Auth_Source Retrieve the implementing authentication source.
getLoginURL ( string | null $returnTo = null ) : string Retrieve a URL that can be used to log the user in.
getLogoutURL ( string | null $returnTo = null ) : string Retrieve a URL that can be used to log the user out.
isAuthenticated ( ) : boolean Check if the user is authenticated.
login ( array $params = [] ) Start an authentication process.
logout ( string | array | null $params = null ) Log the user out.
logoutCompleted ( array $state ) Called when logout operation completes.
requireAuth ( array $params = [] ) Require the user to be authenticated.

Описание методов

__construct() публичный Метод

Create an instance with the specified authsource.
public __construct ( string $authSource )
$authSource string The id of the authentication source.

getAttributes() публичный Метод

This function will retrieve the attributes of the current user if the user is authenticated. If the user isn't authenticated, it will return an empty array.
public getAttributes ( ) : array
Результат array The users attributes.

getAuthData() публичный Метод

Retrieve authentication data.
public getAuthData ( string $name ) : mixed | null
$name string The name of the parameter, e.g. 'Attributes', 'Expire' or 'saml:sp:IdP'.
Результат mixed | null The value of the parameter, or null if it isn't found or we are unauthenticated.

getAuthDataArray() публичный Метод

Retrieve all authentication data.
public getAuthDataArray ( ) : array | null
Результат array | null All persistent authentication data, or null if we aren't authenticated.

getAuthSource() публичный Метод

Retrieve the implementing authentication source.
public getAuthSource ( ) : SimpleSAML_Auth_Source
Результат SimpleSAML_Auth_Source The authentication source.

getLoginURL() публичный Метод

Retrieve a URL that can be used to log the user in.
public getLoginURL ( string | null $returnTo = null ) : string
$returnTo string | null The page the user should be returned to afterwards. If this parameter is null, the user will be returned to the current page.
Результат string A URL which is suitable for use in link-elements.

getLogoutURL() публичный Метод

Retrieve a URL that can be used to log the user out.
public getLogoutURL ( string | null $returnTo = null ) : string
$returnTo string | null The page the user should be returned to afterwards. If this parameter is null, the user will be returned to the current page.
Результат string A URL which is suitable for use in link-elements.

isAuthenticated() публичный Метод

This function checks if the user is authenticated with the default authentication source selected by the 'default-authsource' option in 'config.php'.
public isAuthenticated ( ) : boolean
Результат boolean True if the user is authenticated, false if not.

login() публичный Метод

This function accepts an array $params, which controls some parts of the authentication. The accepted parameters depends on the authentication source being used. Some parameters are generic: - 'ErrorURL': A URL that should receive errors from the authentication. - 'KeepPost': If the current request is a POST request, keep the POST data until after the authentication. - 'ReturnTo': The URL the user should be returned to after authentication. - 'ReturnCallback': The function we should call after the user has finished authentication. Please note: this function never returns.
public login ( array $params = [] )
$params array Various options to the authentication request.

logout() публичный Метод

This function logs the user out. It will never return. By default, it will cause a redirect to the current page after logging the user out, but a different URL can be given with the $params parameter. Generic parameters are: - 'ReturnTo': The URL the user should be returned to after logout. - 'ReturnCallback': The function that should be called after logout. - 'ReturnStateParam': The parameter we should return the state in when redirecting. - 'ReturnStateStage': The stage the state array should be saved with.
public logout ( string | array | null $params = null )
$params string | array | null Either the URL the user should be redirected to after logging out, or an array with parameters for the logout. If this parameter is null, we will return to the current page.

logoutCompleted() публичный статический Метод

This function never returns.
public static logoutCompleted ( array $state )
$state array The state after the logout.

requireAuth() публичный Метод

If the user is authenticated, this function returns immediately. If the user isn't authenticated, this function will authenticate the user with the authentication source, and then return the user to the current page. This function accepts an array $params, which controls some parts of the authentication. See the login() method for a description.
public requireAuth ( array $params = [] )
$params array Various options to the authentication request. See the documentation.