Compare commits
3 Commits
1a19aee52d
...
d8c8f2d1e0
| Author | SHA1 | Date | |
|---|---|---|---|
| d8c8f2d1e0 | |||
| 883e637c46 | |||
| 4512da5140 |
69
README.md
69
README.md
@ -17,39 +17,74 @@ You can install the package via composer:
|
|||||||
composer require alexandergabriel/filament-oauth2
|
composer require alexandergabriel/filament-oauth2
|
||||||
```
|
```
|
||||||
|
|
||||||
You can publish and run the migrations with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan vendor:publish --tag="filament-oauth2-migrations"
|
|
||||||
php artisan migrate
|
|
||||||
```
|
|
||||||
|
|
||||||
You can publish the config file with:
|
You can publish the config file with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php artisan vendor:publish --tag="filament-oauth2-config"
|
php artisan vendor:publish --tag="filament-oauth2-config"
|
||||||
```
|
|
||||||
|
|
||||||
Optionally, you can publish the views using
|
|
||||||
|
|
||||||
```bash
|
|
||||||
php artisan vendor:publish --tag="filament-oauth2-views"
|
|
||||||
```
|
|
||||||
|
|
||||||
This is the contents of the published config file:
|
This is the contents of the published config file:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
return [
|
return [
|
||||||
|
'clientId' => env("OAUTH2_CLIENT_ID"),
|
||||||
|
'clientSecret' => env("OAUTH2_CLIENT_SECRET"),
|
||||||
|
'baseUrl' => env("OAUTH2_BASE_URL"), // https://DOMAIN/realms/REALM/protocol/openid-connect
|
||||||
|
'urlAuthorize' => env("OAUTH2_URL_AUTHORIZE", env("OAUTH2_BASE_URL")."/auth"),
|
||||||
|
'urlAccessToken' => env("OAUTH2_URL_ACCESS_TOKEN", env("OAUTH2_BASE_URL")."/token"),
|
||||||
|
'urlResourceOwnerDetails' => env("OAUTH2_URL_RESOURCE_OWNER_DETAILS", env("OAUTH2_BASE_URL")."/userinfo"),
|
||||||
|
'urlLogout' => env("OAUTH2_URL_LOGOUT", env("OAUTH2_BASE_URL")."/logout"),
|
||||||
|
'urlAfterlogout' => env("OAUTH2_URL_AFTER_LOGOUT", url('/')),
|
||||||
|
'scopes' => env("OAUTH2_SCOPES", "profile email openid"),
|
||||||
|
'updateRoles' => env("OAUTH2_UPDATE_ROLES", false)
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Load Plugin in your PanelProvider under filament-oauth2-demo/app/Providers/Filament:
|
||||||
```php
|
```php
|
||||||
$filamentOauth2 = new AlexanderGabriel\FilamentOauth2();
|
class YOURPanelProvider extends PanelProvider
|
||||||
echo $filamentOauth2->echoPhrase('Hello, AlexanderGabriel!');
|
{
|
||||||
|
public function panel(Panel $panel): Panel
|
||||||
|
{
|
||||||
|
return $panel
|
||||||
|
->plugin(
|
||||||
|
new FilamentOauth2Plugin()
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### To configure, add some config to your .env:
|
||||||
|
|
||||||
|
- OAUTH2_CLIENT_ID*
|
||||||
|
- OAuth2 client id, mandatory
|
||||||
|
- OAUTH2_CLIENT_SECRET*
|
||||||
|
- OAuth2 client secret, mandatory
|
||||||
|
- OAUTH2_BASE_URL*
|
||||||
|
- Base url to OAuth2 authentication server
|
||||||
|
- must include realm: https://DOMAIN/realms/REALM/protocol/openid-connect
|
||||||
|
- OAUTH2_URL_AUTHORIZE
|
||||||
|
- authorization url
|
||||||
|
- defaults to OAUTH2_BASE_URL+/auth
|
||||||
|
- OAUTH2_URL_ACCESS_TOKEN
|
||||||
|
- token url
|
||||||
|
- defaults to OAUTH2_BASE_URL+/token
|
||||||
|
- OAUTH2_URL_RESOURCE_OWNER_DETAILS
|
||||||
|
- resource owner details url
|
||||||
|
- defaults to OAUTH2_BASE_URL+/userinfo
|
||||||
|
- todo: needed?
|
||||||
|
- OAUTH2_URL_LOGOUT
|
||||||
|
- logout url
|
||||||
|
- defaults to OAUTH2_BASE_URL+/logout
|
||||||
|
- OAUTH2_URL_AFTER_LOGOUT
|
||||||
|
- post_logout_redirect_uri
|
||||||
|
- defaults to base url of Laravel app (without panel)
|
||||||
|
- OAUTH2_SCOPES
|
||||||
|
- scopes
|
||||||
|
- defaults to "profile email openid"
|
||||||
|
- OAUTH2_UPDATE_ROLES
|
||||||
|
- look for roles in token and update/create and map them
|
||||||
|
- defaults to false
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
78
README_original.md
Normal file
78
README_original.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# This is my package filament-oauth2
|
||||||
|
|
||||||
|
[](https://packagist.org/packages/alexandergabriel/filament-oauth2)
|
||||||
|
[](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3Arun-tests+branch%3Amain)
|
||||||
|
[](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
|
||||||
|
[](https://packagist.org/packages/alexandergabriel/filament-oauth2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
You can install the package via composer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer require alexandergabriel/filament-oauth2
|
||||||
|
```
|
||||||
|
|
||||||
|
You can publish and run the migrations with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan vendor:publish --tag="filament-oauth2-migrations"
|
||||||
|
php artisan migrate
|
||||||
|
```
|
||||||
|
|
||||||
|
You can publish the config file with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan vendor:publish --tag="filament-oauth2-config"
|
||||||
|
```
|
||||||
|
|
||||||
|
Optionally, you can publish the views using
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan vendor:publish --tag="filament-oauth2-views"
|
||||||
|
```
|
||||||
|
|
||||||
|
This is the contents of the published config file:
|
||||||
|
|
||||||
|
```php
|
||||||
|
return [
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```php
|
||||||
|
$filamentOauth2 = new AlexanderGabriel\FilamentOauth2();
|
||||||
|
echo $filamentOauth2->echoPhrase('Hello, AlexanderGabriel!');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
composer test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
|
||||||
|
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
|
||||||
|
|
||||||
|
## Security Vulnerabilities
|
||||||
|
|
||||||
|
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- [Alexander Gabriel](https://github.com/AlexanderGabriel)
|
||||||
|
- [All Contributors](../../contributors)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||||
@ -3,16 +3,14 @@
|
|||||||
// config for AlexanderGabriel/FilamentOauth2
|
// config for AlexanderGabriel/FilamentOauth2
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'clientId' => env("OAUTH2_CLIENT_ID"),
|
'clientId' => env("OAUTH2_CLIENT_ID"),
|
||||||
'clientSecret' => env("OAUTH2_CLIENT_SECRET"),
|
'clientSecret' => env("OAUTH2_CLIENT_SECRET"),
|
||||||
'baseUrl' => env("OAUTH2_BASE_URL"), // https://DOMAIN/realms/REALM/protocol/openid-connect
|
'baseUrl' => env("OAUTH2_BASE_URL"), // https://DOMAIN/realms/REALM/protocol/openid-connect
|
||||||
'urlAuthorize' => env("OAUTH2_URL_AUTHORIZE", env("OAUTH2_BASE_URL")."/auth"),
|
'urlAuthorize' => env("OAUTH2_URL_AUTHORIZE", env("OAUTH2_BASE_URL")."/auth"),
|
||||||
'urlAccessToken' => env("OAUTH2_URL_ACCESS_TOKEN", env("OAUTH2_BASE_URL")."/token"),
|
'urlAccessToken' => env("OAUTH2_URL_ACCESS_TOKEN", env("OAUTH2_BASE_URL")."/token"),
|
||||||
'urlResourceOwnerDetails' => env("OAUTH2_URL_RSOURCE_OWNER_DETAILS", env("OAUTH2_BASE_URL")."/userinfo"),
|
'urlResourceOwnerDetails' => env("OAUTH2_URL_RESOURCE_OWNER_DETAILS", env("OAUTH2_BASE_URL")."/userinfo"),
|
||||||
'urlLogout' => env("OAUTH2_URL_LOGOUT", env("OAUTH2_BASE_URL")."/logout"),
|
'urlLogout' => env("OAUTH2_URL_LOGOUT", env("OAUTH2_BASE_URL")."/logout"),
|
||||||
'urlAfterlogout' => env("OAUTH2_URL_AFTER_LOGOUT", url('/')),
|
'urlAfterlogout' => env("OAUTH2_URL_AFTER_LOGOUT", url('/')),
|
||||||
'scopes' => env("OAUTH2_SCOPES", "profile email openid"),
|
'scopes' => env("OAUTH2_SCOPES", "profile email openid"),
|
||||||
'updateRoles' => env("OAUTH2_UPDATE_ROLES", false)
|
'updateRoles' => env("OAUTH2_UPDATE_ROLES", false)
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user