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()
|
token = ReadOnlyField()
|
||||||
user_info = ReadOnlyField()
|
user_info = ReadOnlyField()
|
||||||
provider_info = ReadOnlyField()
|
provider_info = ReadOnlyField()
|
||||||
|
logout = ReadOnlyField()
|
||||||
|
|
||||||
def create(self, request: Request) -> Response:
|
def create(self, request: Request) -> Response:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -83,6 +84,7 @@ class OAuth2ProviderViewSet(ModelViewSet):
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"provider_info": None,
|
"provider_info": None,
|
||||||
|
"logout": None,
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
data["provider_info"] = request.build_absolute_uri(
|
data["provider_info"] = request.build_absolute_uri(
|
||||||
|
@ -91,6 +93,12 @@ class OAuth2ProviderViewSet(ModelViewSet):
|
||||||
kwargs={"application_slug": provider.application.slug},
|
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
|
except Provider.application.RelatedObjectDoesNotExist: # pylint: disable=no-member
|
||||||
pass
|
pass
|
||||||
return Response(data)
|
return Response(data)
|
||||||
|
|
|
@ -10684,6 +10684,10 @@ definitions:
|
||||||
title: Provider info
|
title: Provider info
|
||||||
type: string
|
type: string
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
logout:
|
||||||
|
title: Logout
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
ProxyProvider:
|
ProxyProvider:
|
||||||
description: ProxyProvider Serializer
|
description: ProxyProvider Serializer
|
||||||
required:
|
required:
|
||||||
|
|
|
@ -8,6 +8,7 @@ export interface OAuth2SetupURLs {
|
||||||
token: string;
|
token: string;
|
||||||
user_info: string;
|
user_info: string;
|
||||||
provider_info?: string;
|
provider_info?: string;
|
||||||
|
logout?: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,10 +148,16 @@ export class OAuth2ProviderViewPage extends Page {
|
||||||
</div>
|
</div>
|
||||||
<div class="pf-c-form__group">
|
<div class="pf-c-form__group">
|
||||||
<label class="pf-c-form__label" for="help-text-simple-form-name">
|
<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>
|
</label>
|
||||||
<input class="pf-c-form-control" readonly type="text" value="${this.providerUrls?.user_info || "-"}" />
|
<input class="pf-c-form-control" readonly type="text" value="${this.providerUrls?.user_info || "-"}" />
|
||||||
</div>
|
</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>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Reference in New Issue