Documentation
¶
Index ¶
- Constants
- Variables
- func Login(target *url.URL, redirect string) string
- func LoginCallback(r *http.Request) (string, error)
- func LoginRelative(prefix, redirect string) string
- func Logout(target *url.URL, redirect string) string
- func LogoutCallback(r *http.Request) (string, error)
- func MatchingIngress(r *http.Request) (*url.URL, error)
- func MatchingPath(r *http.Request) *url.URL
- type AbsoluteValidator
- type Redirect
- type RelativeValidator
- type SSOProxyRedirect
- type SSOServerRedirect
- type StandaloneRedirect
- type Validator
Constants ¶
const (
RedirectQueryParameter = "redirect"
)
Variables ¶
var ErrNoMatchingIngress = errors.New("request host does not match any configured ingresses")
Functions ¶
func Login ¶
Login constructs a URL string that points to the login path for the given target URL. The given redirect string should point to the location to be redirected to after login.
func LoginRelative ¶
LoginRelative constructs the relative URL with an absolute path that points to the application's login path, given an optional path prefix. The given redirect string should point to the location to be redirected to after login.
Types ¶
type AbsoluteValidator ¶
type AbsoluteValidator struct {
// contains filtered or unexported fields
}
func NewAbsoluteValidator ¶
func NewAbsoluteValidator(allowedDomains []string) *AbsoluteValidator
func (*AbsoluteValidator) IsValidRedirect ¶
func (v *AbsoluteValidator) IsValidRedirect(r *http.Request, redirect string) bool
IsValidRedirect validates that the given redirect string is a valid absolute URL. It must use the 'http' or 'https' scheme. It must point to a host that matches the configured list of allowed domains.
type Redirect ¶
type Redirect interface { Validator // Canonical constructs a redirect URL that points back to the application. Canonical(r *http.Request) string // Clean parses and cleans a target URL according to implementation-specific validations. It should always return a fallback URL string, regardless of validation errors. Clean(r *http.Request, target string) string }
type RelativeValidator ¶
type RelativeValidator struct{}
func NewRelativeValidator ¶
func NewRelativeValidator() *RelativeValidator
func (*RelativeValidator) IsValidRedirect ¶
func (v *RelativeValidator) IsValidRedirect(r *http.Request, redirect string) bool
IsValidRedirect validates that the given redirect string is a valid relative URL. It must be an absolute path (i.e. has a leading '/').
type SSOProxyRedirect ¶
type SSOProxyRedirect struct { Validator // contains filtered or unexported fields }
func NewSSOProxyRedirect ¶
func NewSSOProxyRedirect(ingresses *ingress.Ingresses) *SSOProxyRedirect
type SSOServerRedirect ¶
type SSOServerRedirect struct { Validator // contains filtered or unexported fields }
func NewSSOServerRedirect ¶
func NewSSOServerRedirect(config *config.Config) (*SSOServerRedirect, error)
type StandaloneRedirect ¶
type StandaloneRedirect struct {
Validator
}
func NewStandaloneRedirect ¶
func NewStandaloneRedirect() *StandaloneRedirect