Documentation
¶
Index ¶
- Constants
- func ClientId(r *http.Request) string
- func Generate(clientId, name, app, device string, expired time.Duration) (string, error)
- func GetUser(r *http.Request) et.Json
- func Key(app, device, clientId string) string
- func Set(app, device, id, token string, duration time.Duration) error
- type Claim
- type ContextKey
Constants ¶
View Source
const ( MSG_TOKEN_INVALID = "Token invalido" MSG_TOKEN_INVALID_ATRIB = "Token invalido, atrib (%s)" MSG_REQUIRED_INVALID = "Solicitud invalida" ERR_INVALID_CLAIM = "Formato token invalido" ERR_AUTORIZATION = "Invalid autorization" )
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
* * Generate method to use in token * @param clientId string * @param name string * @param app string * @param kind string * @param device string * @param expired time.Duration * @return string * @return error *
Types ¶
type Claim ¶
type Claim struct {
Salt string `json:"salt"`
ClientId string `json:"clientId"`
Name string `json:"name"`
App string `json:"app"`
Device string `json:"device"`
Duration time.Duration `json:"expired"`
jwt.StandardClaims
}
type ContextKey ¶ added in v0.0.4
type ContextKey string
const ( ServiceIdKey ContextKey = "serviceId" ClientIdKey ContextKey = "clientId" NameKey ContextKey = "name" AppKey ContextKey = "app" DeviceKey ContextKey = "device" DuractionKey ContextKey = "duration" TokenKey ContextKey = "token" )
Click to show internal directories.
Click to hide internal directories.