mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
revert: "style: go fmt"
This wasn't actually formatting.
This reverts commit d71ff7ddc3.
This commit is contained in:
@@ -44,7 +44,7 @@ func (s *SSOServer) LogoutLocal(w http.ResponseWriter, r *http.Request) {
|
||||
s.Standalone.LogoutLocal(w, r)
|
||||
}
|
||||
|
||||
// Wildcard redirects unhandled requests to the default redirect URI.
|
||||
// Wildcard redirects unhandled requests to the default redirect URL.
|
||||
func (s *SSOServer) Wildcard(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, s.Config.SSO.ServerDefaultRedirectURL, http.StatusFound)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestCallback_SessionStateRequired(t *testing.T) {
|
||||
|
||||
resp := authorize(t, rpClient, idp)
|
||||
|
||||
// Get callback URI after successful auth
|
||||
// Get callback URL after successful auth
|
||||
params := resp.Location.Query()
|
||||
sessionState := params.Get("session_state")
|
||||
assert.NotEmpty(t, sessionState)
|
||||
@@ -513,7 +513,7 @@ func authorize(t *testing.T, rpClient *http.Client, idp *mock.IdentityProvider)
|
||||
}
|
||||
|
||||
func callback(t *testing.T, rpClient *http.Client, authorizeResponse response) *http.Cookie {
|
||||
// Get callback URI after successful auth
|
||||
// Get callback URL after successful auth
|
||||
callbackURL := authorizeResponse.Location
|
||||
|
||||
// Follow redirect to callback
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// GenerateBase64 generates a random string of a given length, and base64 URI-encodes it.
|
||||
// GenerateBase64 generates a random string of a given length, and base64 URL-encodes it.
|
||||
func GenerateBase64(length int) (string, error) {
|
||||
bytes, err := Generate(length)
|
||||
if err != nil {
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
type Redirect interface {
|
||||
Validator
|
||||
// Canonical constructs a redirect URI that points back to the application.
|
||||
// Canonical constructs a redirect URL that points back to the application.
|
||||
Canonical(r *http.Request) string
|
||||
// Clean parses and cleans a target URI according to implementation-specific validations. It should always return a fallback URI string, regardless of validation errors.
|
||||
// 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
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func (h *StandaloneRedirect) Canonical(r *http.Request) string {
|
||||
redirect = fallback(r, target, h.getFallbackRedirect(r))
|
||||
}
|
||||
|
||||
// redirect must be a relative URI to avoid cross-domain redirects
|
||||
// redirect must be a relative URL to avoid cross-domain redirects
|
||||
redirect.Scheme = ""
|
||||
redirect.Host = ""
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const (
|
||||
|
||||
var ErrNoMatchingIngress = errors.New("request host does not match any configured ingresses")
|
||||
|
||||
// Login constructs a URI string that points to the login path for the given target URI.
|
||||
// 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 Login(target *url.URL, redirect string) string {
|
||||
u := target.JoinPath(paths.OAuth2, paths.Login)
|
||||
@@ -29,7 +29,7 @@ func Login(target *url.URL, redirect string) string {
|
||||
return u.String()
|
||||
}
|
||||
|
||||
// LoginRelative constructs the relative URI with an absolute path that points to the application's login path, given an optional path prefix.
|
||||
// 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.
|
||||
func LoginRelative(prefix, redirect string) string {
|
||||
u := new(url.URL)
|
||||
@@ -42,7 +42,7 @@ func LoginRelative(prefix, redirect string) string {
|
||||
return Login(u, redirect)
|
||||
}
|
||||
|
||||
// Logout constructs a URI string that points to the logout path for the given target URI.
|
||||
// Logout constructs a URL string that points to the logout path for the given target URL.
|
||||
// The given redirect string should point to the location to be redirected to after logout.
|
||||
func Logout(target *url.URL, redirect string) string {
|
||||
u := target.JoinPath(paths.OAuth2, paths.Logout)
|
||||
|
||||
@@ -27,7 +27,7 @@ func NewAbsoluteValidator(allowedDomains []string) *AbsoluteValidator {
|
||||
return &AbsoluteValidator{allowedDomains: allowedDomains}
|
||||
}
|
||||
|
||||
// IsValidRedirect validates that the given redirect string is a valid absolute URI.
|
||||
// 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.
|
||||
func (v *AbsoluteValidator) IsValidRedirect(r *http.Request, redirect string) bool {
|
||||
@@ -66,7 +66,7 @@ func NewRelativeValidator() *RelativeValidator {
|
||||
return &RelativeValidator{}
|
||||
}
|
||||
|
||||
// IsValidRedirect validates that the given redirect string is a valid relative URI.
|
||||
// IsValidRedirect validates that the given redirect string is a valid relative URL.
|
||||
// It must be an absolute path (i.e. has a leading '/').
|
||||
func (v *RelativeValidator) IsValidRedirect(r *http.Request, redirect string) bool {
|
||||
u, ok := parsableRequestURI(r, redirect)
|
||||
|
||||
Reference in New Issue
Block a user