Documentation
¶
Index ¶
- Constants
- func GetHmacJWTSecret() string
- func GetMcsSTSAndJWTDurationInSeconds() int
- func GetMcsSTSAndJWTDurationTime() time.Duration
- func GetPBKDFPassphrase() string
- func GetPBKDFSalt() string
- func ParseWithClaims(tokenStr string, claims *MapClaims) error
- type MapClaims
- type SigningMethodHMAC
- type StandardClaims
Constants ¶
const ( McsHmacJWTSecret = "MCS_HMAC_JWT_SECRET" McsSTSAndJWTDurationSeconds = "MCS_STS_AND_JWT_DURATION_SECONDS" McsPBKDFPassphrase = "MCS_PBKDF_PASSPHRASE" McsPBKDFSalt = "MCS_PBKDF_SALT" )
Variables ¶
This section is empty.
Functions ¶
func GetHmacJWTSecret ¶
func GetHmacJWTSecret() string
GetHmacJWTSecret returns the 64 bytes secret used for signing the generated JWT for the application
func GetMcsSTSAndJWTDurationInSeconds ¶
func GetMcsSTSAndJWTDurationInSeconds() int
McsSTSAndJWTDurationSeconds returns the default session duration for the STS requested tokens and the generated JWTs. Ideally both values should match so jwt and Minio sts sessions expires at the same time.
func GetMcsSTSAndJWTDurationTime ¶
GetMcsSTSAndJWTDurationTime returns GetMcsSTSAndJWTDurationInSeconds in duration format
func GetPBKDFPassphrase ¶
func GetPBKDFPassphrase() string
GetPBKDFPassphrase returns passphrase for the pbkdf2 function used to encrypt JWT payload
func GetPBKDFSalt ¶
func GetPBKDFSalt() string
GetPBKDFSalt returns salt for the pbkdf2 function used to encrypt JWT payload
func ParseWithClaims ¶
ParseWithClaims - parse the token string, valid methods.
Types ¶
type MapClaims ¶
type MapClaims struct { Data string `json:"data,omitempty"` Subject string `json:"sub,omitempty"` jwtgo.MapClaims }
MapClaims - implements custom unmarshaller
func (*MapClaims) MarshalJSON ¶
MarshalJSON marshals the MapClaims struct
func (*MapClaims) Valid ¶
Valid - implements https://godoc.org/github.com/dgrijalva/jwt-go#Claims compatible claims interface, additionally validates "Data" field.
type SigningMethodHMAC ¶
SigningMethodHMAC - Implements the HMAC-SHA family of signing methods signing methods Expects key type of []byte for both signing and validation
var ( SigningMethodHS256 *SigningMethodHMAC SigningMethodHS384 *SigningMethodHMAC SigningMethodHS512 *SigningMethodHMAC )
Specific instances for HS256, HS384, HS512
type StandardClaims ¶
type StandardClaims struct { Data string `json:"data,omitempty"` jwtgo.StandardClaims }
StandardClaims are basically standard claims with "Data"
func NewStandardClaims ¶
func NewStandardClaims() *StandardClaims
NewStandardClaims - initializes standard claims
func (*StandardClaims) SetAudience ¶
func (c *StandardClaims) SetAudience(aud string)
SetAudience sets audience for these claims
func (*StandardClaims) SetData ¶
func (c *StandardClaims) SetData(data string)
SetData sets the "Data" custom field.
func (*StandardClaims) SetExpiry ¶
func (c *StandardClaims) SetExpiry(t time.Time)
SetExpiry sets expiry in unix epoch secs
func (*StandardClaims) SetIssuer ¶
func (c *StandardClaims) SetIssuer(issuer string)
SetIssuer sets issuer for these claims
func (*StandardClaims) SetSubject ¶
func (c *StandardClaims) SetSubject(subject string)
SetSubject sets unique identifier for the jwt
func (*StandardClaims) Valid ¶
func (c *StandardClaims) Valid() error
Valid - implements https://godoc.org/github.com/dgrijalva/jwt-go#Claims compatible claims interface, additionally validates "Data" field.