ehough / coauthor
由ehough/shortstop支持的OAuth客户端
此包的规范存储库似乎已消失,因此该包已被冻结。
v1.0.0
2013-08-27 20:35 UTC
Requires
- php: >=5.2.0
- ehough/shortstop: ~2.0.0
Requires (Dev)
- ehough/mockery: ~0.8
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2019-02-27 11:08:49 UTC
README
此库不再维护。为ehough/shortstop
集成设计的OAuth库。
特性
- 尽可能遵守RFC 5849
- 出色的测试覆盖率
- 仅支持OAuth 1.x - 目前
示例用法
//instance of ehough_shortstop_api_HttpClientInterface $httpClient = ... //instance of ehough_coauthor_spi_v1_TemporaryCredentialsStorageInterface $credentialsStorage = new ehough_coauthor_impl_v1_SessionCredentialsStorage(); //instance of ehough_coauthor_spi_v1_SignerInterface $signer = new ehough_coauthor_impl_v1_Signer(); //instance of ehough_coauthor_spi_v1_RemoteCredentialsFetcherInterface $credentialsFetcher = new ehough_coauthor_impl_v1_DefaultRemoteCredentialsFetcher($httpClient, $signer); //instance of ehough_coauthor_api_v1_ClientInterface $client = new ehough_coauthor_impl_v1_DefaultV1Client($credentialsFetcher, $credentialsStorage, $signer); //build client credentials $clientCredentials = new ehough_coauthor_api_v1_Credentials('identifier', 'secret'); //will fetch and store temporary credentials in a PHP session, then redirect to the given URL $client->commenceNewAuthorization($server, 'http://something.com/oauth/fetchTokens.php', $clientCredentials); OR //will fetch new token/access credentials $token = $client->fetchTokenCredentials($server, 'credentials-id', 'verification-code', $clientCredentials); OR //will sign a single HTTP request, with the optional $token credentials $client->sign($request, $clientCredentials, $token);