Compare commits

...
8 Commits
Author SHA1 Message Date
DigitalInfinity ce72d28912 updated readme
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-lowest, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-stable, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-lowest, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-stable, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-lowest, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-stable, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-lowest, 8.*) (push) Has been cancelled
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-stable, 8.*) (push) Has been cancelled
2025-11-11 22:45:47 +00:00
DigitalInfinity f3b226a0fd updated package description 2025-11-11 22:45:40 +00:00
DigitalInfinity 7bbf7f68e4 upgradet to filamentphp 4
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
Fix PHP Code Styling / php-code-styling (push) Has been cancelled
PHPStan / phpstan (push) Has been cancelled
2025-11-11 22:28:38 +00:00
DigitalInfinity e663b03c0e remove stubs-handling and directory
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
Fix PHP Code Styling / php-code-styling (push) Has been cancelled
PHPStan / phpstan (push) Has been cancelled
2025-11-11 21:43:10 +00:00
DigitalInfinity 4a718ce763 updated readme
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
2025-11-11 20:19:13 +01:00
DigitalInfinity d8c8f2d1e0 added config and readme
Fix PHP Code Styling / php-code-styling (push) Waiting to run
PHPStan / phpstan (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, ubuntu-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.1, prefer-stable, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-lowest, 8.*) (push) Waiting to run
run-tests / P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} (2.*, 10.*, windows-latest, 8.2, prefer-stable, 8.*) (push) Waiting to run
2025-11-11 18:36:49 +00:00
DigitalInfinity 883e637c46 made a copy of original readme 2025-11-11 18:36:26 +00:00
DigitalInfinity 4512da5140 Typo in config 2025-11-11 18:25:31 +00:00
8 changed files with 160 additions and 34 deletions

No files matched your search

+76 -17
View File
@@ -5,9 +5,31 @@
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/alexandergabriel/filament-oauth2/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/alexandergabriel/filament-oauth2.svg?style=flat-square)](https://packagist.org/packages/alexandergabriel/filament-oauth2)
> !!!
> This Plugin is still under development and only tested with Keycloak.
> This is my first FilamentPHP-Plugin.
> Did not write any tests, not published to packagist yet...
> Feedback welcome.
> !!!
To be able to install you have to add/change this to/in your composer.json:
```json
{
"minimum-stability": "dev",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/AlexanderGabriel/filament-oauth2"
}
]
}
```
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
This Plugin enables OAuth2-Login for [FilamentPHP](https://filamentphp.com) Panels.
Login and logout is done by OAuth2-Server.
If the OAuth2-Server provides roles for your client, they will be mapped to the App\Models\Role-Model
Non-existing Roles will be created.
Users will be detached to roles not in the access token any more.
## Installation
@@ -17,39 +39,75 @@ You can install the package via composer:
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 [
'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
Load Plugin in your PanelProvider under filament-oauth2-demo/app/Providers/Filament:
```php
$filamentOauth2 = new AlexanderGabriel\FilamentOauth2();
echo $filamentOauth2->echoPhrase('Hello, AlexanderGabriel!');
class YOURPanelProvider extends PanelProvider
{
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
```bash
@@ -70,6 +128,7 @@ Please review [our security policy](../../security/policy) on how to report secu
## Credits
- To all helping developing and keeping alive FilamentPHP, PHP, OAuth2 and the OpenSource Ecosystem!
- [Alexander Gabriel](https://github.com/AlexanderGabriel)
- [All Contributors](../../contributors)
+78
View File
@@ -0,0 +1,78 @@
# This is my package filament-oauth2
[![Latest Version on Packagist](https://img.shields.io/packagist/v/alexandergabriel/filament-oauth2.svg?style=flat-square)](https://packagist.org/packages/alexandergabriel/filament-oauth2)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/alexandergabriel/filament-oauth2/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/alexandergabriel/filament-oauth2/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/alexandergabriel/filament-oauth2/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/alexandergabriel/filament-oauth2.svg?style=flat-square)](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.
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "alexandergabriel/filament-oauth2",
"description": "This is my package filament-oauth2",
"description": "Enable OAuth2 Authentication to FilamentPHP Panels",
"keywords": [
"AlexanderGabriel",
"laravel",
@@ -21,7 +21,7 @@
],
"require": {
"php": "^8.1",
"filament/filament": "^3.0",
"filament/filament": "^4.0",
"league/oauth2-client": "*",
"spatie/laravel-package-tools": "^1.15.0"
},
+1 -3
View File
@@ -3,16 +3,14 @@
// config for AlexanderGabriel/FilamentOauth2
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_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"),
'urlAfterlogout' => env("OAUTH2_URL_AFTER_LOGOUT", url('/')),
'scopes' => env("OAUTH2_SCOPES", "profile email openid"),
'updateRoles' => env("OAUTH2_UPDATE_ROLES", false)
];
+2 -2
View File
@@ -6,7 +6,7 @@ use AlexanderGabriel\FilamentOauth2\Http\Controllers\Oauth2Controller;
use Filament\Facades\Filament;
use Illuminate\Support\Facades\Route;
$panel = Filament::getCurrentPanel();
$panel = Filament::getCurrentOrDefaultPanel();
Route::prefix($panel->getPath())
->middleware($panel->getMiddleware())
@@ -15,7 +15,7 @@ Route::prefix($panel->getPath())
Route::name('filament-oauth2.')
->prefix('filament-oauth2')
->group(function () {
Route::post('handleLogout', [Oauth2Controller::class, 'handleLogout'])->name('handleLogout');
Route::get('handleLogout', [Oauth2Controller::class, 'handleLogout'])->name('handleLogout');
Route::get('redirectToOauth2Server', [Oauth2Controller::class, 'redirectToOauth2Server'])
->name('redirectToOauth2Server');
Route::get('handleCallback', [Oauth2Controller::class, 'handleCallback'])
-9
View File
@@ -51,15 +51,6 @@ class FilamentOauth2ServiceProvider extends PackageServiceProvider
public function packageBooted(): void
{
// Handle Stubs
if (app()->runningInConsole()) {
foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) {
$this->publishes([
$file->getRealPath() => base_path("stubs/filament-oauth2/{$file->getFilename()}"),
], 'filament-oauth2-stubs');
}
}
// Testing
Testable::mixin(new TestsFilamentOauth2);
}
+1 -1
View File
@@ -7,8 +7,8 @@ use App\Models\Role;
use App\Models\User;
use Illuminate\Validation\ValidationException;
use Exception;
use Filament\Auth\Http\Responses\LoginResponse;
use Filament\Facades\Filament;
use Filament\Http\Responses\Auth\LoginResponse;
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
View File
Whitespace-only changes.