File tree Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Expand file tree Collapse file tree 4 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ insert_final_newline = false
1818[templates/swagger/v1_json.tmpl ]
1919indent_style = space
2020
21+ [templates/user/auth/oidc_wellknown.tmpl ]
22+ indent_style = space
23+
2124[Makefile ]
2225indent_style = tab
2326
Original file line number Diff line number Diff line change @@ -336,6 +336,7 @@ func RegisterRoutes(m *web.Route) {
336336 // Routers.
337337 // for health check
338338 m .Get ("/" , routers .Home )
339+ m .Get ("/.well-known/openid-configuration" , user .OIDCWellKnown )
339340 m .Group ("/explore" , func () {
340341 m .Get ("" , func (ctx * context.Context ) {
341342 ctx .Redirect (setting .AppSubURL + "/explore/repos" )
Original file line number Diff line number Diff line change @@ -389,6 +389,16 @@ func GrantApplicationOAuth(ctx *context.Context) {
389389 ctx .Redirect (redirect .String (), 302 )
390390}
391391
392+ // OIDCWellKnown generates JSON so OIDC clients know Gitea's capabilities
393+ func OIDCWellKnown (ctx * context.Context ) {
394+ t := ctx .Render .TemplateLookup ("user/auth/oidc_wellknown" )
395+ ctx .Resp .Header ().Set ("Content-Type" , "application/json" )
396+ if err := t .Execute (ctx .Resp , ctx .Data ); err != nil {
397+ log .Error ("%v" , err )
398+ ctx .Error (http .StatusInternalServerError )
399+ }
400+ }
401+
392402// AccessTokenOAuth manages all access token requests by the client
393403func AccessTokenOAuth (ctx * context.Context ) {
394404 form := * web .GetForm (ctx ).(* forms.AccessTokenForm )
Original file line number Diff line number Diff line change 1+ {
2+ "issuer": "{{AppUrl | JSEscape | Safe}}",
3+ "authorization_endpoint": "{{AppUrl | JSEscape | Safe}}login/oauth/authorize",
4+ "token_endpoint": "{{AppUrl | JSEscape | Safe}}login/oauth/access_token",
5+ "response_types_supported": [
6+ "code",
7+ "id_token"
8+ ]
9+ }
You can’t perform that action at this time.
0 commit comments