Cheetah
Public Member Functions | Protected Attributes | List of all members
OAuth2\Scope Class Reference
Inheritance diagram for OAuth2\Scope:
OAuth2\ScopeInterface OAuth2\Storage\ScopeInterface

Public Member Functions

 __construct ($storage=null)
 
 checkScope ($required_scope, $available_scope)
 
 scopeExists ($scope)
 
 getScopeFromRequest (RequestInterface $request)
 
 getDefaultScope ($client_id=null)
 
 getReservedScopes ()
 

Protected Attributes

 $storage
 

Detailed Description

See also
OAuth2\ScopeInterface

Definition at line 11 of file Scope.php.

Constructor & Destructor Documentation

◆ __construct()

OAuth2\Scope::__construct (   $storage = null)
Parameters
mixed@storage Either an array of supported scopes, or an instance of OAuth2\Storage\ScopeInterface

Definition at line 19 of file Scope.php.

Member Function Documentation

◆ checkScope()

OAuth2\Scope::checkScope (   $required_scope,
  $available_scope 
)

Check if everything in required scope is contained in available scope.

Parameters
$required_scopeA space-separated string of scopes.
Returns
TRUE if everything in required scope is contained in available scope, and FALSE if it isn't.
See also
http://tools.ietf.org/html/rfc6749#section-7

Implements OAuth2\ScopeInterface.

Definition at line 46 of file Scope.php.

◆ getDefaultScope()

OAuth2\Scope::getDefaultScope (   $client_id = null)

The default scope to use in the event the client does not request one. By returning "false", a request_error is returned by the server to force a scope request by the client. By returning "null", opt out of requiring scopes

Parameters
$client_idAn optional client id that can be used to return customized default scopes.
Returns
string representation of default scope, null if scopes are not defined, or false to force scope request by the client

ex: 'default' ex: null

Implements OAuth2\Storage\ScopeInterface.

Definition at line 85 of file Scope.php.

◆ getReservedScopes()

OAuth2\Scope::getReservedScopes ( )

Get reserved scopes needed by the server.

In case OpenID Connect is used, these scopes must include: 'openid', offline_access'.

Returns
An array of reserved scopes.

Definition at line 99 of file Scope.php.

◆ getScopeFromRequest()

OAuth2\Scope::getScopeFromRequest ( RequestInterface  $request)

Return scope info from request

Parameters
OAuth2

Implements OAuth2\ScopeInterface.

Definition at line 79 of file Scope.php.

◆ scopeExists()

OAuth2\Scope::scopeExists (   $scope)

Check if the provided scope exists in storage.

Parameters
$scopeA space-separated string of scopes.
Returns
TRUE if it exists, FALSE otherwise.

Implements OAuth2\Storage\ScopeInterface.

Definition at line 63 of file Scope.php.

Member Data Documentation

◆ $storage

OAuth2\Scope::$storage
protected

Definition at line 13 of file Scope.php.


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