mirror of
https://github.com/goauthentik/authentik
synced 2026-04-27 09:57:31 +02:00
* core: bump library/golang in /lifecycle/container Bumps library/golang from 1.25.5-trixie to 1.26.0-trixie. --- updated-dependencies: - dependency-name: library/golang dependency-version: 1.26.0-trixie dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * bump & fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> * bump docs too Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
58 lines
1.1 KiB
Go
58 lines
1.1 KiB
Go
package application
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"slices"
|
|
"strconv"
|
|
)
|
|
|
|
func urlJoin(originalUrl string, newPath string) string {
|
|
u, err := url.JoinPath(originalUrl, newPath)
|
|
if err != nil {
|
|
return originalUrl
|
|
}
|
|
return u
|
|
}
|
|
|
|
func (a *Application) redirect(rw http.ResponseWriter, r *http.Request) {
|
|
fallbackRedirect := a.proxyConfig.ExternalHost
|
|
state := a.stateFromRequest(rw, r)
|
|
if state == nil {
|
|
rw.WriteHeader(http.StatusBadRequest)
|
|
return
|
|
}
|
|
if state.Redirect == "" {
|
|
state.Redirect = fallbackRedirect
|
|
}
|
|
a.log.WithField("redirect", state.Redirect).Trace("final redirect")
|
|
http.Redirect(rw, r, state.Redirect, http.StatusFound)
|
|
}
|
|
|
|
// toString Generic to string function, currently supports actual strings and integers
|
|
func toString(in any) string {
|
|
switch v := in.(type) {
|
|
case string:
|
|
return v
|
|
case *string:
|
|
return *v
|
|
case int:
|
|
return strconv.Itoa(v)
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func contains(s []string, e string) bool {
|
|
return slices.Contains(s, e)
|
|
}
|
|
|
|
func cleanseHeaders(headers http.Header) map[string]string {
|
|
h := make(map[string]string)
|
|
for hk, hv := range headers {
|
|
if len(hv) > 0 {
|
|
h[hk] = hv[0]
|
|
}
|
|
}
|
|
return h
|
|
}
|