Documentation
¶
Index ¶
- Constants
- type Claims
- func (c *Claims) GetAudience() string
- func (c *Claims) GetExpirationTime() time.Time
- func (c *Claims) GetID() string
- func (c *Claims) GetIssuedAt() time.Time
- func (c *Claims) GetIssuer() string
- func (c *Claims) GetNotBefore() time.Time
- func (c *Claims) GetSubject() string
- func (c *Claims) GetValue(key string) any
- func (c *Claims) SetAudience(audience string)
- func (c *Claims) SetExpirationTime(expirationTime time.Time)
- func (c *Claims) SetID(id string)
- func (c *Claims) SetIssuedAt(issuedAt time.Time)
- func (c *Claims) SetIssuer(issuer string)
- func (c *Claims) SetNotBefore(notBefore time.Time)
- func (c *Claims) SetSubject(subject string)
- func (c *Claims) SetValue(key string, value any)
- func (c *Claims) WithPrivateRSA(privateKey *rsa.PrivateKey) *withPrivateRSA
- func (c *Claims) WithPublicRSA(publicKey *rsa.PublicKey) *withPublicRSA
- func (c *Claims) WithSecret(secret string) *withSecret
- func (c *Claims) WithUnverified() *withUnverified
Constants ¶
const ( KeyIssuer = "iss" // who issued the token KeySubject = "sub" // subject of the token KeyAudience = "aud" // who or what the token is intended for KeyExpirationTime = "exp" // expiration time, as unix time KeyNotBefore = "nbf" // not before, as unix time KeyIssuedAt = "iat" // issued at, as unix time KeyID = "jti" // unique identifier for the token )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
// contains filtered or unexported fields
}
Claims represents the claims in a JWT
func (*Claims) GetAudience ¶
GetAudience gets the audience of the token audience is about who or what the token is intended for audience is the standard claim key: "aud"
func (*Claims) GetExpirationTime ¶
GetExpirationTime gets the expiration time of the token, as unix time expiration time is the standard claim key: "exp"
func (*Claims) GetIssuedAt ¶
GetIssuedAt gets the issued at time of the token, as unix time issued at is the standard claim key: "iat"
func (*Claims) GetIssuer ¶
GetIssuer gets the issuer of the token issuer is about who issued the token issuer is the standard claim key: "iss"
func (*Claims) GetNotBefore ¶
GetNotBefore gets the not before time of the token, as unix time not before is about when the token is not valid yet not before is the standard claim key: "nbf"
func (*Claims) GetSubject ¶
GetSubject gets the subject of the token subject is about who or what the token is intended for subject is the standard claim key: "sub"
func (*Claims) SetAudience ¶
SetAudience sets the audience of the token audience is about who or what the token is intended for audience is the standard claim key: "aud"
func (*Claims) SetExpirationTime ¶
SetExpirationTime sets the expiration time of the token, as unix time expiration time is the standard claim key: "exp"
func (*Claims) SetIssuedAt ¶
SetIssuedAt sets the issued at time of the token, as unix time issued at is the standard claim key: "iat"
func (*Claims) SetIssuer ¶
SetIssuer sets the issuer of the token issuer is about who issued the token issuer is the standard claim key: "iss"
func (*Claims) SetNotBefore ¶
SetNotBefore sets the not before time of the token, as unix time not before is about when the token is not valid yet not before is the standard claim key: "nbf"
func (*Claims) SetSubject ¶
SetSubject sets the subject of the token subject is about who or what the token is intended for subject is the standard claim key: "sub"
func (*Claims) WithPrivateRSA ¶
func (c *Claims) WithPrivateRSA(privateKey *rsa.PrivateKey) *withPrivateRSA
func (*Claims) WithPublicRSA ¶
func (*Claims) WithSecret ¶
func (*Claims) WithUnverified ¶
func (c *Claims) WithUnverified() *withUnverified