mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
revert(oidc): api breaking changes
This commit is contained in:
parent
e107f8d476
commit
af8d2c74f6
4 changed files with 9 additions and 8 deletions
|
@ -96,12 +96,8 @@ func NewHandler(cfg config.ConfigInstance) http.Handler {
|
|||
}
|
||||
|
||||
mux.HandleFunc("GET", "/v1/auth/check", auth.AuthCheckHandler)
|
||||
mux.HandleFunc("GET", "/v1/auth/login", defaultAuth.LoginHandler)
|
||||
mux.HandleFunc("GET", "/v1/auth/callback", defaultAuth.LoginHandler)
|
||||
mux.HandleFunc("GET", "/v1/auth/redirect", defaultAuth.LoginHandler)
|
||||
mux.HandleFunc("GET", "/v1/auth/callback", defaultAuth.PostAuthCallbackHandler)
|
||||
mux.HandleFunc("GET,POST", "/v1/auth/logout", defaultAuth.LogoutHandler)
|
||||
switch authProvider := defaultAuth.(type) {
|
||||
case *auth.OIDCProvider:
|
||||
mux.HandleFunc("GET", "/v1/auth/postauth", authProvider.PostAuthCallbackHandler)
|
||||
}
|
||||
return mux
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
OIDCAuthInitPath = "/auth/init"
|
||||
OIDCPostAuthPath = "/auth/postauth"
|
||||
OIDCAuthInitPath = "/"
|
||||
OIDCPostAuthPath = "/auth/callback"
|
||||
OIDCLogoutPath = "/auth/logout"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,5 +5,6 @@ import "net/http"
|
|||
type Provider interface {
|
||||
CheckToken(r *http.Request) error
|
||||
LoginHandler(w http.ResponseWriter, r *http.Request)
|
||||
PostAuthCallbackHandler(w http.ResponseWriter, r *http.Request)
|
||||
LogoutHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
|
|
@ -123,6 +123,10 @@ func (auth *UserPassAuth) LoginHandler(w http.ResponseWriter, r *http.Request) {
|
|||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func (auth *UserPassAuth) PostAuthCallbackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/", http.StatusFound)
|
||||
}
|
||||
|
||||
func (auth *UserPassAuth) LogoutHandler(w http.ResponseWriter, r *http.Request) {
|
||||
clearTokenCookie(w, r, auth.TokenCookieName())
|
||||
http.Redirect(w, r, "/", http.StatusFound)
|
||||
|
|
Loading…
Add table
Reference in a new issue