Documentation
¶
Index ¶
- Constants
- func App(r *http.Request) string
- func Client(r *http.Request) et.Json
- func ClientId(r *http.Request) string
- func ClientName(r *http.Request) string
- func Data(r *http.Request) et.Json
- func DeleteTokeByToken(token string) error
- func DeleteToken(app, device, id string) error
- func Device(r *http.Request) string
- func Duration(r *http.Request) time.Duration
- func GetToken(key string) (string, error)
- func NewToken(id, app, name, username, device string, duration time.Duration) (string, error)
- func NewTokenData(id, app, name, username, device string, data et.Json, duration time.Duration) (string, error)
- func ServiceId(r *http.Request) string
- func SetToken(app, device, id, token string, duration int) string
- func Username(r *http.Request) string
- type Claim
- type ContextKey
Constants ¶
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 ClientName ¶ added in v0.1.1
* * ClientName * @param r *http.Request * @return string *
func DeleteTokeByToken ¶
* * DeleteTokeByToken * @param token string * @return error *
func DeleteToken ¶
* * DeleteToken * @param app, device, id string * @return error *
func NewToken ¶
* * NewToken * @param id, app, name, username, device string, duration time.Duration * @return string, error *
func NewTokenData ¶ added in v0.1.1
func NewTokenData(id, app, name, username, device string, data et.Json, duration time.Duration) (string, error)
* * NewAutorization * @param id, app, name, username, device string, data et.Json, duration time.Duration * @return string, error *
Types ¶
type Claim ¶
type Claim struct {
Salt string `json:"salt"`
ID string `json:"id"`
App string `json:"app"`
Name string `json:"name"`
Username string `json:"username"`
Device string `json:"device"`
Duration time.Duration `json:"duration"`
Data et.Json `json:"data"`
jwt.StandardClaims
}
func ParceToken ¶
* * ParceToken * @param token string * @return *Claim, error *
func ValidToken ¶
* * ValidToken * @param token string * @return *Claim, error *
type ContextKey ¶
type ContextKey string
const ( ServiceIdKey ContextKey = "serviceId" ClientIdKey ContextKey = "clientId" AppKey ContextKey = "app" NameKey ContextKey = "name" DeviceKey ContextKey = "device" UsernameKey ContextKey = "username" DataKey ContextKey = "data" DurationKey ContextKey = "duration" )
func (ContextKey) Int ¶ added in v0.1.1
func (c ContextKey) Int(ctx context.Context, def int) int
* * Int * @param ctx context.Context, def int * @return int *
func (ContextKey) Json ¶ added in v0.1.1
* * Json * @param ctx context.Context, def et.Json * @return et.Json *