Documentation
¶
Index ¶
- Constants
- func ContextWithToken(ctx context.Context, token *Token) context.Context
- func GetGoogleIAPJWTClaims(ctx context.Context) (map[string]interface{}, error)
- func GetGoogleIDTokenClaims(ctx context.Context) (map[string]interface{}, error)
- func WithGoogleIAPJWTClaims(ctx context.Context, claims map[string]interface{}) context.Context
- func WithGoogleIDTokenClaims(ctx context.Context, claims map[string]interface{}) context.Context
- func WithHTTPRequest(ctx context.Context, req *HTTPRequest) context.Context
- func WithSNSMessage(ctx context.Context, msg *message.SNS) context.Context
- type Context
- type HTTPRequest
- type Token
- type TokenID
- type TokenSecret
Constants ¶
View Source
const ( // Slack user IDs always start with "U", so "anonymous" won't conflict AnonymousUserID = "anonymous" AnonymousUserName = "Anonymous" AnonymousUserEmail = "anonymous@localhost" )
Anonymous user constants
View Source
const TokenExpireDuration = 7 * 24 * time.Hour
Variables ¶
This section is empty.
Functions ¶
func GetGoogleIAPJWTClaims ¶
GetGoogleIAPJWTClaims retrieves Google IAP JWT claims from context
func GetGoogleIDTokenClaims ¶
GetGoogleIDTokenClaims retrieves Google ID token claims from context
func WithGoogleIAPJWTClaims ¶
func WithGoogleIDTokenClaims ¶
func WithHTTPRequest ¶
func WithHTTPRequest(ctx context.Context, req *HTTPRequest) context.Context
Types ¶
type Context ¶
type Context struct {
Google map[string]interface{} `json:"google"`
IAP map[string]interface{} `json:"iap"`
SNS *message.SNS `json:"sns"`
Req *HTTPRequest `json:"req"`
Env map[string]string `json:"env" masq:"secret"`
}
func BuildContext ¶
type HTTPRequest ¶
type Token ¶
type Token struct {
ID TokenID `json:"id"`
Secret TokenSecret `json:"secret" masq:"secret"`
Sub string `json:"sub"`
Email string `json:"email"`
Name string `json:"name"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
}
func NewAnonymousUser ¶ added in v0.1.0
func NewAnonymousUser() *Token
NewAnonymousUser creates a new anonymous user token
func (*Token) IsAnonymous ¶ added in v0.1.0
IsAnonymous returns true if the token represents an anonymous user
type TokenSecret ¶
type TokenSecret string
func NewTokenSecret ¶
func NewTokenSecret() TokenSecret
func (TokenSecret) String ¶
func (x TokenSecret) String() string
Click to show internal directories.
Click to hide internal directories.