providers/oauth2: add logout URL to Setup URLs API
This commit is contained in:
parent
743aaea15e
commit
792fa45dca
|
@ -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)
|
||||
|
|
|
@ -10684,6 +10684,10 @@ definitions:
|
|||
title: Provider info
|
||||
type: string
|
||||
readOnly: true
|
||||
logout:
|
||||
title: Logout
|
||||
type: string
|
||||
readOnly: true
|
||||
ProxyProvider:
|
||||
description: ProxyProvider Serializer
|
||||
required:
|
||||
|
|
|
@ -8,6 +8,7 @@ export interface OAuth2SetupURLs {
|
|||
token: string;
|
||||
user_info: string;
|
||||
provider_info?: string;
|
||||
logout?: string;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -148,10 +148,16 @@ export class OAuth2ProviderViewPage extends Page {
|
|||
</div>
|
||||
<div class="pf-c-form__group">
|
||||
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
||||
<span class="pf-c-form__label-text">${gettext("Userinfo Endpoint")}</span>
|
||||
<span class="pf-c-form__label-text">${gettext("Userinfo URL")}</span>
|
||||
</label>
|
||||
<input class="pf-c-form-control" readonly type="text" value="${this.providerUrls?.user_info || "-"}" />
|
||||
</div>
|
||||
<div class="pf-c-form__group">
|
||||
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
||||
<span class="pf-c-form__label-text">${gettext("Logout URL")}</span>
|
||||
</label>
|
||||
<input class="pf-c-form-control" readonly type="text" value="${this.providerUrls?.logout || "-"}" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in New Issue