PHP Class OpenIDConnectClient

Afficher le fichier Open project: jumbojett/openid-connect-php Class Usage Examples

Méthodes publiques

Méthode Description
__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 )

Méthodes protégées

Méthode Description
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

Private Methods

Méthode Description
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

Method Details

__construct() public méthode

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 méthode

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

addScope() public méthode

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

authenticate() public méthode

public authenticate ( ) : boolean
Résultat boolean

canVerifySignatures() public méthode

public canVerifySignatures ( ) : boolean
Résultat boolean

fetchURL() protected méthode

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()
Résultat mixed

generateRandString() protected méthode

Used for arbitrary value generation for nonces and state
protected generateRandString ( ) : string
Résultat string

getAccessToken() public méthode

public getAccessToken ( ) : string
Résultat string

getAccessTokenHeader() public méthode

public getAccessTokenHeader ( ) : array
Résultat array

getAccessTokenPayload() public méthode

public getAccessTokenPayload ( ) : array
Résultat array

getClientID() public méthode

public getClientID ( ) : string
Résultat string

getClientName() public méthode

public getClientName ( ) : mixed
Résultat mixed

getClientSecret() public méthode

public getClientSecret ( ) : string
Résultat string

getIdToken() public méthode

public getIdToken ( ) : string
Résultat string

getIdTokenHeader() public méthode

public getIdTokenHeader ( ) : array
Résultat array

getIdTokenPayload() public méthode

public getIdTokenPayload ( ) : array
Résultat array

getNonce() protected méthode

Get stored nonce
protected getNonce ( ) : string
Résultat string

getProviderURL() public méthode

public getProviderURL ( ) : string
Résultat string

getRedirectURL() public méthode

Gets the URL of the current page we are on, encodes, and returns it
public getRedirectURL ( ) : string
Résultat string

getRefreshToken() public méthode

public getRefreshToken ( ) : string
Résultat string

getState() protected méthode

Get stored state
protected getState ( ) : string
Résultat string

getTokenResponse() public méthode

public getTokenResponse ( ) : array
Résultat array

providerConfigParam() public méthode

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

redirect() public méthode

public redirect ( $url )
$url

refreshToken() public méthode

Requests Access token with refresh token
public refreshToken ( $refresh_token ) : mixed
Résultat mixed

register() public méthode

Dynamic registration
public register ( )

requestUserInfo() public méthode

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.
Résultat mixed

setCertPath() public méthode

public setCertPath ( $certPath )
$certPath

setClientID() public méthode

public setClientID ( $clientID )
$clientID

setClientName() public méthode

public setClientName ( $clientName )
$clientName

setClientSecret() public méthode

public setClientSecret ( $clientSecret )
$clientSecret

setHttpProxy() public méthode

public setHttpProxy ( $httpProxy )
$httpProxy

setNonce() protected méthode

Stores nonce
protected setNonce ( string $nonce ) : string
$nonce string
Résultat string

setProviderURL() public méthode

public setProviderURL ( $provider_url )
$provider_url

setRedirectURL() public méthode

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

setResponseTypes() public méthode

public setResponseTypes ( $response_types )
$response_types

setState() protected méthode

Stores $state
protected setState ( string $state ) : string
$state string
Résultat string

unsetNonce() protected méthode

Cleanup nonce
protected unsetNonce ( ) : void
Résultat void

unsetState() protected méthode

Cleanup state
protected unsetState ( ) : void
Résultat void

urlEncode() protected méthode

protected urlEncode ( string $str ) : string
$str string
Résultat string