Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateECDSASecret() ([]byte, error)
- func GenerateJWTSecret() []byte
- func IsNoTokenFoundError(err error) bool
- func IsSignatureInvalidError(err error) bool
- func WithAllowedPaths(paths ...string) util.ModR[Claims]
- func WithCurrentIAT() util.ModR[Claims]
- func WithDefaultClaims() util.ModR[Claims]
- func WithDuration(dur time.Duration) util.ModR[Claims]
- func WithExp(time time.Time) util.ModR[Claims]
- func WithIAT(time time.Time) util.ModR[Claims]
- func WithKey(key string, value interface{}) util.ModR[Claims]
- func WithRelativeDuration(dur time.Duration) util.ModR[Claims]
- func WithRoles(roles ...string) util.ModR[Claims]
- func WithServerID(id string) util.ModR[Claims]
- func WithUsername(username string) util.ModR[Claims]
- type Claims
- type Secret
- func EmptySecret() Secret
- func NewECDSAFromData(data []byte) (Secret, error)
- func NewECDSASecret(key *ecdsa.PrivateKey, public ...*ecdsa.PublicKey) (Secret, error)
- func NewECDSASignSecret(key *ecdsa.PrivateKey) (Secret, error)
- func NewECDSAValidateSecret(key *ecdsa.PublicKey) (Secret, error)
- func NewECDSAValidateSecretSet(keys ...*ecdsa.PublicKey) ([]Secret, error)
- func NewJWTSecret(data []byte) Secret
- func NewJWTSecretWithSize(data []byte, size int) Secret
- func NewSecret(data []byte) Secret
- func NewSecretSet(main Secret, secondary ...Secret) Secret
- func NewSecrets(secrets ...Secret) Secret
- func ValidateOnly(in Secret) Secret
- type Secrets
- func (s Secrets) Details(token string) (*string, []string, time.Duration, error)
- func (s Secrets) Exists() bool
- func (s Secrets) Hash() string
- func (s Secrets) KeyFunc(token *jwt.Token) (any, error)
- func (s Secrets) Method() jwt.SigningMethod
- func (s Secrets) PublicKey() []string
- func (s Secrets) Sign(claims Claims) (string, error)
- func (s Secrets) SigningHash() string
- func (s Secrets) Validate(token string) (Token, error)
- type Token
Constants ¶
View Source
const ( ClaimISS = "iss" ClaimISSValue = "arangodb" ClaimEXP = "exp" ClaimIAT = "iat" ClaimPreferredUsername = "preferred_username" ClaimRoles = "roles" ClaimServerID = "server_id" ClaimAllowedPaths = "allowed_paths" )
View Source
const DefaultTokenSecretSize = 64
Variables ¶
View Source
var NotValidToken = errors.Errorf("Token is not valid")
Functions ¶
func GenerateECDSASecret ¶
func GenerateJWTSecret ¶
func GenerateJWTSecret() []byte
func IsNoTokenFoundError ¶
func IsSignatureInvalidError ¶
func WithCurrentIAT ¶
func WithDefaultClaims ¶
Types ¶
type Secret ¶
type Secret interface {
SigningHash() string
Hash() string
PublicKey() []string
Sign(claims Claims) (string, error)
Validate(token string) (Token, error)
KeyFunc(token *jwt.Token) (any, error)
Method() jwt.SigningMethod
Details(token string) (*string, []string, time.Duration, error)
Exists() bool
}
func EmptySecret ¶
func EmptySecret() Secret
func NewECDSAFromData ¶
func NewECDSASecret ¶
func NewECDSASignSecret ¶
func NewECDSASignSecret(key *ecdsa.PrivateKey) (Secret, error)
func NewJWTSecret ¶
func NewJWTSecretWithSize ¶
func NewSecretSet ¶
func NewSecrets ¶
func ValidateOnly ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.