This commit is contained in:
tumillanino
2025-10-28 12:36:37 +11:00
parent 186d6768fb
commit dad3ec655f
31 changed files with 2256 additions and 0 deletions

19
internal/auth/handlers.go Normal file
View File

@@ -0,0 +1,19 @@
package auth
import (
"net/http"
ory "github.com/ory/client-go"
)
func LogOutHandler(oryClient *ory.APIClient, tunnelURL string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
cookies := r.Header.Get("Cookie")
logoutFlow, _, err := oryClient.FrontendAPI.CreateBrowserLogoutFlow(r.Context()).Cookie(cookies).Execute()
if err != nil {
http.Redirect(w, r, "/", http.StatusSeeOther)
return
}
http.Redirect(w, r, logoutFlow.LogoutUrl, http.StatusSeeOther)
}
}