Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMiddleware ¶
func NewMiddleware(pK rsa.PublicKey) endpoint.MiddlewareFunc
NewMiddleware of token for a http request Moves a token from the authorization header to the context of a request
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey for context payload
const ( //TokenContextKey for API-token in a context TokenContextKey ContextKey = "api_bearer_token" )
type EventPayload ¶
type EventPayload struct {
*Info
}
EventPayload of a token in the event system of the API.
func EventPayloadFromContext ¶
func EventPayloadFromContext(ctx context.Context) (*EventPayload, error)
EventPayloadFromContext returns a necessary event payload of token information from a given context.
type Token ¶
type Token interface { // Token returns the initial JWT-Token Token() *jwt.Token // String returns a signed and readable JWT-Token String(key *rsa.PrivateKey) (string, error) // Data of the token Data() *data }
Token authenticates a consumer of the api
func FromContext ¶
FromContext returns a Token from a Context
Click to show internal directories.
Click to hide internal directories.