Provides a simple and clean Abstraction for Integration with OAuth 2.0 Server Providers.
$auth = new \Poirot\OAuth2Client\Client(
'http://172.17.0.1:8000/'
, 'test@default.axGEceVCtGqZAdW3rc34sqbvTASSTZxD'
, 'xPWIpmzBK38MmDRd'
);
$url = $auth->attainAuthorizationUrl( $auth->withGrant('implicit') );
Retrieve Redirection To Authorize Url:
$url = $auth->attainAuthorizationUrl( $auth->withGrant(GrantPlugins::AUTHORIZATION_CODE) );
When User redirect back include Auth Code:
/ @var iAccessTokenObject $token */
$token = $auth->attainAccessToken(
$auth->withGrant(GrantPlugins::AUTHORIZATION_CODE, ['code' => 'your_auth_code'])
);
$token->getAccessToken();
$token->getScopes();
$token->getDateTimeExpiration();
// ...
override default scopes request
$token = $auth->attainAccessToken(
$auth->withGrant(GrantPlugins::CLIENT_CREDENTIALS, [ 'scopes' => ['override' ,'scopes'] ])
);
Specific Params Passed As Argument To Grant Factory
try {
$auth->attainAccessToken(
$auth->withGrant('password')
);
} catch (\Poirot\OAuth2Client\Exception\exMissingGrantRequestParams $e) {
// Request Param "username" & "password" must Set.
echo $e->getMessage();
$token = $token = $auth->attainAccessToken(
$auth->withGrant('password', ['username' => 'payam', 'password' => '123456'])
);
$refreshTokenStr = $token->getRefreshToken();
}
Specific Poirot Server Federation Commands To Deal 3rd party application with Server.
! For Federation Calls we need valid token: this token can strictly defined to client or retrieve from server.
example below show token asserted from oauth server when required!
// Setup OAuth2 Client
$client = new \Poirot\OAuth2Client\Client(
'http://172.17.0.1:8000/'
, 'test@default.axGEceVCtGqZAdW3rc34sqbvTASSTZxD'
, 'xPWIpmzBK38MmDRd'
);
// Token Provider for Federation Calls
// Use Credential Grant as Grant Type for Tokens
$tokenProvider = new TokenFromOAuthClient(
$client
, $client->withGrant('client_credentials')
);
// Note:
// Make Calls and Don`t Worry About Token Renewal And Expired Tokens.
// Platfrom Will Handle It.
$federation = new \Poirot\OAuth2Client\Federation(
'http://172.17.0.1:8000/'
, $tokenProvider
);
// Check wheather this identifier(s) is given by any user?
$checkExists = $federation->checkIdentifierGivenToAnyUser([
'email' => 'naderi.payam@gmail.com',
'mobile' => [
'number' => '9355497674',
'country' => '+98',
],
]);
Classes of Payam Naderi | > | PHP OAuth2 Client | > | Download .zip .tar.gz | > | Support forum | > | Blog | > | Latest changes |
|
|
Groups | Applications | Files |
Groups |
PHP 5 | Classes using PHP 5 specific features | View top rated classes |
User Management | User records, authentication and session handling | View top rated classes |
Web services | Web data clipping, SOAP or XML-RPC clients and servers | View top rated classes |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Files |
File | Role | Description | ||
---|---|---|---|---|
mod (2 files, 5 directories) | ||||
src (3 files, 7 directories) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | mod |
File | Role | Description | ||
---|---|---|---|---|
Actions (3 files) | ||||
Authenticate (3 files) | ||||
Authenticator (1 file) | ||||
config (3 files, 1 directory) | ||||
Services (1 file, 2 directories) | ||||
Module.php | Class | Class source | ||
_functions.php | Example | Example script |
Files | / | mod | / | Actions |
File | Role | Description |
---|---|---|
AssertDebugTokenAction.php | Class | Class source |
AssertTokenAction.php | Class | Class source |
ServiceAssertTokenAction.php | Class | Class source |
Files | / | mod | / | Authenticate |
File | Role | Description |
---|---|---|
IdentifierHttpToken.php | Class | Class source |
IdentifierTokenAssertion.php | Class | Class source |
IdentityOAuthToken.php | Class | Class source |
Files | / | mod | / | Authenticator |
File | Role | Description |
---|---|---|
OAuthTokenAuthenticatorPlugin.php | Class | Class source |
Files | / | mod | / | config |
File | Role | Description | ||
---|---|---|---|---|
oauth2client (3 files) | ||||
mod-oauth2client.actions.conf.php | Class | Class source | ||
mod-oauth2client.conf.php | Class | Class source | ||
mod-oauth2client.services.conf.php | Class | Class source |
Files | / | mod | / | config | / | oauth2client |
File | Role | Description |
---|---|---|
client_credential.conf.php | Aux. | Auxiliary script |
federation.conf.php | Example | Example script |
token_assertion.conf.php | Class | Class source |
Files | / | mod | / | Services |
File | Role | Description | ||
---|---|---|---|---|
Authenticate (2 files) | ||||
Authenticators (1 file) | ||||
ServiceOAuthClient.php | Class | Class source |
Files | / | mod | / | Services | / | Authenticate |
File | Role | Description |
---|---|---|
IdentityProviderFederation.php | Class | Class source |
ServiceIdentityProviderFederation.php | Class | Class source |
Files | / | mod | / | Services | / | Authenticators |
File | Role | Description |
---|---|---|
ServiceAuthenticatorToken.php | Class | Class source |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
Assertion (3 files, 1 directory) | ||||
Client (3 files, 2 directories) | ||||
Exception (11 files) | ||||
Federation (1 file, 2 directories) | ||||
Grant (6 files, 2 directories) | ||||
Interfaces (5 files) | ||||
Model (1 directory) | ||||
Client.php | Class | Class source | ||
Federation.php | Class | Class source | ||
_functions.php | Example | Example script |
Files | / | src | / | Assertion |
File | Role | Description | ||
---|---|---|---|---|
RemoteServer (1 file) | ||||
aAssertToken.php | Class | Class source | ||
AssertByInternalServer.php | Class | Class source | ||
AssertByRemoteServer.php | Class | Class source |
Files | / | src | / | Client |
File | Role | Description | ||
---|---|---|---|---|
Command (2 files) | ||||
PlatformRest (1 file) | ||||
aOAuthPlatform.php | Class | Class source | ||
PlatformRest.php | Class | Class source | ||
Response.php | Class | Class source |
Files | / | src | / | Client | / | Command |
File | Role | Description |
---|---|---|
GetAuthorizeUrl.php | Class | Class source |
Token.php | Class | Class source |
Files | / | src | / | Exception |
File | Role | Description |
---|---|---|
exIdentifierExists.php | Class | Class source |
exInvalidRequest.php | Class | Class source |
exMissingGrantRequestParams.php | Class | Class source |
exOAuthAccessDenied.php | Class | Class source |
exOAuthScopeRequired.php | Class | Class source |
exPasswordNotMatch.php | Class | Class source |
exResponseError.php | Class | Class source |
exServerError.php | Class | Class source |
exTokenMismatch.php | Class | Class source |
exUnexpectedValue.php | Class | Class source |
exUserNotFound.php | Class | Class source |
Files | / | src | / | Federation |
File | Role | Description | ||
---|---|---|---|---|
Command (4 files, 3 directories) | ||||
TokenProvider (2 files) | ||||
PlatformRest.php | Class | Class source |
Files | / | src | / | Federation | / | Command |
File | Role | Description | ||
---|---|---|---|---|
Me (3 files) | ||||
Members (3 files) | ||||
Recover (2 files) | ||||
AccountInfo.php | Class | Class source | ||
ListAccountsInfo.php | Class | Class source | ||
Register.php | Class | Class source | ||
tTokenAware.php | Class | Class source |
Files | / | src | / | Federation | / | Command | / | Me |
File | Role | Description |
---|---|---|
AccountInfo.php | Class | Class source |
ChangeIdentity.php | Class | Class source |
ChangePassword.php | Class | Class source |
Files | / | src | / | Federation | / | Command | / | Members |
File | Role | Description |
---|---|---|
Exists.php | Class | Class source |
ValidateUserIdentifier.php | Class | Class source |
Whois.php | Class | Class source |
Files | / | src | / | Federation | / | Command | / | Recover |
File | Role | Description |
---|---|---|
ResendCode.php | Class | Class source |
Validate.php | Class | Class source |
Files | / | src | / | Federation | / | TokenProvider |
File | Role | Description |
---|---|---|
TokenFromOAuthClient.php | Class | Class source |
TokenInstanceFromOAuthClient.php | Class | Class source |
Files | / | src | / | Grant |
File | Role | Description | ||
---|---|---|---|---|
Container (1 file) | ||||
Extension (1 file) | ||||
aGrantRequest.php | Class | Class source | ||
AuthorizeCode.php | Class | Class source | ||
ClientCredential.php | Class | Class source | ||
Implicit.php | Class | Class source | ||
Password.php | Class | Class source | ||
RefreshToken.php | Class | Class source |
Files | / | src | / | Interfaces |
File | Role | Description |
---|---|---|
iAccessTokenEntity.php | Class | Class source |
iClientOfOAuth.php | Class | Class source |
iGrantAuthorizeRequest.php | Class | Class source |
iGrantTokenRequest.php | Class | Class source |
ipGrantRequest.php | Class | Class source |
Download all files: client-oauth2.tar.gz client-oauth2.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|