summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_jwks.go
blob: 1f9e54f227eb1d4f5494b1a4b653e92b78e39932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package handlers

import (
	"encoding/json"

	"github.com/authelia/authelia/v4/internal/middlewares"
)

// JSONWebKeySetGET returns the JSON Web Key Set. Used in OAuth 2.0 and OpenID Connect 1.0.
func JSONWebKeySetGET(ctx *middlewares.AutheliaCtx) {
	ctx.SetContentTypeApplicationJSON()

	if err := json.NewEncoder(ctx).Encode(ctx.Providers.OpenIDConnect.Issuer.GetPublicJSONWebKeys(ctx)); err != nil {
		ctx.Error(err, "failed to serve json web key set")
	}
}