Skip to content

Commit

Permalink
Login and logout flows for SAML
Browse files Browse the repository at this point in the history
  • Loading branch information
javuto committed Apr 7, 2024
1 parent 4a5b39e commit 3d82cdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions admin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,9 @@ func osctrlAdminService() {
// login
routerAdmin.HandleFunc(loginPath, handlersAdmin.LoginHandler).Methods("GET")
routerAdmin.HandleFunc(loginPath, handlersAdmin.LoginPOSTHandler).Methods("POST")
// logout
routerAdmin.Handle(logoutPath, handlerAuthCheck(http.HandlerFunc(handlersAdmin.LogoutPOSTHandler))).Methods("POST")
routerAdmin.HandleFunc(logoutPath, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, loginPath, http.StatusFound)
}).Methods("GET")
}
// Admin: health of service
routerAdmin.HandleFunc(healthPath, handlersAdmin.HealthHandler).Methods("GET")
Expand Down Expand Up @@ -864,6 +865,8 @@ func osctrlAdminService() {
// edit profile
routerAdmin.Handle("/profile", handlerAuthCheck(http.HandlerFunc(handlersAdmin.EditProfileGETHandler))).Methods("GET")
routerAdmin.Handle("/profile", handlerAuthCheck(http.HandlerFunc(handlersAdmin.EditProfilePOSTHandler))).Methods("POST")
// logout
routerAdmin.Handle(logoutPath, handlerAuthCheck(http.HandlerFunc(handlersAdmin.LogoutPOSTHandler))).Methods("POST")
// SAML ACS
if adminConfig.Auth == settings.AuthSAML {
routerAdmin.PathPrefix("/saml/").Handler(samlMiddleware)
Expand All @@ -873,9 +876,6 @@ func osctrlAdminService() {
routerAdmin.HandleFunc(logoutPath, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, samlConfig.LogoutURL, http.StatusFound)
}).Methods("GET")
routerAdmin.HandleFunc(logoutPath, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, samlConfig.LogoutURL, http.StatusFound)
}).Methods("POST")
}
// Launch HTTP server for admin
serviceAdmin := adminConfig.Listener + ":" + adminConfig.Port
Expand Down
2 changes: 1 addition & 1 deletion admin/static/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function sendLogout() {
var data = {
csrftoken: _csrf
};
sendPostRequest(data, _url, '/login', false);
sendPostRequest(data, _url, '/logout', false);
}

$("#login_password").keyup(function(event) {
Expand Down

0 comments on commit 3d82cdc

Please sign in to comment.