authentik.enterprise.providers.ssf.views.jwks
1from django.http import Http404, HttpRequest, HttpResponse, JsonResponse 2from django.shortcuts import get_object_or_404 3from django.views import View 4 5from authentik.core.models import Application 6from authentik.crypto.models import CertificateKeyPair 7from authentik.enterprise.providers.ssf.models import SSFProvider 8from authentik.providers.oauth2.views.jwks import JWKSView as OAuthJWKSView 9 10 11class JWKSview(View): 12 """SSF JWKS endpoint, similar to the OAuth2 provider's endpoint""" 13 14 def get(self, request: HttpRequest, application_slug: str) -> HttpResponse: 15 """Show JWK Key data for Provider""" 16 application = get_object_or_404(Application, slug=application_slug) 17 provider = application.backchannel_provider_for(SSFProvider) 18 if not provider: 19 raise Http404 20 signing_key: CertificateKeyPair = provider.signing_key 21 22 response_data = {} 23 24 jwk = OAuthJWKSView.get_jwk_for_key(signing_key, "sig") 25 if jwk: 26 response_data["keys"] = [jwk] 27 28 response = JsonResponse(response_data) 29 response["Access-Control-Allow-Origin"] = "*" 30 31 return response
class
JWKSview(django.views.generic.base.View):
12class JWKSview(View): 13 """SSF JWKS endpoint, similar to the OAuth2 provider's endpoint""" 14 15 def get(self, request: HttpRequest, application_slug: str) -> HttpResponse: 16 """Show JWK Key data for Provider""" 17 application = get_object_or_404(Application, slug=application_slug) 18 provider = application.backchannel_provider_for(SSFProvider) 19 if not provider: 20 raise Http404 21 signing_key: CertificateKeyPair = provider.signing_key 22 23 response_data = {} 24 25 jwk = OAuthJWKSView.get_jwk_for_key(signing_key, "sig") 26 if jwk: 27 response_data["keys"] = [jwk] 28 29 response = JsonResponse(response_data) 30 response["Access-Control-Allow-Origin"] = "*" 31 32 return response
SSF JWKS endpoint, similar to the OAuth2 provider's endpoint
def
get( self, request: django.http.request.HttpRequest, application_slug: str) -> django.http.response.HttpResponse:
15 def get(self, request: HttpRequest, application_slug: str) -> HttpResponse: 16 """Show JWK Key data for Provider""" 17 application = get_object_or_404(Application, slug=application_slug) 18 provider = application.backchannel_provider_for(SSFProvider) 19 if not provider: 20 raise Http404 21 signing_key: CertificateKeyPair = provider.signing_key 22 23 response_data = {} 24 25 jwk = OAuthJWKSView.get_jwk_for_key(signing_key, "sig") 26 if jwk: 27 response_data["keys"] = [jwk] 28 29 response = JsonResponse(response_data) 30 response["Access-Control-Allow-Origin"] = "*" 31 32 return response
Show JWK Key data for Provider