本文整理汇总了Golang中github.com/SermoDigital/jose/jwt.Claims函数的典型用法代码示例。如果您正苦于以下问题:Golang Claims函数的具体用法?Golang Claims怎么用?Golang Claims使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Claims函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Claims
// Claims helps implements jwt.JWT.
func (j *jws) Claims() jwt.Claims {
if j.isJWT {
if c, ok := j.payload.v.(Claims); ok {
return jwt.Claims(c)
}
}
return nil
}
开发者ID:andrefreitas,项目名称:jose,代码行数:9,代码来源:jwt.go
示例2: NewValidator
// NewValidator returns a pointer to a jwt.Validator structure containing
// the info to be used in the validation of a JWT.
func NewValidator(c Claims, exp, nbf float64, fn func(Claims) error) *jwt.Validator {
return &jwt.Validator{
Expected: jwt.Claims(c),
EXP: exp,
NBF: nbf,
Fn: Conv(fn),
}
}
开发者ID:andrefreitas,项目名称:jose,代码行数:10,代码来源:jwt.go
示例3: Validate
func (j *jws) Validate(key interface{}, m crypto.SigningMethod, v ...*jwt.Validator) error {
if j.isJWT {
if err := j.Verify(key, m); err != nil {
return err
}
var v1 jwt.Validator
if len(v) > 0 {
v1 = *v[0]
}
c, ok := j.payload.v.(Claims)
if ok {
if err := v1.Validate(j); err != nil {
return err
}
return jwt.Claims(c).Validate(float64(time.Now().Unix()), v1.EXP, v1.NBF)
}
}
return ErrIsNotJWT
}
开发者ID:andrefreitas,项目名称:jose,代码行数:19,代码来源:jwt.go
示例4: NotBefore
// NotBefore retrieves claim "nbf" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.5
func (c Claims) NotBefore() (time.Time, bool) {
return jwt.Claims(c).NotBefore()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例5: Audience
// Audience retrieves claim "aud" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.3
func (c Claims) Audience() ([]string, bool) {
return jwt.Claims(c).Audience()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例6: Issuer
// Issuer retrieves claim "iss" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.1
func (c Claims) Issuer() (string, bool) {
return jwt.Claims(c).Issuer()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例7: MarshalJSON
// MarshalJSON implements json.Marshaler for Claims.
func (c Claims) MarshalJSON() ([]byte, error) {
return jwt.Claims(c).MarshalJSON()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例8: Del
// Del removes the value that corresponds with key from the Claims.
func (c Claims) Del(key string) {
jwt.Claims(c).Del(key)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例9: SetJWTID
// SetJWTID sets claim "jti" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.7
func (c Claims) SetJWTID(uniqueID string) {
jwt.Claims(c).SetJWTID(uniqueID)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例10: RemoveNotBefore
// RemoveNotBefore deletes claim "nbf" from c.
func (c Claims) RemoveNotBefore() {
jwt.Claims(c).NotBefore()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例11: RemoveExpiration
// RemoveExpiration deletes claim "exp" from c.
func (c Claims) RemoveExpiration() {
jwt.Claims(c).RemoveExpiration()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例12: RemoveAudience
// RemoveAudience deletes claim "aud" from c.
func (c Claims) RemoveAudience() {
jwt.Claims(c).Audience()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例13: RemoveSubject
// RemoveSubject deletes claim "sub" from c.
func (c Claims) RemoveSubject() {
jwt.Claims(c).RemoveIssuer()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例14: JWTID
// JWTID retrieves claim "jti" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.7
func (c Claims) JWTID() (string, bool) {
return jwt.Claims(c).JWTID()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例15: IssuedAt
// IssuedAt retrieves claim "iat" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.6
func (c Claims) IssuedAt() (float64, bool) {
return jwt.Claims(c).IssuedAt()
}
开发者ID:andrefreitas,项目名称:jose,代码行数:5,代码来源:claims.go
示例16: SetNotBefore
// SetNotBefore sets claim "nbf" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.5
func (c Claims) SetNotBefore(notBefore time.Time) {
jwt.Claims(c).SetNotBefore(notBefore)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例17: SetIssuedAt
// SetIssuedAt sets claim "iat" per its type in
// https://tools.ietf.org/html/rfc7519#section-4.1.6
func (c Claims) SetIssuedAt(issuedAt time.Time) {
jwt.Claims(c).SetIssuedAt(issuedAt)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:5,代码来源:claims.go
示例18: RemoveIssuedAt
// RemoveIssuedAt deletes claim "iat" from c.
func (c Claims) RemoveIssuedAt() {
jwt.Claims(c).IssuedAt()
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例19: Set
// Set sets Claims[key] = val. It'll overwrite without warning.
func (c Claims) Set(key string, val interface{}) {
jwt.Claims(c).Set(key, val)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
示例20: Get
// Get retrieves the value corresponding with key from the Claims.
func (c Claims) Get(key string) interface{} {
return jwt.Claims(c).Get(key)
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:4,代码来源:claims.go
注:本文中的github.com/SermoDigital/jose/jwt.Claims函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论