-
Notifications
You must be signed in to change notification settings - Fork 23
Add PocketID OAuth Provider Plugin #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5489e98
add PocketID provider plugin with OAuth integration
Ebnater 1cf728d
update plugin URL to correct path for PocketID provider
Ebnater 1342561
füge composer_packages für die Laravel Socialite OIDC-Abhängigkeit hinzu
Ebnater 748e923
entferne hintCopy von der Callback-URL im PocketIDSchema und füge die…
Ebnater 76b789f
entferne überflüssigen Kommentar aus der Provider-Klasse
Ebnater 3d6466d
aktualisiere Abhängigkeiten im Plugin und entferne nicht mehr benötig…
Ebnater 9a7e859
aktualisiere Abhängigkeit für socialiteproviders/pocketid auf Version…
Ebnater 3438b15
füge socialiteproviders/pocketid Abhängigkeit zu den Plugin-Abhängigk…
Ebnater 9904b37
füge fehlende neue Zeile am Ende der Datei PocketIDProviderPluginProv…
Ebnater a4bae19
plugin ordner umbenennen
Ebnater a80ff04
Update pocketid-provider/plugin.json
Ebnater c799587
Update pocketid-provider/README.md
Ebnater c5dbb2e
Update pocketid-provider/plugin.json
Ebnater 12e8214
Add PocketID Provider to README.md
Ebnater c2b6183
Update README.md
Ebnater 680ae0d
Update PocketID Provider plugin and README.md
Ebnater File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Pocket ID Provider (by Ebnater) | ||
|
|
||
| This plugin allows you to use PocketID as OAuth Provider. | ||
|
|
||
| ## Features | ||
|
|
||
| - Register PocketID as OAuth Provider | ||
| - Integrates with the already known OAuth Tab in Pelican Panel Settings | ||
|
|
||
| ## Credits to devilr33f | ||
|
|
||
| I used the `PocketIDSchema.php` file from [devilr33f's pelican-pocketid repository](https://github.com/devilr33f/pelican-pocketid/blob/51292e9d52f31fd185fd1ba5a6d8fd34bf23a42c/patch/PocketIDSchema.php). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "id": "pocketid-provider", | ||
| "name": "PocketID Provider", | ||
| "author": "Ebnater", | ||
| "version": "1.0.0", | ||
| "description": "Allows you to use PocketID as an OAuth provider.", | ||
| "category": "plugin", | ||
| "url": "https://github.com/pelican-dev/plugins/tree/main/pocketid-provider", | ||
| "update_url": null, | ||
| "namespace": "Ebnater\\PocketIDProvider", | ||
| "class": "PocketIDProviderPlugin", | ||
| "panels": null, | ||
| "panel_version": null, | ||
| "composer_packages": { | ||
| "socialiteproviders/pocketid": "^5.0" | ||
| } | ||
| } |
95 changes: 95 additions & 0 deletions
95
pocketid-provider/src/Extensions/OAuth/Schemas/PocketIDSchema.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| <?php | ||
|
|
||
| namespace Ebnater\PocketIDProvider\Extensions\OAuth\Schemas; | ||
|
|
||
| use App\Extensions\OAuth\Schemas\OAuthSchema; | ||
| use Filament\Forms\Components\ColorPicker; | ||
| use Filament\Forms\Components\TextInput; | ||
| use Filament\Infolists\Components\TextEntry; | ||
| use Filament\Schemas\Components\Wizard\Step; | ||
| use Illuminate\Support\Facades\Blade; | ||
| use Illuminate\Support\HtmlString; | ||
| use SocialiteProviders\PocketID\Provider; | ||
|
|
||
| final class PocketIDSchema extends OAuthSchema | ||
| { | ||
| public function getId(): string | ||
| { | ||
| return 'pocketid'; | ||
| } | ||
|
|
||
| public function getSocialiteProvider(): string | ||
| { | ||
| return Provider::class; | ||
| } | ||
|
|
||
| public function getServiceConfig(): array | ||
| { | ||
| return array_merge(parent::getServiceConfig(), [ | ||
| 'base_url' => env('OAUTH_POCKETID_BASE_URL'), | ||
| ]); | ||
| } | ||
|
|
||
| public function getSetupSteps(): array | ||
| { | ||
| return array_merge([ | ||
| Step::make('Configure Pocket ID Application') | ||
| ->schema([ | ||
| TextEntry::make('instructions') | ||
| ->hiddenLabel() | ||
| ->state(new HtmlString(Blade::render(' | ||
| <ol class="list-decimal list-inside space-y-1"> | ||
| <li>Log in to your Pocket ID instance</li> | ||
| <li>Navigate to your application or create a new OAuth application</li> | ||
| <li>Copy the <strong>Client ID</strong> and <strong>Client Secret</strong> from your Pocket ID application</li> | ||
| <li>Configure the redirect URL shown below in your Pocket ID application settings</li> | ||
| </ol> | ||
| '))), | ||
| TextInput::make('_noenv_callback') | ||
| ->label('Callback URL') | ||
| ->dehydrated() | ||
| ->disabled() | ||
| ->default(fn () => url('/auth/oauth/callback/pocketid')), | ||
| ]), | ||
| ], parent::getSetupSteps()); | ||
| } | ||
|
|
||
| public function getSettingsForm(): array | ||
| { | ||
| return array_merge(parent::getSettingsForm(), [ | ||
| TextInput::make('OAUTH_POCKETID_BASE_URL') | ||
| ->label('Base URL') | ||
| ->placeholder('https://id.example.com') | ||
| ->columnSpan(2) | ||
| ->required() | ||
| ->url() | ||
| ->autocomplete(false) | ||
| ->default(env('OAUTH_POCKETID_BASE_URL')), | ||
| TextInput::make('OAUTH_POCKETID_DISPLAY_NAME') | ||
| ->label('Display Name') | ||
| ->placeholder('Pocket ID') | ||
| ->autocomplete(false) | ||
| ->default(env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID')), | ||
| ColorPicker::make('OAUTH_POCKETID_DISPLAY_COLOR') | ||
| ->label('Display Color') | ||
| ->placeholder('#000000') | ||
| ->default(env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000')) | ||
| ->hex(), | ||
| ]); | ||
| } | ||
|
|
||
| public function getName(): string | ||
| { | ||
| return env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID'); | ||
| } | ||
Ebnater marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public function getIcon(): string | ||
| { | ||
| return 'tabler-id'; | ||
| } | ||
|
|
||
| public function getHexColor(): string | ||
| { | ||
| return env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000'); | ||
| } | ||
Ebnater marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace Ebnater\PocketIDProvider; | ||
|
|
||
| use Filament\Contracts\Plugin; | ||
| use Filament\Panel; | ||
|
|
||
| class PocketIDProviderPlugin implements Plugin | ||
| { | ||
| public function getId(): string | ||
| { | ||
| return 'pocketid-provider'; | ||
| } | ||
|
|
||
| public function register(Panel $panel): void {} | ||
|
|
||
| public function boot(Panel $panel): void {} | ||
| } |
16 changes: 16 additions & 0 deletions
16
pocketid-provider/src/Providers/PocketIDProviderPluginProvider.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?php | ||
|
|
||
| namespace Ebnater\PocketIDProvider\Providers; | ||
|
|
||
| use App\Extensions\OAuth\OAuthService; | ||
| use Ebnater\PocketIDProvider\Extensions\OAuth\Schemas\PocketIDSchema; | ||
| use Illuminate\Support\ServiceProvider; | ||
|
|
||
| class PocketIDProviderPluginProvider extends ServiceProvider | ||
| { | ||
| public function boot(): void | ||
| { | ||
| $service = $this->app->make(OAuthService::class); | ||
| $service->register(new PocketIDSchema()); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.