Skip to content

Conversation

@lusu007
Copy link

@lusu007 lusu007 commented Dec 17, 2025

Add Generic OIDC Provider Support

Adds support for generic OpenID Connect (OIDC) providers, enabling integration with Keycloak, Auth0, Okta, and other OIDC-compatible identity providers.

Changes:

  • Added kovah/laravel-socialite-oidc package
  • Created GenericOidcSchema class
  • Registered provider in OAuthServiceProvider

Note: This is my first PHP contribution. Feedback and suggestions are welcome!

Copilot AI review requested due to automatic review settings December 17, 2025 19:20
@github-actions
Copy link
Contributor

github-actions bot commented Dec 17, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds OpenID Connect (OIDC) support by introducing a new GenericOidcSchema class, registering it in the OAuth service provider, and adding the kovah/laravel-socialite-oidc dependency.

Changes

Cohort / File(s) Summary
OIDC Schema Implementation
app/Extensions/OAuth/Schemas/GenericOidcSchema.php
New public class GenericOidcSchema extending OAuthSchema providing: id oidc, Socialite provider mapping, service config (base_url + optional realm), setup wizard step with UI/instructions, settings form fields (base URL, realm, display name, display color), name/color/icon helpers.
OAuth Service Registration
app/Providers/Extensions/OAuthServiceProvider.php
Imports and registers GenericOidcSchema in the OAuth provider registration flow.
Dependency Management
composer.json
Adds runtime dependency kovah/laravel-socialite-oidc (^0.5) to require.

Possibly related PRs

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a generic OIDC schema to the OAuth extension.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose, changes made, and acknowledging it's the contributor's first PHP contribution.

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6746ecc and b9bf8f3.

⛔ Files ignored due to path filters (2)
  • composer.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • app/Extensions/OAuth/Schemas/GenericOidcSchema.php (1 hunks)
  • app/Providers/Extensions/OAuthServiceProvider.php (2 hunks)
  • composer.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composer.json
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Boy132
Repo: pelican-dev/panel PR: 1599
File: app/Http/Controllers/Auth/OAuthController.php:35-35
Timestamp: 2025-08-12T08:29:30.131Z
Learning: GitLab is a built-in OAuth provider in Laravel Socialite and does not require custom provider registration via getSocialiteProvider() method override in GitlabSchema.
📚 Learning: 2025-08-12T08:29:30.131Z
Learnt from: Boy132
Repo: pelican-dev/panel PR: 1599
File: app/Http/Controllers/Auth/OAuthController.php:35-35
Timestamp: 2025-08-12T08:29:30.131Z
Learning: GitLab is a built-in OAuth provider in Laravel Socialite and does not require custom provider registration via getSocialiteProvider() method override in GitlabSchema.

Applied to files:

  • app/Providers/Extensions/OAuthServiceProvider.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Extensions/OAuth/Schemas/GenericOidcSchema.php
🧬 Code graph analysis (1)
app/Providers/Extensions/OAuthServiceProvider.php (2)
app/Extensions/OAuth/Schemas/GenericOidcSchema.php (1)
  • GenericOidcSchema (13-107)
app/Extensions/OAuth/OAuthService.php (1)
  • register (34-47)
🔇 Additional comments (8)
app/Providers/Extensions/OAuthServiceProvider.php (1)

10-10: Clarify architectural approach: core vs. plugin.

