Skip to content

Commit 252721c

Browse files
Add PocketID OAuth Provider Plugin (#75)
* add PocketID provider plugin with OAuth integration * update plugin URL to correct path for PocketID provider * füge composer_packages für die Laravel Socialite OIDC-Abhängigkeit hinzu * entferne hintCopy von der Callback-URL im PocketIDSchema und füge die Provider-Klasse für OAuth-Integration hinzu * entferne überflüssigen Kommentar aus der Provider-Klasse * aktualisiere Abhängigkeiten im Plugin und entferne nicht mehr benötigte Provider-Klasse * aktualisiere Abhängigkeit für socialiteproviders/pocketid auf Version 5.0 * füge socialiteproviders/pocketid Abhängigkeit zu den Plugin-Abhängigkeiten hinzu * füge fehlende neue Zeile am Ende der Datei PocketIDProviderPluginProvider.php hinzu * plugin ordner umbenennen * Update pocketid-provider/plugin.json correct the url to the plugin folder Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update pocketid-provider/README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update pocketid-provider/plugin.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add PocketID Provider to README.md * Update README.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update PocketID Provider plugin and README.md --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent f61a82e commit 252721c

File tree

7 files changed

+160
-1
lines changed

7 files changed

+160
-1
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- name: Install plugin dependencies
5757
run: |
5858
cd pelican
59-
composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0"
59+
composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0" "socialiteproviders/pocketid:^5.0"
6060
6161
- name: Setup .env file
6262
run: cp pelican/.env.example pelican/.env

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre
1717
- [Minecraft Modrinth](/minecraft-modrinth) - Download Minecraft mods & plugins from Modrinth
1818
- [PasteFox Share](/pastefox-share) - Share console logs via pastefox.com
1919
- [Player Counter](/player-counter) - Show connected players count for game servers
20+
- [PocketID Provider](/pocketid-provider) - Allows you to use PocketID as an OAuth provider
2021
- [Register](/register) - Enable user self-registration on all panels
2122
- [Robo Avatars](/robo-avatars) - Adds RoboHash as avatar provider
2223
- [Rust uMod](/rust-umod) - Download Rust plugins from uMod

pocketid-provider/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Pocket ID Provider (by Ebnater)
2+
3+
This plugin allows you to use PocketID as OAuth Provider.
4+
5+
## Features
6+
7+
- Register PocketID as OAuth Provider
8+
- Integrates with the already known OAuth Tab in Pelican Panel Settings
9+
10+
## Credits to devilr33f
11+
12+
I used the `PocketIDSchema.php` file from [devilr33f's pelican-pocketid repository](https://github.com/devilr33f/pelican-pocketid/blob/51292e9d52f31fd185fd1ba5a6d8fd34bf23a42c/patch/PocketIDSchema.php).

pocketid-provider/plugin.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"id": "pocketid-provider",
3+
"name": "PocketID Provider",
4+
"author": "Ebnater",
5+
"version": "1.0.0",
6+
"description": "Allows you to use PocketID as an OAuth provider.",
7+
"category": "plugin",
8+
"url": "https://github.com/pelican-dev/plugins/tree/main/pocketid-provider",
9+
"update_url": null,
10+
"namespace": "Ebnater\\PocketIDProvider",
11+
"class": "PocketIDProviderPlugin",
12+
"panels": null,
13+
"panel_version": null,
14+
"composer_packages": {
15+
"socialiteproviders/pocketid": "^5.0"
16+
}
17+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
namespace Ebnater\PocketIDProvider\Extensions\OAuth\Schemas;
4+
5+
use App\Extensions\OAuth\Schemas\OAuthSchema;
6+
use Filament\Forms\Components\ColorPicker;
7+
use Filament\Forms\Components\TextInput;
8+
use Filament\Infolists\Components\TextEntry;
9+
use Filament\Schemas\Components\Wizard\Step;
10+
use Illuminate\Support\Facades\Blade;
11+
use Illuminate\Support\HtmlString;
12+
use SocialiteProviders\PocketID\Provider;
13+
14+
final class PocketIDSchema extends OAuthSchema
15+
{
16+
public function getId(): string
17+
{
18+
return 'pocketid';
19+
}
20+
21+
public function getSocialiteProvider(): string
22+
{
23+
return Provider::class;
24+
}
25+
26+
public function getServiceConfig(): array
27+
{
28+
return array_merge(parent::getServiceConfig(), [
29+
'base_url' => env('OAUTH_POCKETID_BASE_URL'),
30+
]);
31+
}
32+
33+
public function getSetupSteps(): array
34+
{
35+
return array_merge([
36+
Step::make('Configure Pocket ID Application')
37+
->schema([
38+
TextEntry::make('instructions')
39+
->hiddenLabel()
40+
->state(new HtmlString(Blade::render('
41+
<ol class="list-decimal list-inside space-y-1">
42+
<li>Log in to your Pocket ID instance</li>
43+
<li>Navigate to your application or create a new OAuth application</li>
44+
<li>Copy the <strong>Client ID</strong> and <strong>Client Secret</strong> from your Pocket ID application</li>
45+
<li>Configure the redirect URL shown below in your Pocket ID application settings</li>
46+
</ol>
47+
'))),
48+
TextInput::make('_noenv_callback')
49+
->label('Callback URL')
50+
->dehydrated()
51+
->disabled()
52+
->default(fn () => url('/auth/oauth/callback/pocketid')),
53+
]),
54+
], parent::getSetupSteps());
55+
}
56+
57+
public function getSettingsForm(): array
58+
{
59+
return array_merge(parent::getSettingsForm(), [
60+
TextInput::make('OAUTH_POCKETID_BASE_URL')
61+
->label('Base URL')
62+
->placeholder('https://id.example.com')
63+
->columnSpan(2)
64+
->required()
65+
->url()
66+
->autocomplete(false)
67+
->default(env('OAUTH_POCKETID_BASE_URL')),
68+
TextInput::make('OAUTH_POCKETID_DISPLAY_NAME')
69+
->label('Display Name')
70+
->placeholder('Pocket ID')
71+
->autocomplete(false)
72+
->default(env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID')),
73+
ColorPicker::make('OAUTH_POCKETID_DISPLAY_COLOR')
74+
->label('Display Color')
75+
->placeholder('#000000')
76+
->default(env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000'))
77+
->hex(),
78+
]);
79+
}
80+
81+
public function getName(): string
82+
{
83+
return env('OAUTH_POCKETID_DISPLAY_NAME', 'Pocket ID');
84+
}
85+
86+
public function getIcon(): string
87+
{
88+
return 'tabler-id';
89+
}
90+
91+
public function getHexColor(): string
92+
{
93+
return env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000');
94+
}
95+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Ebnater\PocketIDProvider;
4+
5+
use Filament\Contracts\Plugin;
6+
use Filament\Panel;
7+
8+
class PocketIDProviderPlugin implements Plugin
9+
{
10+
public function getId(): string
11+
{
12+
return 'pocketid-provider';
13+
}
14+
15+
public function register(Panel $panel): void {}
16+
17+
public function boot(Panel $panel): void {}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace Ebnater\PocketIDProvider\Providers;
4+
5+
use App\Extensions\OAuth\OAuthService;
6+
use Ebnater\PocketIDProvider\Extensions\OAuth\Schemas\PocketIDSchema;
7+
use Illuminate\Support\ServiceProvider;
8+
9+
class PocketIDProviderPluginProvider extends ServiceProvider
10+
{
11+
public function boot(): void
12+
{
13+
$service = $this->app->make(OAuthService::class);
14+
$service->register(new PocketIDSchema());
15+
}
16+
}

0 commit comments

Comments
 (0)