Documentation ¶
Index ¶
- Constants
- type ApiHandlerFunc
- type Context
- func (c *Context) GetClientLocale() string
- func (c *Context) GetClientTimezoneOffset() (int16, error)
- func (c *Context) GetCurrentUid() int64
- func (c *Context) GetRequestId() string
- func (c *Context) GetResponseError() *errs.Error
- func (c *Context) GetTextualToken() string
- func (c *Context) GetTokenClaims() *UserTokenClaims
- func (c *Context) SetRequestId(requestId string)
- func (c *Context) SetResponseError(error *errs.Error)
- func (c *Context) SetTextualToken(token string)
- func (c *Context) SetTokenClaims(claims *UserTokenClaims)
- type DataHandlerFunc
- type MiddlewareHandlerFunc
- type ProxyHandlerFunc
- type TokenType
- type UserTokenClaims
- func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error)
- func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetIssuer() (string, error)
- func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error)
- func (c *UserTokenClaims) GetSubject() (string, error)
Constants ¶
const AcceptLanguageHeaderName = "Accept-Language"
AcceptLanguageHeaderName represents the header name of accept language
const ClientTimezoneOffsetHeaderName = "X-Timezone-Offset"
ClientTimezoneOffsetHeaderName represents the header name of client timezone offset
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiHandlerFunc ¶
ApiHandlerFunc represents the api handler function
type Context ¶
Context represents the request and response context
func WrapContext ¶
WrapContext returns a context wrapped by this file
func (*Context) GetClientLocale ¶
GetClientLocale returns the client locale name
func (*Context) GetClientTimezoneOffset ¶
GetClientTimezoneOffset returns the client timezone offset
func (*Context) GetCurrentUid ¶
GetCurrentUid returns the current user uid by the current user token
func (*Context) GetRequestId ¶
GetRequestId returns the current request id
func (*Context) GetResponseError ¶
GetResponseError returns the response error
func (*Context) GetTextualToken ¶
GetTextualToken returns the current user textual token
func (*Context) GetTokenClaims ¶
func (c *Context) GetTokenClaims() *UserTokenClaims
GetTokenClaims returns the current user token
func (*Context) SetRequestId ¶
SetRequestId sets the given request id to context
func (*Context) SetResponseError ¶
SetResponseError sets the response error
func (*Context) SetTextualToken ¶
SetTextualToken sets the given user token to context
func (*Context) SetTokenClaims ¶
func (c *Context) SetTokenClaims(claims *UserTokenClaims)
SetTokenClaims sets the given user token to context
type DataHandlerFunc ¶
DataHandlerFunc represents the handler function that returns byte array
type MiddlewareHandlerFunc ¶
type MiddlewareHandlerFunc func(*Context)
MiddlewareHandlerFunc represents the middleware handler function
type ProxyHandlerFunc ¶
type ProxyHandlerFunc func(*Context) (*httputil.ReverseProxy, *errs.Error)
ProxyHandlerFunc represents the reverse proxy handler function
type UserTokenClaims ¶
type UserTokenClaims struct { UserTokenId string `json:"userTokenId"` Uid int64 `json:"jti,string"` Username string `json:"username,omitempty"` Type TokenType `json:"type"` IssuedAt int64 `json:"iat"` ExpiresAt int64 `json:"exp"` }
UserTokenClaims represents user token
func (*UserTokenClaims) GetAudience ¶
func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error)
GetAudience returns the audience of this token
func (*UserTokenClaims) GetExpirationTime ¶
func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)
GetExpirationTime returns the expiration time of this token
func (*UserTokenClaims) GetIssuedAt ¶
func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)
GetIssuedAt returns the issue time of this token
func (*UserTokenClaims) GetIssuer ¶
func (c *UserTokenClaims) GetIssuer() (string, error)
GetIssuer returns the issuer of this token
func (*UserTokenClaims) GetNotBefore ¶
func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error)
GetNotBefore returns the earliest valid time of this token
func (*UserTokenClaims) GetSubject ¶
func (c *UserTokenClaims) GetSubject() (string, error)
GetSubject returns the subject of this token