sources/oauth: save null instead of empty string for sources without configurable URLs
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
a0cd17a257
commit
52abd959eb
|
@ -60,9 +60,9 @@ class BaseOAuthClient:
|
|||
args.update(additional)
|
||||
params = urlencode(args)
|
||||
LOGGER.info("redirect args", **args)
|
||||
base_url = self.source.authorization_url
|
||||
if not self.source.type.urls_customizable:
|
||||
base_url = self.source.type.authorization_url
|
||||
base_url = self.source.type.authorization_url
|
||||
if self.source.authorization_url:
|
||||
base_url = self.source.authorization_url
|
||||
if base_url == "":
|
||||
Event.new(
|
||||
EventAction.CONFIGURATION_ERROR,
|
||||
|
|
|
@ -28,9 +28,9 @@ class OAuthClient(BaseOAuthClient):
|
|||
if raw_token is not None and verifier is not None:
|
||||
token = self.parse_raw_token(raw_token)
|
||||
try:
|
||||
access_token_url: str = self.source.access_token_url
|
||||
if not self.source.type.urls_customizable:
|
||||
access_token_url = self.source.type.access_token_url or ""
|
||||
access_token_url: str = self.source.type.access_token_url or ""
|
||||
if self.source.access_token_url:
|
||||
access_token_url = self.source.access_token_url
|
||||
response = self.do_request(
|
||||
"post",
|
||||
access_token_url,
|
||||
|
@ -51,9 +51,9 @@ class OAuthClient(BaseOAuthClient):
|
|||
"Fetch the OAuth request token. Only required for OAuth 1.0."
|
||||
callback = self.request.build_absolute_uri(self.callback)
|
||||
try:
|
||||
request_token_url: str = self.source.request_token_url
|
||||
if not self.source.type.urls_customizable:
|
||||
request_token_url = self.source.type.request_token_url or ""
|
||||
request_token_url: str = self.source.type.request_token_url or ""
|
||||
if self.source.request_token_url:
|
||||
request_token_url = self.source.request_token_url
|
||||
response = self.do_request(
|
||||
"post",
|
||||
request_token_url,
|
||||
|
|
|
@ -56,9 +56,9 @@ class OAuth2Client(BaseOAuthClient):
|
|||
LOGGER.warning("No code returned by the source")
|
||||
return None
|
||||
try:
|
||||
access_token_url = self.source.access_token_url
|
||||
if not self.source.type.urls_customizable:
|
||||
access_token_url = self.source.type.access_token_url or ""
|
||||
access_token_url = self.source.type.access_token_url or ""
|
||||
if self.source.access_token_url:
|
||||
access_token_url = self.source.access_token_url
|
||||
response = self.session.request(
|
||||
"post",
|
||||
access_token_url,
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# Generated by Django 3.2 on 2021-04-17 19:00
|
||||
from django.apps.registry import Apps
|
||||
from django.db import migrations, models
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
|
||||
|
||||
def update_empty_urls(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
|
||||
OAuthSource = apps.get_model("authentik_sources_oauth", "oauthsource")
|
||||
|
||||
db_alias = schema_editor.connection.alias
|
||||
|
||||
for source in OAuthSource.objects.using(db_alias).all():
|
||||
changed = False
|
||||
if source.access_token_url == "":
|
||||
source.access_token_url = None
|
||||
changed = True
|
||||
if source.authorization_url == "":
|
||||
source.authorization_url = None
|
||||
changed = True
|
||||
if source.profile_url == "":
|
||||
source.profile_url = None
|
||||
changed = True
|
||||
if source.request_token_url == "":
|
||||
source.request_token_url = None
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
source.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("authentik_sources_oauth", "0003_auto_20210416_0726"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="oauthsource",
|
||||
name="access_token_url",
|
||||
field=models.CharField(
|
||||
help_text="URL used by authentik to retrive tokens.",
|
||||
max_length=255,
|
||||
null=True,
|
||||
verbose_name="Access Token URL",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="oauthsource",
|
||||
name="authorization_url",
|
||||
field=models.CharField(
|
||||
help_text="URL the user is redirect to to conest the flow.",
|
||||
max_length=255,
|
||||
null=True,
|
||||
verbose_name="Authorization URL",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="oauthsource",
|
||||
name="profile_url",
|
||||
field=models.CharField(
|
||||
help_text="URL used by authentik to get user information.",
|
||||
max_length=255,
|
||||
null=True,
|
||||
verbose_name="Profile URL",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="oauthsource",
|
||||
name="request_token_url",
|
||||
field=models.CharField(
|
||||
help_text="URL used to request the initial token. This URL is only required for OAuth 1.",
|
||||
max_length=255,
|
||||
null=True,
|
||||
verbose_name="Request Token URL",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(update_empty_urls),
|
||||
]
|
|
@ -19,7 +19,7 @@ class OAuthSource(Source):
|
|||
|
||||
provider_type = models.CharField(max_length=255)
|
||||
request_token_url = models.CharField(
|
||||
blank=True,
|
||||
null=True,
|
||||
max_length=255,
|
||||
verbose_name=_("Request Token URL"),
|
||||
help_text=_(
|
||||
|
@ -28,19 +28,19 @@ class OAuthSource(Source):
|
|||
)
|
||||
authorization_url = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("Authorization URL"),
|
||||
help_text=_("URL the user is redirect to to conest the flow."),
|
||||
)
|
||||
access_token_url = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("Access Token URL"),
|
||||
help_text=_("URL used by authentik to retrive tokens."),
|
||||
)
|
||||
profile_url = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("Profile URL"),
|
||||
help_text=_("URL used by authentik to get user information."),
|
||||
)
|
||||
|
|
|
@ -17034,21 +17034,29 @@ definitions:
|
|||
for OAuth 1.
|
||||
type: string
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
x-nullable: true
|
||||
authorization_url:
|
||||
title: Authorization URL
|
||||
description: URL the user is redirect to to conest the flow.
|
||||
type: string
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
x-nullable: true
|
||||
access_token_url:
|
||||
title: Access Token URL
|
||||
description: URL used by authentik to retrive tokens.
|
||||
type: string
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
x-nullable: true
|
||||
profile_url:
|
||||
title: Profile URL
|
||||
description: URL used by authentik to get user information.
|
||||
type: string
|
||||
maxLength: 255
|
||||
minLength: 1
|
||||
x-nullable: true
|
||||
consumer_key:
|
||||
title: Consumer key
|
||||
type: string
|
||||
|
|
|
@ -68,7 +68,7 @@ msgstr "API request failed"
|
|||
msgid "Access Key"
|
||||
msgstr "Access Key"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:72
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:73
|
||||
msgid "Access token URL"
|
||||
msgstr "Access token URL"
|
||||
|
||||
|
@ -274,7 +274,7 @@ msgstr "Audience"
|
|||
msgid "Authentication"
|
||||
msgstr "Authentication"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:175
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:189
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:245
|
||||
msgid "Authentication flow"
|
||||
msgstr "Authentication flow"
|
||||
|
@ -292,7 +292,7 @@ msgstr "Authorization"
|
|||
msgid "Authorization Code"
|
||||
msgstr "Authorization Code"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:65
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:66
|
||||
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:95
|
||||
msgid "Authorization URL"
|
||||
msgstr "Authorization URL"
|
||||
|
@ -649,11 +649,11 @@ msgstr "Consider Objects matching this filter to be Groups."
|
|||
msgid "Consider Objects matching this filter to be Users."
|
||||
msgstr "Consider Objects matching this filter to be Users."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:124
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:126
|
||||
msgid "Consumer key"
|
||||
msgstr "Consumer key"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:130
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:132
|
||||
msgid "Consumer secret"
|
||||
msgstr "Consumer secret"
|
||||
|
||||
|
@ -1107,7 +1107,7 @@ msgstr "Enable TOTP"
|
|||
#: src/pages/policies/BoundPoliciesList.ts:37
|
||||
#: src/pages/policies/PolicyBindingForm.ts:198
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:69
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:113
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:115
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:69
|
||||
msgid "Enabled"
|
||||
msgstr "Enabled"
|
||||
|
@ -1116,7 +1116,7 @@ msgstr "Enabled"
|
|||
msgid "Enrollment"
|
||||
msgstr "Enrollment"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:196
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:210
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:266
|
||||
#: src/pages/stages/identification/IdentificationStageForm.ts:107
|
||||
msgid "Enrollment flow"
|
||||
|
@ -1328,17 +1328,17 @@ msgstr "Flow"
|
|||
msgid "Flow Overview"
|
||||
msgstr "Flow Overview"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:171
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:185
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:220
|
||||
msgid "Flow settings"
|
||||
msgstr "Flow settings"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:193
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:207
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:263
|
||||
msgid "Flow to use when authenticating existing users."
|
||||
msgstr "Flow to use when authenticating existing users."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:214
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:228
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:284
|
||||
msgid "Flow to use when enrolling new users."
|
||||
msgstr "Flow to use when enrolling new users."
|
||||
|
@ -1718,9 +1718,9 @@ msgstr "Loading"
|
|||
#: src/pages/providers/saml/SAMLProviderImportForm.ts:55
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:164
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:190
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:163
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:191
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:212
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:177
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:205
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:226
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:126
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:240
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:261
|
||||
|
@ -1887,7 +1887,7 @@ msgstr "Monitor"
|
|||
#: src/pages/sources/SourcesListPage.ts:51
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:54
|
||||
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:64
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:98
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:100
|
||||
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:63
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:54
|
||||
#: src/pages/sources/saml/SAMLSourceViewPage.ts:66
|
||||
|
@ -2338,7 +2338,7 @@ msgstr "Private key available?"
|
|||
msgid "Private key, acquired from https://www.google.com/recaptcha/intro/v3.html."
|
||||
msgstr "Private key, acquired from https://www.google.com/recaptcha/intro/v3.html."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:79
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:80
|
||||
msgid "Profile URL"
|
||||
msgstr "Profile URL"
|
||||
|
||||
|
@ -2380,7 +2380,7 @@ msgstr "Property mappings used to user creation."
|
|||
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:81
|
||||
#: src/pages/providers/proxy/ProxyProviderForm.ts:99
|
||||
#: src/pages/providers/saml/SAMLProviderForm.ts:78
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:120
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:122
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:76
|
||||
msgid "Protocol settings"
|
||||
msgstr "Protocol settings"
|
||||
|
@ -2403,7 +2403,7 @@ msgstr "Provider"
|
|||
msgid "Provider Type"
|
||||
msgstr "Provider Type"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:136
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:138
|
||||
msgid "Provider type"
|
||||
msgstr "Provider type"
|
||||
|
||||
|
@ -2529,7 +2529,7 @@ msgstr "Request"
|
|||
msgid "Request has been denied."
|
||||
msgstr "Request has been denied."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:86
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:87
|
||||
msgid "Request token URL"
|
||||
msgstr "Request token URL"
|
||||
|
||||
|
@ -2808,7 +2808,7 @@ msgstr "Skip path regex"
|
|||
#: src/pages/applications/ApplicationListPage.ts:58
|
||||
#: src/pages/flows/FlowForm.ts:94
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:60
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:104
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:106
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:60
|
||||
msgid "Slug"
|
||||
msgstr "Slug"
|
||||
|
@ -3027,7 +3027,7 @@ msgid "Successfully created service-connection."
|
|||
msgstr "Successfully created service-connection."
|
||||
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:47
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:50
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:51
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:47
|
||||
msgid "Successfully created source."
|
||||
msgstr "Successfully created source."
|
||||
|
@ -3163,7 +3163,7 @@ msgid "Successfully updated service-connection."
|
|||
msgstr "Successfully updated service-connection."
|
||||
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:44
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:47
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:48
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:44
|
||||
msgid "Successfully updated source."
|
||||
msgstr "Successfully updated source."
|
||||
|
@ -3425,7 +3425,7 @@ msgstr "UI settings"
|
|||
msgid "UID"
|
||||
msgstr "UID"
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:61
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:62
|
||||
msgid "URL settings"
|
||||
msgstr "URL settings"
|
||||
|
||||
|
@ -3433,19 +3433,19 @@ msgstr "URL settings"
|
|||
msgid "URL that the initial Login request is sent to."
|
||||
msgstr "URL that the initial Login request is sent to."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:69
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:70
|
||||
msgid "URL the user is redirect to to consent the authorization."
|
||||
msgstr "URL the user is redirect to to consent the authorization."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:83
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:84
|
||||
msgid "URL used by authentik to get user information."
|
||||
msgstr "URL used by authentik to get user information."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:76
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:77
|
||||
msgid "URL used by authentik to retrieve tokens."
|
||||
msgstr "URL used by authentik to retrieve tokens."
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:89
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:90
|
||||
msgid "URL used to request the initial token. This URL is only required for OAuth 1."
|
||||
msgstr "URL used to request the initial token. This URL is only required for OAuth 1."
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ msgstr ""
|
|||
msgid "Access Key"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:72
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:73
|
||||
msgid "Access token URL"
|
||||
msgstr ""
|
||||
|
||||
|
@ -270,7 +270,7 @@ msgstr ""
|
|||
msgid "Authentication"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:175
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:189
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:245
|
||||
msgid "Authentication flow"
|
||||
msgstr ""
|
||||
|
@ -288,7 +288,7 @@ msgstr ""
|
|||
msgid "Authorization Code"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:65
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:66
|
||||
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:95
|
||||
msgid "Authorization URL"
|
||||
msgstr ""
|
||||
|
@ -643,11 +643,11 @@ msgstr ""
|
|||
msgid "Consider Objects matching this filter to be Users."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:124
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:126
|
||||
msgid "Consumer key"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:130
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:132
|
||||
msgid "Consumer secret"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1099,7 +1099,7 @@ msgstr ""
|
|||
#: src/pages/policies/BoundPoliciesList.ts:37
|
||||
#: src/pages/policies/PolicyBindingForm.ts:198
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:69
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:113
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:115
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:69
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
@ -1108,7 +1108,7 @@ msgstr ""
|
|||
msgid "Enrollment"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:196
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:210
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:266
|
||||
#: src/pages/stages/identification/IdentificationStageForm.ts:107
|
||||
msgid "Enrollment flow"
|
||||
|
@ -1320,17 +1320,17 @@ msgstr ""
|
|||
msgid "Flow Overview"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:171
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:185
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:220
|
||||
msgid "Flow settings"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:193
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:207
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:263
|
||||
msgid "Flow to use when authenticating existing users."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:214
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:228
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:284
|
||||
msgid "Flow to use when enrolling new users."
|
||||
msgstr ""
|
||||
|
@ -1710,9 +1710,9 @@ msgstr ""
|
|||
#: src/pages/providers/saml/SAMLProviderImportForm.ts:55
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:164
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:190
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:163
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:191
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:212
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:177
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:205
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:226
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:126
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:240
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:261
|
||||
|
@ -1879,7 +1879,7 @@ msgstr ""
|
|||
#: src/pages/sources/SourcesListPage.ts:51
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:54
|
||||
#: src/pages/sources/ldap/LDAPSourceViewPage.ts:64
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:98
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:100
|
||||
#: src/pages/sources/oauth/OAuthSourceViewPage.ts:63
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:54
|
||||
#: src/pages/sources/saml/SAMLSourceViewPage.ts:66
|
||||
|
@ -2330,7 +2330,7 @@ msgstr ""
|
|||
msgid "Private key, acquired from https://www.google.com/recaptcha/intro/v3.html."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:79
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:80
|
||||
msgid "Profile URL"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2372,7 +2372,7 @@ msgstr ""
|
|||
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts:81
|
||||
#: src/pages/providers/proxy/ProxyProviderForm.ts:99
|
||||
#: src/pages/providers/saml/SAMLProviderForm.ts:78
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:120
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:122
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:76
|
||||
msgid "Protocol settings"
|
||||
msgstr ""
|
||||
|
@ -2395,7 +2395,7 @@ msgstr ""
|
|||
msgid "Provider Type"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:136
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:138
|
||||
msgid "Provider type"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2521,7 +2521,7 @@ msgstr ""
|
|||
msgid "Request has been denied."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:86
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:87
|
||||
msgid "Request token URL"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2800,7 +2800,7 @@ msgstr ""
|
|||
#: src/pages/applications/ApplicationListPage.ts:58
|
||||
#: src/pages/flows/FlowForm.ts:94
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:60
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:104
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:106
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:60
|
||||
msgid "Slug"
|
||||
msgstr ""
|
||||
|
@ -3019,7 +3019,7 @@ msgid "Successfully created service-connection."
|
|||
msgstr ""
|
||||
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:47
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:50
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:51
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:47
|
||||
msgid "Successfully created source."
|
||||
msgstr ""
|
||||
|
@ -3155,7 +3155,7 @@ msgid "Successfully updated service-connection."
|
|||
msgstr ""
|
||||
|
||||
#: src/pages/sources/ldap/LDAPSourceForm.ts:44
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:47
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:48
|
||||
#: src/pages/sources/saml/SAMLSourceForm.ts:44
|
||||
msgid "Successfully updated source."
|
||||
msgstr ""
|
||||
|
@ -3415,7 +3415,7 @@ msgstr ""
|
|||
msgid "UID"
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:61
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:62
|
||||
msgid "URL settings"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3423,19 +3423,19 @@ msgstr ""
|
|||
msgid "URL that the initial Login request is sent to."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:69
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:70
|
||||
msgid "URL the user is redirect to to consent the authorization."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:83
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:84
|
||||
msgid "URL used by authentik to get user information."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:76
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:77
|
||||
msgid "URL used by authentik to retrieve tokens."
|
||||
msgstr ""
|
||||
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:89
|
||||
#: src/pages/sources/oauth/OAuthSourceForm.ts:90
|
||||
msgid "URL used to request the initial token. This URL is only required for OAuth 1."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -31,6 +31,9 @@ export class OAuthSourceForm extends Form<OAuthSource> {
|
|||
@property({type: Boolean})
|
||||
showUrlOptions = false;
|
||||
|
||||
@property({type: Boolean})
|
||||
showRequestTokenURL = false;
|
||||
|
||||
getSuccessMessage(): string {
|
||||
if (this.source) {
|
||||
return t`Successfully updated source.`;
|
||||
|
@ -66,29 +69,30 @@ export class OAuthSourceForm extends Form<OAuthSource> {
|
|||
label=${t`Authorization URL`}
|
||||
?required=${true}
|
||||
name="authorizationUrl">
|
||||
<input type="text" value="${ifDefined(this.source?.authorizationUrl)}" class="pf-c-form-control" required>
|
||||
<input type="text" value="${first(this.source?.authorizationUrl, "")}" class="pf-c-form-control" required>
|
||||
<p class="pf-c-form__helper-text">${t`URL the user is redirect to to consent the authorization.`}</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Access token URL`}
|
||||
?required=${true}
|
||||
name="accessTokenUrl">
|
||||
<input type="text" value="${ifDefined(this.source?.accessTokenUrl)}" class="pf-c-form-control" required>
|
||||
<input type="text" value="${first(this.source?.accessTokenUrl, "")}" class="pf-c-form-control" required>
|
||||
<p class="pf-c-form__helper-text">${t`URL used by authentik to retrieve tokens.`}</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
label=${t`Profile URL`}
|
||||
?required=${true}
|
||||
name="profileUrl">
|
||||
<input type="text" value="${ifDefined(this.source?.profileUrl)}" class="pf-c-form-control" required>
|
||||
<input type="text" value="${first(this.source?.profileUrl, "")}" class="pf-c-form-control" required>
|
||||
<p class="pf-c-form__helper-text">${t`URL used by authentik to get user information.`}</p>
|
||||
</ak-form-element-horizontal>
|
||||
<ak-form-element-horizontal
|
||||
${this.showRequestTokenURL ? html`<ak-form-element-horizontal
|
||||
label=${t`Request token URL`}
|
||||
name="requestTokenUrl">
|
||||
<input type="text" value="${ifDefined(this.source?.requestTokenUrl)}" class="pf-c-form-control">
|
||||
<input type="text" value="${first(this.source?.requestTokenUrl, "")}" class="pf-c-form-control">
|
||||
<p class="pf-c-form__helper-text">${t`URL used to request the initial token. This URL is only required for OAuth 1.`}</p>
|
||||
</ak-form-element-horizontal>
|
||||
` : html``}
|
||||
</div>
|
||||
</ak-form-group>`;
|
||||
}
|
||||
|
@ -144,6 +148,11 @@ export class OAuthSourceForm extends Form<OAuthSource> {
|
|||
} else {
|
||||
this.showUrlOptions = false;
|
||||
}
|
||||
if ("data-request-token" in selected.attributes) {
|
||||
this.showRequestTokenURL = true;
|
||||
} else {
|
||||
this.showRequestTokenURL = false;
|
||||
}
|
||||
if (!this.source) {
|
||||
this.source = {} as OAuthSource;
|
||||
}
|
||||
|
@ -157,7 +166,13 @@ export class OAuthSourceForm extends Form<OAuthSource> {
|
|||
selected = true;
|
||||
}
|
||||
}
|
||||
return html`<option ?data-urls-custom=${type.urlsCustomizable} value=${type.slug} ?selected=${selected}>${type.name}</option>`;
|
||||
return html`<option
|
||||
?data-urls-custom=${type.urlsCustomizable}
|
||||
?data-request-token=${type.requestTokenUrl}
|
||||
value=${type.slug}
|
||||
?selected=${selected}>
|
||||
${type.name}
|
||||
</option>`;
|
||||
});
|
||||
}), html`<option>${t`Loading...`}</option>`)}
|
||||
</select>
|
||||
|
|
Reference in New Issue