Documentation ¶
Index ¶
Constants ¶
View Source
const ( JWTAlgorithm = "RS256" MaxExpirationDelta = 60 * 60 * 24 * 7 // 7 days in seconds MinExpirationDelta = 60 * 60 // 1 hour in seconds )
Variables ¶
This section is empty.
Functions ¶
func CreateClaims ¶
func CreateClaims(j *JWTHandler) jwt.Claims
func ParseRSAPrivateKeyFromPEM ¶
func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
Types ¶
type JWTHandler ¶
type JWTHandler struct { ServiceAccount *service_account.ServiceAccount Audience string ExpirationTime time.Duration SecondsBeforeExpire time.Duration }
func NewJWTHandler ¶
func NewJWTHandler(sa *service_account.ServiceAccount, secondsBeforeExpire, tokenDuration int, audience string) (*JWTHandler, error)
func (*JWTHandler) GenerateToken ¶
func (j *JWTHandler) GenerateToken() (string, error)
func (*JWTHandler) IsTokenExpired ¶
func (j *JWTHandler) IsTokenExpired(tokenString string) (bool, error)
Click to show internal directories.
Click to hide internal directories.