Documentation
¶
Index ¶
- Constants
- func ClientId(r *http.Request) string
- func ClientName(r *http.Request) string
- func DeleteTokeByToken(token string) error
- func DeleteToken(app, device, id string) error
- func GetClient(r *http.Request) et.Json
- func GetToken(key string) (string, error)
- func GetTokenKey(app, device, id string) string
- func NewAutorization(id, app, name, username, device, tag string, duration time.Duration) (string, error)
- func NewToken(id, app, name string, username, device string, duration time.Duration) (string, error)
- func SetToken(app, device, id, token string, duration time.Duration) error
- 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" )
Variables ¶
This section is empty.
Functions ¶
func ClientName ¶ added in v1.1.70
* * ClientName * @param r *http.Request * @return string *
func DeleteTokeByToken ¶
* * DeleteTokeByToken * @param token string * @return error *
func DeleteToken ¶
* * DeleteToken * @param app string * @param device string * @param id string * @return error *
func GetTokenKey ¶ added in v1.0.82
* * GetTokenKey * @param app string * @param device string * @param id string * @return string *
func NewAutorization ¶ added in v1.1.69
func NewAutorization(id, app, name, username, device, tag string, duration time.Duration) (string, error)
* * NewAutorization * @param id string * @param app string * @param name string * @param username string * @param device string * @param tag string * @param duration time.Duration * @return token string * @return err error *
func NewToken ¶
func NewToken(id, app, name string, username, device string, duration time.Duration) (string, error)
* * NewToken * @param id string * @param app string * @param name string * @param username string * @param device string * @param duration time.Duration * @return token string * @return key string * @return err 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"` Tag string `json:"tag"` jwt.StandardClaims }
func ParceToken ¶
* * ParceToken * @param token string * @return *Claim * @return error *
func ValidToken ¶ added in v1.1.0
* * ValidToken * @param token string * @return *Claim * @return error *
type ContextKey ¶ added in v1.0.82
type ContextKey string
const ( ServiceIdKey ContextKey = "serviceId" ClientIdKey ContextKey = "clientId" AppKey ContextKey = "app" NameKey ContextKey = "name" SubjectKey ContextKey = "subject" UsernameKey ContextKey = "username" TokenKey ContextKey = "token" ProjectIdKey ContextKey = "projectId" ProfileTpKey ContextKey = "profileTp" ModelKey ContextKey = "model" TagKey ContextKey = "tag" )