Skip to content

Commit

Permalink
📖
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed May 19, 2024
1 parent d1040b0 commit bac3df2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# chillerlan/php-oauth

A transparent, framework-agnostic, easily extensible PHP [PSR-18](https://www.php-fig.org/psr/psr-18/) OAuth 1/2 client with a user-friendly API, fully [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.org/psr/psr-17/) compatible.
A transparent, framework-agnostic, easily extensible PHP [PSR-18](https://www.php-fig.org/psr/psr-18/) OAuth client with a user-friendly API, fully [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.org/psr/psr-17/) compatible.


[![PHP Version Support][php-badge]][php]
Expand Down Expand Up @@ -35,20 +35,20 @@ A transparent, framework-agnostic, easily extensible PHP [PSR-18](https://www.ph
## Features

- OAuth client capabilities
- [OAuth 1.0a](https://oauth.net/core/1.0a/)
- [OAuth 2.0](https://oauth.net/2/)
- [Authorization Code Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1)
- [Client Credentials Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)
- [Token refresh](https://datatracker.ietf.org/doc/html/rfc6749#section-1.5)
- [CSRF Token](https://datatracker.ietf.org/doc/html/rfc6749#section-10.12) ("state" parameter)
- [RFC-7009: Token Revocation](https://datatracker.ietf.org/doc/html/rfc7009)
- [RFC-7636: PKCE](https://datatracker.ietf.org/doc/html/rfc7636) (Proof Key for Code Exchange)
- [RFC-9126: PAR](https://datatracker.ietf.org/doc/html/rfc9126) (Pushed Authorization Requests)
- Proprietary, OAuth-like authorization flows (e.g. [Last.fm](https://www.last.fm/api/authentication))
- Invalidation of access tokens (if supported by the provider)
- [OAuth 1.0a](https://oauth.net/core/1.0a/) ([RFC-5849](https://datatracker.ietf.org/doc/html/rfc5849))
- [OAuth 2.0](https://oauth.net/2/) ([RFC-6749](https://datatracker.ietf.org/doc/html/rfc6749))
- [Authorization Code Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1)
- [Client Credentials Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)
- [Token refresh](https://datatracker.ietf.org/doc/html/rfc6749#section-1.5)
- [CSRF Token](https://datatracker.ietf.org/doc/html/rfc6749#section-10.12) ("state" parameter)
- [RFC-7009: Token Revocation](https://datatracker.ietf.org/doc/html/rfc7009)
- [RFC-7636: PKCE](https://datatracker.ietf.org/doc/html/rfc7636) (Proof Key for Code Exchange)
- [RFC-9126: PAR](https://datatracker.ietf.org/doc/html/rfc9126) (Pushed Authorization Requests)
- Proprietary, OAuth-like authorization flows (e.g. [Last.fm](https://www.last.fm/api/authentication))
- Invalidation of access tokens (if supported by the provider)
- Several built-in provider implementations ([see below](#implemented-providers))
- Provider instances act as [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client, wrapping the given PSR-18 HTTP instance
- Requests to the provider API will have required OAuth headers and tokens added automatically
- Provider instances act as [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP client, wrapping the given PSR-18 HTTP instance
- Requests to the provider API will have required OAuth headers and tokens added automatically
- Optional token encryption via [`sodium_crypto_secretbox()`](https://www.php.net/manual/en/function.sodium-crypto-secretbox) for the internal storage engines
- A unified user data object `AuthenticatedUser` via the `OAuthInterface::me()` method

Expand All @@ -57,7 +57,7 @@ A transparent, framework-agnostic, easily extensible PHP [PSR-18](https://www.ph

- PHP 8.1+
- extensions: `json`, `sodium`
- from dependencies: `curl`, `fileinfo`, `intl`, `mbstring`, `simplexml`, `zlib`
- from dependencies: `curl`, `fileinfo`, `intl`, `mbstring`, `simplexml`, `zlib`
- a [PSR-18](https://www.php-fig.org/psr/psr-18/) compatible HTTP client library of your choice
- [PSR-17](https://www.php-fig.org/psr/psr-17/) compatible `RequestFactory`, `StreamFactory` and `UriFactory`

Expand Down
2 changes: 1 addition & 1 deletion docs/Basics/Configuration-settings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configuration settings
<!-- This file is auto generated from the source of OAuthOptionsTrait.php -->
<!-- This file is auto generated from the source of OAuthOptions.php -->
## key

The application key (or client-id) given by your provider
Expand Down
4 changes: 2 additions & 2 deletions docs/Basics/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ fully [PSR-7](https://www.php-fig.org/psr/psr-7/)/[PSR-17](https://www.php-fig.o
## Features

- OAuth client capabilities
- [OAuth 1.0a](https://oauth.net/core/1.0a/)
- [OAuth 2.0](https://oauth.net/2/)
- [OAuth 1.0a](https://oauth.net/core/1.0a/) ([RFC-5849](https://datatracker.ietf.org/doc/html/rfc5849))
- [OAuth 2.0](https://oauth.net/2/) ([RFC-6749](https://datatracker.ietf.org/doc/html/rfc6749))
- [Authorization Code Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1)
- [Client Credentials Grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)
- [Token refresh](https://datatracker.ietf.org/doc/html/rfc6749#section-1.5)
Expand Down
2 changes: 1 addition & 1 deletion docs/Development/Create-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The JSON looks similar to the following:
"accessTokenSecret": null,
"accessToken": "<access_token>",
"refreshToken": null,
"expires": -9002,
"expires": -51966,
"extraParams": {
"token_type": "bearer"
},
Expand Down
14 changes: 6 additions & 8 deletions docs/oauth-options-doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
* @license MIT
*/

use chillerlan\OAuth\OAuthOptionsTrait;
use chillerlan\OAuth\OAuthOptions;

require_once __DIR__.'/../vendor/autoload.php';

$file = 'Basics/Configuration-settings.md';
$content = [
'# Configuration settings',
'<!-- This file is auto generated from the source of OAuthOptionsTrait.php -->',
'<!-- This file is auto generated from the source of OAuthOptions.php -->',
];

$reflectionClass = new ReflectionClass(OAuthOptionsTrait::class);
$reflectionClass = new ReflectionClass(OAuthOptions::class);

foreach($reflectionClass->getProperties(ReflectionProperty::IS_PROTECTED) as $reflectionProperty){
$docblock = $reflectionProperty->getDocComment();
Expand Down Expand Up @@ -51,14 +51,14 @@

// collect links for "see also"
if(str_starts_with($line, '@see')){
$see[] = $line;
$see[] = substr($line, 5); // cut off the "@see "

continue;
}

// collect links for "links"
if(str_starts_with($line, '@link')){
$link[] = $line;
$link[] = substr($line, 6); // cut off the "@link "

continue;
}
Expand All @@ -71,7 +71,6 @@
$content[] = "\n**See also:**\n";

foreach($see as $line){
$line = substr($line, 5); // cut off the "@see "

// normal links
if(str_starts_with($line, 'http')){
Expand Down Expand Up @@ -100,7 +99,6 @@
$content[] = "\n**Links:**\n";

foreach($link as $line){
$line = substr($line, 6); // cut off the "@link "

// skip non-url
if(!str_starts_with($line, 'http')){
Expand All @@ -123,6 +121,6 @@

file_put_contents(__DIR__.'/'.$file, implode("\n", $content));

printf('Built "%s" from "%s"', $file, OAuthOptionsTrait::class);
printf('Built "%s" from "%s"', $file, OAuthOptions::class);

exit(0);

0 comments on commit bac3df2

Please sign in to comment.