MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / GetSession

Function GetSession

internal/cookie/cookie.go:112–128  ·  view source on GitHub ↗

GetSession gets the session cookie from context

(gc *gin.Context)

Source from the content-addressed store, hash-verified

110
111// GetSession gets the session cookie from context
112func GetSession(gc *gin.Context) (string, error) {
113 var cookie *http.Cookie
114 var err error
115 cookie, err = gc.Request.Cookie(constants.AppCookieName + "_session")
116 if err != nil {
117 cookie, err = gc.Request.Cookie(constants.AppCookieName + "_session_domain")
118 if err != nil {
119 return "", err
120 }
121 }
122
123 decodedValue, err := url.PathUnescape(cookie.Value)
124 if err != nil {
125 return "", err
126 }
127 return decodedValue, nil
128}

Callers 6

SessionMethod · 0.92
ValidateSessionMethod · 0.92
AuthFunction · 0.92
LogoutHandlerMethod · 0.92
AuthorizeHandlerMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected