feat: log out and redirect user when converting to oidc (#8347)

* feat: log out user on conver to oidc

Log out user and redirect to login page and log out user when
they convert to oidc.
This commit is contained in:
Steven Masley
2023-07-10 10:25:41 -04:00
committed by GitHub
parent 90a3debe3f
commit 2ee406d7b6
5 changed files with 76 additions and 21 deletions

View File

@ -632,12 +632,18 @@ func New(options *Options) *API {
r.Post("/login", api.postLogin)
r.Route("/oauth2", func(r chi.Router) {
r.Route("/github", func(r chi.Router) {
r.Use(httpmw.ExtractOAuth2(options.GithubOAuth2Config, options.HTTPClient, nil))
r.Use(
httpmw.ExtractOAuth2(options.GithubOAuth2Config, options.HTTPClient, nil),
apiKeyMiddlewareOptional,
)
r.Get("/callback", api.userOAuth2Github)
})
})
r.Route("/oidc/callback", func(r chi.Router) {
r.Use(httpmw.ExtractOAuth2(options.OIDCConfig, options.HTTPClient, oidcAuthURLParams))
r.Use(
httpmw.ExtractOAuth2(options.OIDCConfig, options.HTTPClient, oidcAuthURLParams),
apiKeyMiddlewareOptional,
)
r.Get("/", api.userOIDC)
})
})