Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Install plugin dependencies
run: |
cd pelican
composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0"
composer require "stripe/stripe-php:^18.0" "kovah/laravel-socialite-oidc:^0.5" "krymosoftware/gameq:^4.0" "socialiteproviders/pocketid:^5.0"

- name: Setup .env file
run: cp pelican/.env.example pelican/.env
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre
- [Minecraft Modrinth](/minecraft-modrinth) - Download Minecraft mods & plugins from Modrinth
- [PasteFox Share](/pastefox-share) - Share console logs via pastefox.com
- [Player Counter](/player-counter) - Show connected players count for game servers
- [PocketID Provider](/pocketid-provider) - Allows you to use PocketID as an OAuth provider
- [Register](/register) - Enable user self-registration on all panels
- [Robo Avatars](/robo-avatars) - Adds RoboHash as avatar provider
- [Rust uMod](/rust-umod) - Download Rust plugins from uMod
Expand Down
12 changes: 12 additions & 0 deletions pocketid-provider/README.md
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).
17 changes: 17 additions & 0 deletions pocketid-provider/plugin.json
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 pocketid-provider/src/Extensions/OAuth/Schemas/PocketIDSchema.php
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');
}

public function getIcon(): string
{
return 'tabler-id';
}

public function getHexColor(): string
{
return env('OAUTH_POCKETID_DISPLAY_COLOR', '#000000');
}
}
18 changes: 18 additions & 0 deletions pocketid-provider/src/PocketIDProviderPlugin.php
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 pocketid-provider/src/Providers/PocketIDProviderPluginProvider.php
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());
}
}