Source File
identity.go
Belonging Package
github.com/jcmturner/goidentity/v6
package goidentityimport ()const (CTXKey = "jcmturner/goidentity")type Identity interface {UserName() stringSetUserName(s string)Domain() stringSetDomain(s string)DisplayName() stringSetDisplayName(s string)Human() boolSetHuman(b bool)AuthTime() time.TimeSetAuthTime(t time.Time)AuthzAttributes() []stringAddAuthzAttribute(a string)RemoveAuthzAttribute(a string)Authenticated() boolSetAuthenticated(b bool)Authorized(a string) boolSessionID() stringExpired() boolAttributes() map[string]interface{}SetAttribute(k string, v interface{})SetAttributes(map[string]interface{})RemoveAttribute(k string)Marshal() ([]byte, error)Unmarshal([]byte) error}func ( Identity, *http.Request) *http.Request {:= .Context()= context.WithValue(, CTXKey, )return .WithContext()}func ( *http.Request) Identity {:= .Context()if , := .Value(CTXKey).(Identity); {return}return nil}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |