Свойство | Type | Description | |
---|---|---|---|
$AccessToken | object | AccessToken object. | |
$AuthCode | object | AuthCode object. | |
$Client | object | Clients object. | |
$OAuth2 | object | OAuth2 Object | |
$RefreshToken | object | RefreshToken object. | |
$User | object | User object | |
$authenticate | array | Inherits theses defaults: $this->OAuth->authenticate = array( 'userModel' => 'User', 'fields' => array( 'username' => 'username', 'password' => 'password' ) ); Which can be overridden in your beforeFilter: $this->OAuth->authenticate = array( 'fields' => array( 'username' => 'email' ) ); $this->OAuth->authenticate | |
$grantTypes | array | By default = array('authorization_code', 'refresh_token', 'password'); Other grant mechanisms are not supported in the current release |
Свойство | Type | Description | |
---|---|---|---|
$_authDefaults | array | Defaults for $authenticate | |
$_user | array | Static storage for current user | |
$allowedActions | array | Array of allowed actions |
Méthode | Description | |
---|---|---|
__call ( string $name, mixed $arguments ) : mixed | Fakes the OAuth2.php vendor class extension for methods | |
__construct ( ComponentCollection $collection, $settings = [] ) | Constructor - Adds class associations | |
__get ( string $name ) : mixed | Fakes the OAuth2.php vendor class extension for variables | |
allow ( $action = null ) : void | Takes a list of actions in the current controller for which authentication is not required, or no parameters to allow all actions. | |
checkClientCredentials ( string $client_id, string $client_secret = null ) : mixed | Check client details are valid | |
checkRestrictedGrantType ( string $client_id, string $grant_type ) : boolean | Partial implementation, just checks globally avaliable grant types | |
checkUserCredentials ( type $client_id, type $username, type $password ) | Grant type: user_credentials | |
deny ( $action = null ) : void | Removes items from the list of allowed/no authentication required actions. | |
getAccessToken ( string $oauth_token ) : mixed | Retrieve access token | |
getAuthCode ( string $code ) : AuthCode | Grant type: authorization_code | |
getClientDetails ( string $client_id ) : boolean | Get client details | |
getRefreshToken ( string $refresh_token ) : mixed | Grant type: refresh_token | |
hash ( string $password ) : string | Convenience function for hashing client_secret (or whatever else) | |
initialize ( Controller $controller ) : void | Initializes OAuthComponent for use in the controller | |
invalidateUserTokens ( integer $user_id, string $tokens = 'both' ) | Convenience function to invalidate all a users tokens, for example when they change their password | |
isAuthorized ( ) : boolean | Checks if user is valid using OAuth2-php library | |
setAccessToken ( string $oauth_token, string $client_id, integer $user_id, string $expires, string $scope = null ) : boolean | Set access token | |
setAuthCode ( string $code, string $client_id, integer $user_id, string $redirect_uri, string $expires, string $scope = null ) : boolean | Grant type: authorization_code | |
setRefreshToken ( string $refresh_token, integer $client_id, string $user_id, string $expires, string $scope = null ) : boolean | Grant type: refresh_token | |
startup ( Controller $controller ) : boolean | Main engine that checks valid access_token and stores the associated user for retrival | |
unsetRefreshToken ( string $refresh_token ) : boolean | Grant type: refresh_token | |
user ( type $field = null, $token = null ) : mixed | Gets the user associated to the current access token. |
public __construct ( ComponentCollection $collection, $settings = [] ) | ||
$collection | ComponentCollection |
public checkUserCredentials ( type $client_id, type $username, type $password ) | ||
$client_id | type | |
$username | type | |
$password | type |
public getAccessToken ( string $oauth_token ) : mixed | ||
$oauth_token | string | |
Résultat | mixed | AccessToken array if valid, null if not |
public getAuthCode ( string $code ) : AuthCode | ||
$code | string | |
Résultat | AuthCode | if valid, null of not |
public getClientDetails ( string $client_id ) : boolean | ||
$client_id | string | |
Résultat | boolean |
public getRefreshToken ( string $refresh_token ) : mixed | ||
$refresh_token | string | |
Résultat | mixed | RefreshToken if valid, null if not |
public initialize ( Controller $controller ) : void | ||
$controller | Controller | A reference to the instantiating controller object |
Résultat | void |
public invalidateUserTokens ( integer $user_id, string $tokens = 'both' ) | ||
$user_id | integer | |
$tokens | string | 'both' (default) to remove both AccessTokens and RefreshTokens or remove just one type using 'access' or 'refresh' |
public isAuthorized ( ) : boolean | ||
Résultat | boolean | true if carrying valid token, false if not |
public unsetRefreshToken ( string $refresh_token ) : boolean | ||
$refresh_token | string | |
Résultat | boolean | true if successfull, false if not |
protected array $_authDefaults | ||
Résultat | array |
protected array $allowedActions | ||
Résultat | array |
public array $authenticate | ||
Résultat | array |
public array $grantTypes | ||
Résultat | array |