Skip to content
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

refactor: generalize SSO auth #2263

Merged
merged 5 commits into from
Feb 14, 2024
Merged

refactor: generalize SSO auth #2263

merged 5 commits into from
Feb 14, 2024

Conversation

motorina0
Copy link
Collaborator

@motorina0 motorina0 commented Feb 12, 2024

closes #2212

Summary

See issue #2212 . Prepare to allow more SSO providers (eg: Authentik, Keycloak or Authelia.)

The /auth endpoint now does not explicitly uses google or github. Any number of SSO Providers can be used now.

In order to add a new provider one must:

  1. Implement the ProviderSSO class (eg: KeycloakSSO)
  • this class must be added in the lnbits.core.sso.provider. The full namespace is lnbits.core.sso.provider.ProviderSSO
  • several implementation examples can be found here: https://github.com/tomasvotava/fastapi-sso/tree/master/fastapi_sso/sso
  • ideally the new implementation is accepted by fastapi-sso. Please also open a PR to the above repo (fastapi-sso) with the new implementation.
  1. Create a settings class for the new Provider (eg: KeycloakAuthSettings). See GitHubAuthSettings as an example. Then add this class to EditableSettings.
  • don't forget to update the env.example file
  1. Add the new provider to AuthMethods enum
  2. Update the Login UI with the new auth provider

Copy link

codecov bot commented Feb 12, 2024

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (98338ff) 59.26% compared to head (f171004) 59.29%.
Report is 3 commits behind head on dev.

Files Patch % Lines
lnbits/core/views/auth_api.py 19.14% 38 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2263      +/-   ##
==========================================
+ Coverage   59.26%   59.29%   +0.03%     
==========================================
  Files          60       60              
  Lines        9026     9036      +10     
==========================================
+ Hits         5349     5358       +9     
- Misses       3677     3678       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@motorina0 motorina0 mentioned this pull request Feb 13, 2024
Copy link
Collaborator

@prusnak prusnak left a comment

Choose a reason for hiding this comment

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

utACK

@dni dni merged commit b8d295a into dev Feb 14, 2024
22 checks passed
@dni dni deleted the generalize_sso branch February 14, 2024 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Allow custom OIDC Providers for SSO
3 participants