Feature: Allow custom redirect_uri for OIDC

This commit is contained in:
voc0der 2025-01-29 13:10:38 -05:00
parent 79956d6a7b
commit 1437b10252
3 changed files with 9 additions and 2 deletions

View File

@ -581,6 +581,12 @@ system. See the corresponding
Defaults to 'https'
#### [`PAPERLESS_OIDC_REDIRECT_URI=<string>`](#PAPERLESS_OIDC_REDIRECT_URI) {#PAPERLESS_OIDC_REDIRECT_URI}
: The redirect URI which will be passed to the OAuth callback.
: Defaults to ''.
#### [`PAPERLESS_ACCOUNT_EMAIL_VERIFICATION=<string>`](#PAPERLESS_ACCOUNT_EMAIL_VERIFICATION) {#PAPERLESS_ACCOUNT_EMAIL_VERIFICATION}
: Determines whether email addresses are verified during signup (as performed by Django allauth). See the relevant

View File

@ -77,8 +77,7 @@ class CustomSocialAccountAdapter(DefaultSocialAccountAdapter):
Returns the default URL to redirect to after successfully
connecting a social account.
"""
url = reverse("base")
return url
return getattr(settings, 'OIDC_REDIRECT_URI', '') or reverse("base")
def populate_user(self, request, sociallogin, data):
"""

View File

@ -457,6 +457,8 @@ ACCOUNT_DEFAULT_HTTP_PROTOCOL = os.getenv(
"https",
)
OIDC_REDIRECT_URI: Final[str] = os.getenv("PAPERLESS_OIDC_REDIRECT_URI", "")
ACCOUNT_ADAPTER = "paperless.adapter.CustomAccountAdapter"
ACCOUNT_ALLOW_SIGNUPS = __get_boolean("PAPERLESS_ACCOUNT_ALLOW_SIGNUPS")