providers/oauth2: use access_code_validity for id_tokens generated when using an implicit flow, improve wording in web ui

closes #1369

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-15 17:14:53 +02:00
parent 95efd47f65
commit 916530f0d8
5 changed files with 40 additions and 13 deletions

View file

@ -247,7 +247,7 @@ class TestAuthorize(OAuthTestCase):
"to": ( "to": (
f"http://localhost#access_token={token.access_token}" f"http://localhost#access_token={token.access_token}"
f"&id_token={provider.encode(token.id_token.to_dict())}&token_type=bearer" f"&id_token={provider.encode(token.id_token.to_dict())}&token_type=bearer"
f"&expires_in=2592000&state={state}" f"&expires_in=60&state={state}"
), ),
}, },
) )

View file

@ -367,7 +367,7 @@ class OAuthFulfillmentStage(StageView):
query_fragment["token_type"] = "bearer" query_fragment["token_type"] = "bearer"
query_fragment["expires_in"] = int( query_fragment["expires_in"] = int(
timedelta_from_string(self.provider.token_validity).total_seconds() timedelta_from_string(self.provider.access_code_validity).total_seconds()
) )
query_fragment["state"] = self.params.state if self.params.state else "" query_fragment["state"] = self.params.state if self.params.state else ""

View file

@ -88,14 +88,18 @@ msgstr "API request failed"
msgid "Access Key" msgid "Access Key"
msgstr "Access Key" msgstr "Access Key"
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #:
msgid "Access code validity" #~ msgid "Access code validity"
msgstr "Access code validity" #~ msgstr "Access code validity"
#: src/pages/sources/oauth/OAuthSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts
msgid "Access token URL" msgid "Access token URL"
msgstr "Access token URL" msgstr "Access token URL"
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "Access token validity"
msgstr "Access token validity"
#: src/elements/events/ObjectChangelog.ts #: src/elements/events/ObjectChangelog.ts
#: src/elements/events/UserEvents.ts #: src/elements/events/UserEvents.ts
#: src/pages/events/EventListPage.ts #: src/pages/events/EventListPage.ts
@ -787,9 +791,13 @@ msgstr "Configuration stage"
msgid "Configure WebAuthn" msgid "Configure WebAuthn"
msgstr "Configure WebAuthn" msgstr "Configure WebAuthn"
#:
#~ msgid "Configure how long access codes are valid for."
#~ msgstr "Configure how long access codes are valid for."
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "Configure how long access codes are valid for." msgid "Configure how long access tokens are valid for."
msgstr "Configure how long access codes are valid for." msgstr "Configure how long access tokens are valid for."
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "Configure how long refresh tokens and their id_tokens are valid for." msgid "Configure how long refresh tokens and their id_tokens are valid for."
@ -2057,6 +2065,10 @@ msgstr "If this flag is set, this Stage will jump to the next Stage when no Invi
msgid "If this is selected, the token will expire. Upon expiration, the token will be rotated." msgid "If this is selected, the token will expire. Upon expiration, the token will be rotated."
msgstr "If this is selected, the token will expire. Upon expiration, the token will be rotated." msgstr "If this is selected, the token will expire. Upon expiration, the token will be rotated."
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "If you are using an Implicit, client-side flow (where the token-endpoint isn't used), you probably want to increase this time."
msgstr "If you are using an Implicit, client-side flow (where the token-endpoint isn't used), you probably want to increase this time."
#: src/pages/outposts/OutpostDeploymentModal.ts #: src/pages/outposts/OutpostDeploymentModal.ts
msgid "If your authentik Instance is using a self-signed certificate, set this value." msgid "If your authentik Instance is using a self-signed certificate, set this value."
msgstr "If your authentik Instance is using a self-signed certificate, set this value." msgstr "If your authentik Instance is using a self-signed certificate, set this value."

View file

@ -88,14 +88,18 @@ msgstr ""
msgid "Access Key" msgid "Access Key"
msgstr "" msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #:
msgid "Access code validity" #~ msgid "Access code validity"
msgstr "" #~ msgstr ""
#: src/pages/sources/oauth/OAuthSourceForm.ts #: src/pages/sources/oauth/OAuthSourceForm.ts
msgid "Access token URL" msgid "Access token URL"
msgstr "" msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "Access token validity"
msgstr ""
#: src/elements/events/ObjectChangelog.ts #: src/elements/events/ObjectChangelog.ts
#: src/elements/events/UserEvents.ts #: src/elements/events/UserEvents.ts
#: src/pages/events/EventListPage.ts #: src/pages/events/EventListPage.ts
@ -781,8 +785,12 @@ msgstr ""
msgid "Configure WebAuthn" msgid "Configure WebAuthn"
msgstr "" msgstr ""
#:
#~ msgid "Configure how long access codes are valid for."
#~ msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "Configure how long access codes are valid for." msgid "Configure how long access tokens are valid for."
msgstr "" msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts #: src/pages/providers/oauth2/OAuth2ProviderForm.ts
@ -2049,6 +2057,10 @@ msgstr ""
msgid "If this is selected, the token will expire. Upon expiration, the token will be rotated." msgid "If this is selected, the token will expire. Upon expiration, the token will be rotated."
msgstr "" msgstr ""
#: src/pages/providers/oauth2/OAuth2ProviderForm.ts
msgid "If you are using an Implicit, client-side flow (where the token-endpoint isn't used), you probably want to increase this time."
msgstr ""
#: src/pages/outposts/OutpostDeploymentModal.ts #: src/pages/outposts/OutpostDeploymentModal.ts
msgid "If your authentik Instance is using a self-signed certificate, set this value." msgid "If your authentik Instance is using a self-signed certificate, set this value."
msgstr "" msgstr ""

View file

@ -179,7 +179,7 @@ ${this.instance?.redirectUris}</textarea
<span slot="header"> ${t`Advanced protocol settings`} </span> <span slot="header"> ${t`Advanced protocol settings`} </span>
<div slot="body" class="pf-c-form"> <div slot="body" class="pf-c-form">
<ak-form-element-horizontal <ak-form-element-horizontal
label=${t`Access code validity`} label=${t`Access token validity`}
?required=${true} ?required=${true}
name="accessCodeValidity" name="accessCodeValidity"
> >
@ -190,7 +190,10 @@ ${this.instance?.redirectUris}</textarea
required required
/> />
<p class="pf-c-form__helper-text"> <p class="pf-c-form__helper-text">
${t`Configure how long access codes are valid for.`} ${t`Configure how long access tokens are valid for.`}
</p>
<p class="pf-c-form__helper-text">
${t`If you are using an Implicit, client-side flow (where the token-endpoint isn't used), you probably want to increase this time.`}
</p> </p>
<p class="pf-c-form__helper-text"> <p class="pf-c-form__helper-text">
${t`(Format: hours=-1;minutes=-2;seconds=-3).`} ${t`(Format: hours=-1;minutes=-2;seconds=-3).`}