Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Static Public Member Functions | Public Attributes | Static Protected Member Functions | List of all members
ezpOauthUtility Class Reference
Inheritance diagram for ezpOauthUtility:

## Static Public Member Functions
static | getToken (ezcMvcRequest $request)
static | doRefreshToken ( $clientId, $clientSecret, $refreshToken)
static | doRefreshTokenWithAuthorizationCode ( $clientId, $clientSecret, $authCode, $redirectUri)

## Public Attributes
const | AUTH_HEADER_NAME = 'Authorization'
const | AUTH_CGI_HEADER_NAME = 'HTTP_AUTHORIZATION'

## Static Protected Member Functions
static | getTokenFromAuthorizationHeader ()
static | getTokenFromQueryComponent (ezpRestRequest $request)
static | getTokenFromHttpBody (ezpRestRequest $request)

## Detailed Description

Definition at line 17 of file utility.php.

## Member Function Documentation

## ◆ doRefreshToken()

static ezpOauthUtility::doRefreshToken | ( |  | $clientId,
|  |  | $clientSecret,
|  |  | $refreshToken
| ) |  |
| static

Handles a refresh_token request. Returns the new token object as ezpRestToken

Parameters

  string | $clientId | Client identifier
  string | $clientSecret | Client secret key
  string | $refreshToken | Refresh token

Returns
  ezpRestToken

Exceptions

  ezpOauthInvalidRequestException |

Definition at line 170 of file utility.php.

References $q, $session, $tokenTTL, ezpRestClient\fetchByClientId(), ezpRestAuthorizedClient\fetchForClientUser(), ezpRestToken\generateToken(), and ezpOauthTokenEndpointErrorType\INVALID_CLIENT.

Referenced by ezpRestOauthTokenController\doHandleRequest().

## ◆ doRefreshTokenWithAuthorizationCode()

static ezpOauthUtility::doRefreshTokenWithAuthorizationCode | ( |  | $clientId,
|  |  | $clientSecret,
|  |  | $authCode,
|  |  | $redirectUri
| ) |  |
| static

Generates a new token against an authorization_code Auth code is checked against clientId, clientSecret and redirectUri as registered for client in admin Auth code is for one-use only and will be removed once the access token generated

Parameters

  string | $clientId | Client identifier
  string | $clientSecret | Client secret key
  string | $authCode | Authorization code provided by the client
  string | $redirectUri | Redirect URI. Must be the same as registered in admin

Returns
  ezpRestToken

Exceptions

  ezpOauthInvalidRequestException |
  ezpOauthInvalidTokenException |
  ezpOauthExpiredTokenException |

Definition at line 230 of file utility.php.

References $q, $session, $tokenTTL, ezpRestClient\fetchByClientId(), ezpRestAuthorizedClient\fetchForClientUser(), ezpRestToken\generateToken(), ezpOauthTokenEndpointErrorType\INVALID_CLIENT, and ezpOauthTokenEndpointErrorType\INVALID_REQUEST.

Referenced by ezpRestOauthTokenController\doHandleRequest().

## ◆ getToken()

static ezpOauthUtility::getToken | ( | ezcMvcRequest | $request | ) |
| static

Retrieving token as per section 5 of draft-ietf-oauth-v2-10

Token can be present inside the Authorize header, inside a URI query parameter, or in the HTTP body.

According to section 5.1 the header is the preferred way, and the query component and HTTP body are only looked at if no such header can be found.

@TODO A configuration mechanism should alternatively let us select which method to use: 1. header, 2. query component, 3. http body, in other words to override the default behaviour according to spec.

Parameters

  string | $ezcMvcRequest |

Returns
  void

Definition at line 38 of file utility.php.

References getTokenFromAuthorizationHeader(), getTokenFromHttpBody(), and getTokenFromQueryComponent().

Referenced by ezpRestOauthAuthenticationStyle\setup().

## ◆ getTokenFromAuthorizationHeader()

static ezpOauthUtility::getTokenFromAuthorizationHeader | ( |  | ) |
| static protected

Extracts the OAuth token from the HTTP header, Authorization.

The token is transmitted via the OAuth Authentication scheme ref. Section 5.1.1.

PHP does not expose the Authorization header unless it uses the 'Basic' or 'Digest' schemes, and it is therefore extracted from the raw Apache headers.

On systems running CGI or Fast-CGI PHP makes this header available via the HTTP_AUTHORIZATION header. ezpOauthInvalidRequestException string The access token string.

Definition at line 92 of file utility.php.

References AUTH_CGI_HEADER_NAME, and AUTH_HEADER_NAME.

Referenced by getToken().

## ◆ getTokenFromHttpBody()

static ezpOauthUtility::getTokenFromHttpBody | ( | ezpRestRequest | $request | ) |
| static protected

Extracts OAuth token fro HTTP Post body.

For more information see section 5.1.3 oauth2.0 v10

Parameters

  ezpRestRequest | $request |

Returns
  string The access token string

Definition at line 150 of file utility.php.

Referenced by getToken().

## ◆ getTokenFromQueryComponent()

static ezpOauthUtility::getTokenFromQueryComponent | ( | ezpRestRequest | $request | ) |
| static protected

Extracts OAuth token query component aka GET parameter.

For more information See section 5.1.2 of oauth2.0 v10

Exceptions

  ezpOauthInvalidRequestException |

Parameters

  ezcMvcRequest | $request |

Returns
  string The access token string

Definition at line 131 of file utility.php.

Referenced by getToken().

## Member Data Documentation

## ◆ AUTH_CGI_HEADER_NAME

const ezpOauthUtility::AUTH_CGI_HEADER_NAME = 'HTTP_AUTHORIZATION'

Definition at line 20 of file utility.php.

Referenced by getTokenFromAuthorizationHeader().

## ◆ AUTH_HEADER_NAME

const ezpOauthUtility::AUTH_HEADER_NAME = 'Authorization'

Definition at line 19 of file utility.php.

Referenced by getTokenFromAuthorizationHeader().

The documentation for this class was generated from the following file:

- utility.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.