claim

package
v1.1.196 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSG_TOKEN_INVALID       = "Token invalido"
	MSG_TOKEN_INVALID_ATRIB = "Token invalido, atrib (%s)"
	MSG_TOKEN_EXPIRED       = "Token expirado"
	MSG_REQUIRED_INVALID    = "Solicitud invalida"
	ERR_INVALID_CLAIM       = "Formato token invalido"
)

Variables

This section is empty.

Functions

func ClientId added in v1.1.8

func ClientId(r *http.Request) string

* * ClientId * @param r *http.Request * @return string *

func ClientName added in v1.1.70

func ClientName(r *http.Request) string

* * ClientName * @param r *http.Request * @return string *

func DeleteTokeByToken

func DeleteTokeByToken(token string) error

* * DeleteTokeByToken * @param token string * @return error *

func DeleteToken

func DeleteToken(app, device, id string) error

* * DeleteToken * @param app, device, id string * @return error *

func Device added in v1.1.147

func Device(r *http.Request) string

* * Device * @param r *http.Request * @return string *

func GenToken added in v1.1.99

func GenToken(c Claim, secret string) (string, error)

* * GenToken * @param c Claim * @return string, error *

func GetClient

func GetClient(r *http.Request) et.Json

* * GetClient * @param r *http.Request * @return et.Json *

func GetToken added in v1.1.8

func GetToken(key string) (string, error)

* * GetToken * @param key string * @return string, error *

func GetTokenKey added in v1.0.82

func GetTokenKey(app, device, id string) string

* * GetTokenKey * @param app, device, id string * @return string *

func NewAuthorization added in v1.1.148

func NewAuthorization(id, app, name, username, device, projectId, profileTp string, duration time.Duration) (string, error)

* * NewAuthorization * @param id, app, name, username, device string, projectId, profileTp string, duration time.Duration * @return string, error *

func NewEphemeralToken added in v1.1.148

func NewEphemeralToken(id, app, name, username, device, tag string, duration time.Duration) (string, error)

* * NewEphemeralToken * @param id, app, name, username, device, tag string, duration time.Duration * @return string, error *

func NewToken

func NewToken(id, app, name, username, device string, duration time.Duration) (string, error)

* * NewToken * @param id, app, name, username, device string, duration time.Duration * @return string, string, error *

func ProfileTp added in v1.1.147

func ProfileTp(r *http.Request) string

* * ProfileTp * @param r *http.Request * @return string *

func ProjectId added in v1.1.147

func ProjectId(r *http.Request) string

* * ProjectId * @param r *http.Request * @return string *

func ServiceId added in v1.1.122

func ServiceId(r *http.Request) string

* * ServiceId * @param r *http.Request * @return string *

func SetToken

func SetToken(app, device, id, token string, duration time.Duration) error

* * SetToken * @param app, device, id, token string, duration time.Duration * @return error *

func Tag added in v1.1.148

func Tag(r *http.Request) string

* * Tag * @param r *http.Request * @return string *

func Username added in v1.1.147

func Username(r *http.Request) string

* * Username * @param r *http.Request * @return string *

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"`
	ProjectId string        `json:"projectId"`
	ProfileTp string        `json:"profileTp"`
	Tag       string        `json:"tag"`
	jwt.StandardClaims
}

func NewClaim added in v1.1.99

func NewClaim(id, app, name, username, device, projectId, profileTp, tag string, duration time.Duration) Claim

* * NewClaim * @param id, app, name, username, device, tag string, duration time.Duration, projectId, profileTp string * @return Claim *

func ParceToken

func ParceToken(token string) (*Claim, error)

* * ParceToken * @param token string * @return *Claim, error *

func ValidToken added in v1.1.0

func ValidToken(token string) (*Claim, error)

* * ValidToken * @param token string * @return *Claim, error *

func (*Claim) ToJson

func (c *Claim) ToJson() et.Json

* * ToJson * @return et.Json *

type ContextKey added in v1.0.82

type ContextKey string
const (
	ServiceIdKey ContextKey = "serviceId"
	ClientIdKey  ContextKey = "clientId"
	AppKey       ContextKey = "app"
	DeviceKey    ContextKey = "device"
	NameKey      ContextKey = "name"
	SubjectKey   ContextKey = "subject"
	UsernameKey  ContextKey = "username"
	TokenKey     ContextKey = "token"
	ProjectIdKey ContextKey = "projectId"
	ProfileTpKey ContextKey = "profileTp"
	ModelKey     ContextKey = "model"
	TagKey       ContextKey = "tag"
)

func (ContextKey) String added in v1.0.82

func (c ContextKey) String(ctx context.Context, def string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL