package middleware import ( "net/http" "github.com/xlgmokha/x/pkg/x" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" ) type TokenParser x.Mapper[*http.Request, oidc.RawToken] func IDTokenFromSessionCookie(r *http.Request) oidc.RawToken { cookies := r.CookiesNamed(cfg.IDTokenCookie) if len(cookies) != 1 { return "" } return oidc.RawToken(cookies[0].Value) }