summaryrefslogtreecommitdiffstats
path: root/routers/user/oauth.go
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2021-04-15 22:32:00 -0400
committerGitHub <noreply@github.com>2021-04-15 22:32:00 -0400
commit024ef3940f016fe3b4100d4cd1e9f8d99ccb12ba (patch)
tree7ac5d572b03b558a1c2cde4c3c78c99cfe574815 /routers/user/oauth.go
parent6a7090b41df6e0a782f04707af60ebfbec9db0a5 (diff)
downloadgitea-024ef3940f016fe3b4100d4cd1e9f8d99ccb12ba.tar.gz
gitea-024ef3940f016fe3b4100d4cd1e9f8d99ccb12ba.zip
add well-known config for OIDC (#15355)
* add well-known config for OIDC * spacing per feedback * Update oidc_wellknown.tmpl * add id_token * Update oidc_wellknown.tmpl Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/user/oauth.go')
-rw-r--r--routers/user/oauth.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/user/oauth.go b/routers/user/oauth.go
index c8c846c687..ae06efd0c0 100644
--- a/routers/user/oauth.go
+++ b/routers/user/oauth.go
@@ -389,6 +389,16 @@ func GrantApplicationOAuth(ctx *context.Context) {
ctx.Redirect(redirect.String(), 302)
}
+// OIDCWellKnown generates JSON so OIDC clients know Gitea's capabilities
+func OIDCWellKnown(ctx *context.Context) {
+ t := ctx.Render.TemplateLookup("user/auth/oidc_wellknown")
+ ctx.Resp.Header().Set("Content-Type", "application/json")
+ if err := t.Execute(ctx.Resp, ctx.Data); err != nil {
+ log.Error("%v", err)
+ ctx.Error(http.StatusInternalServerError)
+ }
+}
+
// AccessTokenOAuth manages all access token requests by the client
func AccessTokenOAuth(ctx *context.Context) {
form := *web.GetForm(ctx).(*forms.AccessTokenForm)