blob: 14d48e204e5b796cd440b63155016d18e374e737 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
package middleware
import (
"net/http"
"github.com/xlgmokha/x/pkg/x"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg"
)
type TokenParser x.Mapper[*http.Request, RawToken]
func IDTokenFromSessionCookie(r *http.Request) RawToken {
cookies := r.CookiesNamed(cfg.IDTokenCookie)
if len(cookies) != 1 {
return ""
}
return RawToken(cookies[0].Value)
}
|