PHP Класс OpenIDConnectClient

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

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

Метод Описание
__construct ( $provider_url = null, $client_id = null, $client_secret = null )
addAuthParam ( $param )
addScope ( $scope )
authenticate ( ) : boolean
canVerifySignatures ( ) : boolean
getAccessToken ( ) : string
getAccessTokenHeader ( ) : array
getAccessTokenPayload ( ) : array
getClientID ( ) : string
getClientName ( ) : mixed
getClientSecret ( ) : string
getIdToken ( ) : string
getIdTokenHeader ( ) : array
getIdTokenPayload ( ) : array
getProviderURL ( ) : string
getRedirectURL ( ) : string Gets the URL of the current page we are on, encodes, and returns it
getRefreshToken ( ) : string
getTokenResponse ( ) : array
providerConfigParam ( $array ) Use this to alter a provider's endpoints and other attributes
redirect ( $url )
refreshToken ( $refresh_token ) : mixed Requests Access token with refresh token
register ( ) Dynamic registration
requestUserInfo ( $attribute = null ) : mixed
setCertPath ( $certPath )
setClientID ( $clientID )
setClientName ( $clientName )
setClientSecret ( $clientSecret )
setHttpProxy ( $httpProxy )
setProviderURL ( $provider_url )
setRedirectURL ( $url )
setResponseTypes ( $response_types )

Защищенные методы

Метод Описание
fetchURL ( $url, null $post_body = null, array() $headers = [] ) : mixed
generateRandString ( ) : string Used for arbitrary value generation for nonces and state
getNonce ( ) : string Get stored nonce
getState ( ) : string Get stored state
setNonce ( string $nonce ) : string Stores nonce
setState ( string $state ) : string Stores $state
unsetNonce ( ) : void Cleanup nonce
unsetState ( ) : void Cleanup state
urlEncode ( string $str ) : string

Приватные методы

Метод Описание
decodeJWT ( $jwt, integer $section ) : object
getProviderConfigValue ( $param, $default = null ) : string Get's anything that we need configuration wise including endpoints, and other values
get_key_for_header ( array $keys, array $header ) : object
requestAuthorization ( ) : void Start Here
requestTokens ( $code ) : mixed Requests ID and Access tokens
verifyJWTclaims ( object $claims, $accessToken = null ) : boolean
verifyJWTsignature ( $jwt ) : boolean
verifyRSAJWTsignature ( string $hashtype, object $key, $payload, $signature ) : boolean

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

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

public __construct ( $provider_url = null, $client_id = null, $client_secret = null )
$provider_url string optional
$client_id string optional
$client_secret string optional

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

public addAuthParam ( $param )
$param - example: prompt=login

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

public addScope ( $scope )
$scope - example: openid, given_name, etc...

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

public authenticate ( ) : boolean
Результат boolean

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

public canVerifySignatures ( ) : boolean
Результат boolean

fetchURL() защищенный Метод

protected fetchURL ( $url, null $post_body = null, array() $headers = [] ) : mixed
$url
$post_body null string If this is set the post type will be POST
$headers array()
Результат mixed

generateRandString() защищенный Метод

Used for arbitrary value generation for nonces and state
protected generateRandString ( ) : string
Результат string

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

public getAccessToken ( ) : string
Результат string

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

public getAccessTokenHeader ( ) : array
Результат array

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

public getAccessTokenPayload ( ) : array
Результат array

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

public getClientID ( ) : string
Результат string

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

public getClientName ( ) : mixed
Результат mixed

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

public getClientSecret ( ) : string
Результат string

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

public getIdToken ( ) : string
Результат string

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

public getIdTokenHeader ( ) : array
Результат array

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

public getIdTokenPayload ( ) : array
Результат array

getNonce() защищенный Метод

Get stored nonce
protected getNonce ( ) : string
Результат string

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

public getProviderURL ( ) : string
Результат string

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

Gets the URL of the current page we are on, encodes, and returns it
public getRedirectURL ( ) : string
Результат string

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

public getRefreshToken ( ) : string
Результат string

getState() защищенный Метод

Get stored state
protected getState ( ) : string
Результат string

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

public getTokenResponse ( ) : array
Результат array

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

Use this to alter a provider's endpoints and other attributes
public providerConfigParam ( $array )
$array simple key => value

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

public redirect ( $url )
$url

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

Requests Access token with refresh token
public refreshToken ( $refresh_token ) : mixed
Результат mixed

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

Dynamic registration
public register ( )

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

public requestUserInfo ( $attribute = null ) : mixed
$attribute string optional Attribute Type Description user_id string REQUIRED Identifier for the End-User at the Issuer. name string End-User's full name in displayable form including all name parts, ordered according to End-User's locale and preferences. given_name string Given name or first name of the End-User. family_name string Surname or last name of the End-User. middle_name string Middle name of the End-User. nickname string Casual name of the End-User that may or may not be the same as the given_name. For instance, a nickname value of Mike might be returned alongside a given_name value of Michael. profile string URL of End-User's profile page. picture string URL of the End-User's profile picture. website string URL of End-User's web page or blog. email string The End-User's preferred e-mail address. verified boolean True if the End-User's e-mail address has been verified; otherwise false. gender string The End-User's gender: Values defined by this specification are female and male. Other values MAY be used when neither of the defined values are applicable. birthday string The End-User's birthday, represented as a date string in MM/DD/YYYY format. The year MAY be 0000, indicating that it is omitted. zoneinfo string String from zoneinfo [zoneinfo] time zone database. For example, Europe/Paris or America/Los_Angeles. locale string The End-User's locale, represented as a BCP47 [RFC5646] language tag. This is typically an ISO 639-1 Alpha-2 [ISO639‑1] language code in lowercase and an ISO 3166-1 Alpha-2 [ISO3166‑1] country code in uppercase, separated by a dash. For example, en-US or fr-CA. As a compatibility note, some implementations have used an underscore as the separator rather than a dash, for example, en_US; Implementations MAY choose to accept this locale syntax as well. phone_number string The End-User's preferred telephone number. E.164 [E.164] is RECOMMENDED as the format of this Claim. For example, +1 (425) 555-1212 or +56 (2) 687 2400. address JSON object The End-User's preferred address. The value of the address member is a JSON [RFC4627] structure containing some or all of the members defined in Section 2.4.2.1. updated_time string Time the End-User's information was last updated, represented as a RFC 3339 [RFC3339] datetime. For example, 2011-01-03T23:58:42+0000.
Результат mixed

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

public setCertPath ( $certPath )
$certPath

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

public setClientID ( $clientID )
$clientID

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

public setClientName ( $clientName )
$clientName

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

public setClientSecret ( $clientSecret )
$clientSecret

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

public setHttpProxy ( $httpProxy )
$httpProxy

setNonce() защищенный Метод

Stores nonce
protected setNonce ( string $nonce ) : string
$nonce string
Результат string

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

public setProviderURL ( $provider_url )
$provider_url

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

public setRedirectURL ( $url )
$url Sets redirect URL for auth flow

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

public setResponseTypes ( $response_types )
$response_types

setState() защищенный Метод

Stores $state
protected setState ( string $state ) : string
$state string
Результат string

unsetNonce() защищенный Метод

Cleanup nonce
protected unsetNonce ( ) : void
Результат void

unsetState() защищенный Метод

Cleanup state
protected unsetState ( ) : void
Результат void

urlEncode() защищенный Метод

protected urlEncode ( string $str ) : string
$str string
Результат string