From 792fa45dca4a7c52c92e5b8d4677ad974821ff43 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 2 Mar 2021 15:11:18 +0100 Subject: [PATCH] providers/oauth2: add logout URL to Setup URLs API --- authentik/providers/oauth2/api.py | 8 ++++++++ swagger.yaml | 4 ++++ web/src/api/providers/OAuth2.ts | 1 + web/src/pages/providers/OAuth2ProviderViewPage.ts | 8 +++++++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/authentik/providers/oauth2/api.py b/authentik/providers/oauth2/api.py index 7e6ef24ee..84982d475 100644 --- a/authentik/providers/oauth2/api.py +++ b/authentik/providers/oauth2/api.py @@ -45,6 +45,7 @@ class OAuth2ProviderSetupURLs(Serializer): token = ReadOnlyField() user_info = ReadOnlyField() provider_info = ReadOnlyField() + logout = ReadOnlyField() def create(self, request: Request) -> Response: raise NotImplementedError @@ -83,6 +84,7 @@ class OAuth2ProviderViewSet(ModelViewSet): ) ), "provider_info": None, + "logout": None, } try: data["provider_info"] = request.build_absolute_uri( @@ -91,6 +93,12 @@ class OAuth2ProviderViewSet(ModelViewSet): kwargs={"application_slug": provider.application.slug}, ) ) + data["logout"] = request.build_absolute_uri( + reverse( + "authentik_providers_oauth2:end-session", + kwargs={"application_slug": provider.application.slug}, + ) + ) except Provider.application.RelatedObjectDoesNotExist: # pylint: disable=no-member pass return Response(data) diff --git a/swagger.yaml b/swagger.yaml index 5b1a3437c..a072c0ecd 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -10684,6 +10684,10 @@ definitions: title: Provider info type: string readOnly: true + logout: + title: Logout + type: string + readOnly: true ProxyProvider: description: ProxyProvider Serializer required: diff --git a/web/src/api/providers/OAuth2.ts b/web/src/api/providers/OAuth2.ts index 2e6e28d63..3216d03cc 100644 --- a/web/src/api/providers/OAuth2.ts +++ b/web/src/api/providers/OAuth2.ts @@ -8,6 +8,7 @@ export interface OAuth2SetupURLs { token: string; user_info: string; provider_info?: string; + logout?: string; } diff --git a/web/src/pages/providers/OAuth2ProviderViewPage.ts b/web/src/pages/providers/OAuth2ProviderViewPage.ts index c58413c92..08ec15ca8 100644 --- a/web/src/pages/providers/OAuth2ProviderViewPage.ts +++ b/web/src/pages/providers/OAuth2ProviderViewPage.ts @@ -148,10 +148,16 @@ export class OAuth2ProviderViewPage extends Page {
+
+ + +