mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-09 18:06:42 +00:00
35 lines
547 B
Go
35 lines
547 B
Go
package client
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
mw "github.com/nais/wonderwall/pkg/middleware"
|
|
)
|
|
|
|
type LogoutCallback struct {
|
|
*Client
|
|
request *http.Request
|
|
}
|
|
|
|
func NewLogoutCallback(c *Client, r *http.Request) *LogoutCallback {
|
|
return &LogoutCallback{
|
|
Client: c,
|
|
request: r,
|
|
}
|
|
}
|
|
|
|
func (in *LogoutCallback) PostLogoutRedirectURI() string {
|
|
redirect := in.cfg.Client().PostLogoutRedirectURI()
|
|
|
|
if len(redirect) > 0 {
|
|
return redirect
|
|
}
|
|
|
|
ingress, ok := mw.IngressFrom(in.request.Context())
|
|
if !ok {
|
|
return "/"
|
|
}
|
|
|
|
return ingress.String()
|
|
}
|