Documentation ¶
Index ¶
- func GenerateJWTForAPIUser(userID string, orgID string, expiresAt time.Time, audience string) *jwtpb.JWTClaims
- func GenerateJWTForCluster(clusterID string, audience string) *jwtpb.JWTClaims
- func GenerateJWTForService(serviceID string, audience string) *jwtpb.JWTClaims
- func GenerateJWTForUser(userID string, orgID string, email string, expiresAt time.Time, ...) *jwtpb.JWTClaims
- func GetClusterID(t jwt.Token) string
- func GetEmail(t jwt.Token) string
- func GetIsAPIUser(t jwt.Token) bool
- func GetOrgID(t jwt.Token) string
- func GetScopes(t jwt.Token) []string
- func GetServiceID(t jwt.Token) string
- func GetUserID(t jwt.Token) string
- func HasClusterClaims(t jwt.Token) bool
- func HasServiceClaims(t jwt.Token) bool
- func HasUserClaims(t jwt.Token) bool
- func ParseToken(tokenString string, signingKey string, audience string) (jwt.Token, error)
- func ProtoToToken(pb *jwtpb.JWTClaims) (jwt.Token, error)
- func SignJWTClaims(claims *jwtpb.JWTClaims, signingKey string) (string, error)
- func SignToken(token jwt.Token, signingKey string) (string, error)
- func TokenToProto(token jwt.Token) (*jwtpb.JWTClaims, error)
- type AtomicError
- type ClaimType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateJWTForAPIUser ¶
func GenerateJWTForAPIUser(userID string, orgID string, expiresAt time.Time, audience string) *jwtpb.JWTClaims
GenerateJWTForAPIUser creates a protobuf claims for the api user.
func GenerateJWTForCluster ¶
GenerateJWTForCluster creates a protobuf claims for the given cluster.
func GenerateJWTForService ¶
GenerateJWTForService creates a protobuf claims for the given service.
func GenerateJWTForUser ¶
func GenerateJWTForUser(userID string, orgID string, email string, expiresAt time.Time, audience string) *jwtpb.JWTClaims
GenerateJWTForUser creates a protobuf claims for the given user.
func GetClusterID ¶
GetClusterID fetches the ClusterID from the custom claims.
func GetIsAPIUser ¶
GetIsAPIUser fetches the IsAPIUser from the custom claims.
func GetServiceID ¶
GetServiceID fetches the ServiceID from the custom claims.
func HasClusterClaims ¶
HasClusterClaims checks if the custom claims include ClusterClaims.
func HasServiceClaims ¶
HasServiceClaims checks if the custom claims include ServiceClaims.
func HasUserClaims ¶
HasUserClaims checks if the custom claims include UserClaims.
func ParseToken ¶
ParseToken parses the claim and validates that it was signed given signing key, and has the expected audience.
func ProtoToToken ¶
ProtoToToken maps protobuf claims to map claims.
func SignJWTClaims ¶
SignJWTClaims signs the claim using the given signing key.
Types ¶
type AtomicError ¶
type AtomicError struct {
// contains filtered or unexported fields
}
AtomicError allows atomic storing and loading of an error interface.
func (*AtomicError) Load ¶
func (e *AtomicError) Load() error
Load atomically loads the currently stored error. Note that if Load() is called before Store() it returns nil.
func (*AtomicError) Store ¶
func (e *AtomicError) Store(err error)
Store atomically stores a new error in the AtomicError.
type ClaimType ¶
type ClaimType int
ClaimType represents the type of claims we allow in our system.
func GetClaimsType ¶
GetClaimsType gets the type of the given claim.