Based on PR comments, a plugin for generic OIDC providers already exists in the pelican-dev/plugins repository (referenced in discussion #2010). Adding this functionality to core may duplicate the plugin and bypass the intended plugin architecture.

Before proceeding, please clarify:

  • What is the intended relationship between core OAuth providers and the plugin system?
  • Should generic OIDC support remain a plugin, or is there a specific reason to move it to core?
  • If both exist, how should users choose between them?

[scratchpad_end] -->

Also applies to: 42-43

app/Extensions/OAuth/Schemas/GenericOidcSchema.php (7)

15-18: LGTM!

The provider ID is correctly set to 'oidc' and follows the pattern of other OAuth schemas.


25-37: LGTM!

The service configuration correctly merges parent config with OIDC-specific settings. The conditional inclusion of the realm parameter is appropriate for providers like Keycloak that support it.


60-91: LGTM!

The settings form is well-structured with appropriate validation, helper text, and default values. The inclusion of both OIDC-specific fields (base_url, realm) and customization options (display name, color) provides good flexibility.


93-96: LGTM!

The display name correctly uses the environment variable with a sensible default.


98-101: LGTM!

The color configuration correctly uses the environment variable with a sensible default blue color.


103-106: LGTM!

The 'tabler-key' icon is an appropriate choice for an authentication provider.


20-23: The implementation is correct. The kovah/laravel-socialite-oidc package (v0.5.0) supports Laravel 9, 10, 11, and 12, and requires socialiteproviders/manager ^4.0. Your repository uses Laravel 12.37 with Socialite 5.23, which are compatible with the package version ^0.5 specified in composer.json.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d1e7f5 and 6746ecc.

⛔ Files ignored due to path filters (2)
  • composer.lock is excluded by !**/*.lock
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • app/Extensions/OAuth/Schemas/GenericOidcSchema.php (1 hunks)
  • app/Providers/Extensions/OAuthServiceProvider.php (2 hunks)
  • composer.json (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-12T08:29:30.131Z
Learnt from: Boy132
Repo: pelican-dev/panel PR: 1599
File: app/Http/Controllers/Auth/OAuthController.php:35-35
Timestamp: 2025-08-12T08:29:30.131Z
Learning: GitLab is a built-in OAuth provider in Laravel Socialite and does not require custom provider registration via getSocialiteProvider() method override in GitlabSchema.

Applied to files:

  • app/Providers/Extensions/OAuthServiceProvider.php
📚 Learning: 2025-10-15T11:55:53.461Z
Learnt from: rmartinoscar
Repo: pelican-dev/panel PR: 1801
File: app/Extensions/OAuth/Schemas/AuthentikSchema.php:7-10
Timestamp: 2025-10-15T11:55:53.461Z
Learning: In Filament v4, Wizard Step components use the Filament\Schemas namespace (Filament\Schemas\Components\Wizard\Step), not Filament\Forms.

Applied to files:

  • app/Extensions/OAuth/Schemas/GenericOidcSchema.php
🧬 Code graph analysis (2)
app/Providers/Extensions/OAuthServiceProvider.php (2)
app/Extensions/OAuth/Schemas/GenericOidcSchema.php (1)
  • GenericOidcSchema (13-107)
app/Extensions/OAuth/OAuthService.php (1)
  • register (34-47)
app/Extensions/OAuth/Schemas/GenericOidcSchema.php (1)
app/Extensions/OAuth/Schemas/OAuthSchema.php (1)
  • OAuthSchema (13-137)
🔇 Additional comments (6)
app/Providers/Extensions/OAuthServiceProvider.php (1)

10-10: LGTM!

The import and registration follow the established patterns in this file. The descriptive comment appropriately categorizes this as a distinct provider type.

Also applies to: 42-44

app/Extensions/OAuth/Schemas/GenericOidcSchema.php (4)

13-23: LGTM!

The class structure correctly extends OAuthSchema and properly overrides getSocialiteProvider() to return the OIDC provider class. The final modifier is appropriate for this concrete implementation.


25-37: LGTM!

The service configuration correctly merges the parent config (providing client_id and client_secret) with OIDC-specific settings. The conditional realm handling is clean.


60-91: LGTM!

The settings form correctly extends the parent form with OIDC-specific fields. The URL validation on the base URL and the hex validation on the color picker are appropriate safeguards.


93-106: LGTM!

The display methods provide sensible defaults and align with the pattern established by other OAuth schemas.

composer.json (1)

35-35: Package verified on Packagist with version 0.5.0 available.

The kovah/laravel-socialite-oidc package exists and version 0.5.0 is the latest stable release available. The version constraint ^0.5 is valid.

Comment on lines +47 to +52
TextInput::make('_noenv_callback')
->label('Callback URL')
->dehydrated()
->disabled()
->hintCopy()
->default(fn () => url('/auth/oauth/callback/oidc')),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use dehydrated(false) for display-only callback URL field.

The _noenv_callback field is disabled and used only for display purposes. Using ->dehydrated() (which defaults to true) means it may still be included in form submissions. For a read-only display field, use ->dehydrated(false) to prevent it from being processed.

                     TextInput::make('_noenv_callback')
                         ->label('Callback URL')
-                        ->dehydrated()
+                        ->dehydrated(false)
                         ->disabled()
                         ->hintCopy()
                         ->default(fn () => url('/auth/oauth/callback/oidc')),
🤖 Prompt for AI Agents
In app/Extensions/OAuth/Schemas/GenericOidcSchema.php around lines 47 to 52, the
TextInput for '_noenv_callback' is currently using ->dehydrated() which leaves
it included in form submissions; change this to ->dehydrated(false) so the
disabled/read-only callback URL is not dehydrated or processed on submit,
keeping the field display-only.

@lusu007
Copy link
Author

lusu007 commented Dec 17, 2025

I have read the CLA Document and I hereby sign the CLA

@lusu007
Copy link
Author

lusu007 commented Dec 17, 2025

Recheck

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds generic OpenID Connect (OIDC) provider support to enable integration with Keycloak, Auth0, Okta, and other OIDC-compatible identity providers. This is the author's first PHP contribution to the project.

Key changes:

  • Added kovah/laravel-socialite-oidc package dependency
  • Created GenericOidcSchema class implementing OIDC authentication flow
  • Registered the new provider in OAuthServiceProvider

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
composer.json Added kovah/laravel-socialite-oidc package dependency
composer.lock Updated dependencies including the new OIDC package and several other packages
yarn.lock Complete rewrite from Yarn v1 to Yarn v2+ format (berry)
app/Extensions/OAuth/Schemas/GenericOidcSchema.php New schema class implementing generic OIDC provider support with configuration UI
app/Providers/Extensions/OAuthServiceProvider.php Registered the new GenericOidcSchema provider

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

->schema([
TextEntry::make('setup_instructions')
->hiddenLabel()
->state(new HtmlString(Blade::render('<p>Configure your OIDC provider (e.g., Keycloak, Auth0, Okta) with the following settings:</p><ul><li>Create an OAuth2/OpenID Connect application</li><li>Set the <b>Redirect URI</b> to the value below</li><li>Copy the <b>Client ID</b> and <b>Client Secret</b> for use in the configuration step</li></ul>'))),
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setup instructions HTML string is too long and hard to maintain inline. Consider extracting this to a Blade component or view file for better readability and maintainability.

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +59
->state(new HtmlString('<p><b>For Keycloak:</b> The Base URL should point to your realm (e.g., <code>https://keycloak.example.com/realms/my-realm</code>). Optionally, you can specify the realm name separately.</p>')),
]),
], parent::getSetupSteps());
}

Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Keycloak note HTML string is also quite long. Consider extracting this to a separate view or using a more structured approach with Blade components for better maintainability.

Suggested change
->state(new HtmlString('<p><b>For Keycloak:</b> The Base URL should point to your realm (e.g., <code>https://keycloak.example.com/realms/my-realm</code>). Optionally, you can specify the realm name separately.</p>')),
]),
], parent::getSetupSteps());
}
->state($this->getKeycloakNoteHtml()),
]),
], parent::getSetupSteps());
}
private function getKeycloakNoteHtml(): HtmlString
{
return new HtmlString(<<<'HTML'
<p><b>For Keycloak:</b> The Base URL should point to your realm (e.g., <code>https://keycloak.example.com/realms/my-realm</code>). Optionally, you can specify the realm name separately.</p>
HTML
);
}

Copilot uses AI. Check for mistakes.
@notAreYouScared
Copy link
Member

notAreYouScared commented Dec 17, 2025

We have a plugin for this already.
Once plugins are released, it will be available to install.

https://github.com/pelican-dev/plugins/tree/main/generic-oidc-providers

Note: this was discussed here aswell #2010

@Boy132 Boy132 closed this Dec 17, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2025
@lusu007 lusu007 deleted the feat/generic-oidc branch December 17, 2025 19:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants