mirror of
https://github.com/peridotbuild/peridot.git
synced 2024-12-03 18:16:25 +00:00
Add logout
This commit is contained in:
parent
c02a30aaa8
commit
72431e48a3
@ -497,6 +497,22 @@ func FrontendServer(info *FrontendInfo, embedfs *embed.FS) error {
|
||||
// Redirect to self, this is due to the "root" not being / for all apps
|
||||
http.Redirect(w, r, info.Self, http.StatusFound)
|
||||
})
|
||||
|
||||
// Handle logout
|
||||
http.HandleFunc(prefix+"/auth/oidc/logout", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Delete the auth cookie
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: frontendAuthCookieKey,
|
||||
Value: "",
|
||||
Path: "/",
|
||||
MaxAge: -1,
|
||||
// secure if self is https
|
||||
Secure: strings.HasPrefix(info.Self, "https://"),
|
||||
})
|
||||
|
||||
// Redirect to self, this is due to the "root" not being / for all apps
|
||||
http.Redirect(w, r, info.Self, http.StatusFound)
|
||||
})
|
||||
}
|
||||
|
||||
var handler http.Handler = nil
|
||||
|
@ -46,6 +46,9 @@ export const App = () => {
|
||||
Mship Admin
|
||||
</Typography>
|
||||
<Box sx={{ flexGrow: 1, textAlign: 'right' }}>
|
||||
<Button className="native-link" href="/admin/auth/oidc/logout" variant="primary">
|
||||
Logout
|
||||
</Button>
|
||||
<Button className="native-link" href="/" variant="primary">
|
||||
Go back to Mship
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user