Versions in this module Expand all Collapse all v2 v2.4.1 Aug 24, 2021 v2.1.1 Aug 24, 2021 Changes in this version + const AccountClaim + const ActivationClaim + const AlgorithmNkey + const AlgorithmNkeyOld + const All + const ConnectionTypeLeafnode + const ConnectionTypeMqtt + const ConnectionTypeStandard + const ConnectionTypeWebsocket + const GenericClaim + const Headers + const MaxInfoLength + const NoLimit + const OperatorClaim + const ResponseTypeChunked + const ResponseTypeSingleton + const ResponseTypeStream + const TokenTypeJwt + const UserClaim + const Version + func DecorateJWT(jwtString string) ([]byte, error) + func DecorateSeed(seed []byte) ([]byte, error) + func FormatUserConfig(jwtString string, seed []byte) ([]byte, error) + func IsGenericClaimType(s string) bool + func ParseDecoratedJWT(contents []byte) (string, error) + func ParseDecoratedNKey(contents []byte) (nkeys.KeyPair, error) + func ParseDecoratedUserNKey(contents []byte) (nkeys.KeyPair, error) + func ParseServerVersion(version string) (int, int, int, error) + func ValidateOperatorServiceURL(v string) error + type Account struct + DefaultPermissions Permissions + Exports Exports + Imports Imports + Limits OperatorLimits + Mappings Mapping + Revocations RevocationList + SigningKeys SigningKeys + func (a *Account) AddMapping(sub Subject, to ...WeightedMapping) + func (a *Account) Validate(acct *AccountClaims, vr *ValidationResults) + type AccountClaims struct + func DecodeAccountClaims(token string) (*AccountClaims, error) + func NewAccountClaims(subject string) *AccountClaims + func (a *AccountClaims) ClaimType() ClaimType + func (a *AccountClaims) Claims() *ClaimsData + func (a *AccountClaims) ClearRevocation(pubKey string) + func (a *AccountClaims) DidSign(uc Claims) bool + func (a *AccountClaims) Encode(pair nkeys.KeyPair) (string, error) + func (a *AccountClaims) ExpectedPrefixes() []nkeys.PrefixByte + func (a *AccountClaims) IsClaimRevoked(claim *UserClaims) bool + func (a *AccountClaims) Payload() interface{} + func (a *AccountClaims) Revoke(pubKey string) + func (a *AccountClaims) RevokeAt(pubKey string, timestamp time.Time) + func (a *AccountClaims) String() string + func (a *AccountClaims) Validate(vr *ValidationResults) + type AccountLimits struct + Conn int64 + Exports int64 + Imports int64 + LeafNodeConn int64 + WildcardExports bool + func (a *AccountLimits) IsUnlimited() bool + type Activation struct + ImportSubject Subject + ImportType ExportType + IssuerAccount string + func (a *Activation) IsService() bool + func (a *Activation) IsStream() bool + func (a *Activation) Validate(vr *ValidationResults) + type ActivationClaims struct + func DecodeActivationClaims(token string) (*ActivationClaims, error) + func NewActivationClaims(subject string) *ActivationClaims + func (a *ActivationClaims) ClaimType() ClaimType + func (a *ActivationClaims) Claims() *ClaimsData + func (a *ActivationClaims) Encode(pair nkeys.KeyPair) (string, error) + func (a *ActivationClaims) ExpectedPrefixes() []nkeys.PrefixByte + func (a *ActivationClaims) HashID() (string, error) + func (a *ActivationClaims) Payload() interface{} + func (a *ActivationClaims) String() string + func (a *ActivationClaims) Validate(vr *ValidationResults) + type CIDRList TagList + func (c *CIDRList) Add(p ...string) + func (c *CIDRList) Contains(p string) bool + func (c *CIDRList) Remove(p ...string) + func (c *CIDRList) Set(values string) + func (c *CIDRList) UnmarshalJSON(body []byte) (err error) + type ClaimType string + type Claims interface + ClaimType func() ClaimType + Claims func() *ClaimsData + Encode func(kp nkeys.KeyPair) (string, error) + ExpectedPrefixes func() []nkeys.PrefixByte + Payload func() interface{} + String func() string + Validate func(vr *ValidationResults) + func Decode(token string) (Claims, error) + type ClaimsData struct + Audience string + Expires int64 + ID string + IssuedAt int64 + Issuer string + Name string + NotBefore int64 + Subject string + func (c *ClaimsData) IsSelfSigned() bool + func (c *ClaimsData) String(claim interface{}) string + func (c *ClaimsData) Validate(vr *ValidationResults) + type Export struct + AccountTokenPosition uint + Advertise bool + Latency *ServiceLatency + Name string + ResponseThreshold time.Duration + ResponseType ResponseType + Revocations RevocationList + Subject Subject + TokenReq bool + Type ExportType + func (e *Export) ClearRevocation(pubKey string) + func (e *Export) IsChunkedResponse() bool + func (e *Export) IsClaimRevoked(claim *ActivationClaims) bool + func (e *Export) IsService() bool + func (e *Export) IsSingleResponse() bool + func (e *Export) IsStream() bool + func (e *Export) IsStreamResponse() bool + func (e *Export) Revoke(pubKey string) + func (e *Export) RevokeAt(pubKey string, timestamp time.Time) + func (e *Export) Validate(vr *ValidationResults) + type ExportType int + const Service + const Stream + const Unknown + func (t *ExportType) MarshalJSON() ([]byte, error) + func (t *ExportType) UnmarshalJSON(b []byte) error + func (t ExportType) String() string + type Exports []*Export + func (e *Exports) Add(i ...*Export) + func (e *Exports) HasExportContainingSubject(subject Subject) bool + func (e *Exports) Validate(vr *ValidationResults) error + func (e Exports) Len() int + func (e Exports) Less(i, j int) bool + func (e Exports) Swap(i, j int) + type GenericClaims struct + Data map[string]interface{} + func DecodeGeneric(token string) (*GenericClaims, error) + func NewGenericClaims(subject string) *GenericClaims + func (gc *GenericClaims) ClaimType() ClaimType + func (gc *GenericClaims) Claims() *ClaimsData + func (gc *GenericClaims) Encode(pair nkeys.KeyPair) (string, error) + func (gc *GenericClaims) ExpectedPrefixes() []nkeys.PrefixByte + func (gc *GenericClaims) Payload() interface{} + func (gc *GenericClaims) String() string + func (gc *GenericClaims) Validate(vr *ValidationResults) + type GenericFields struct + Tags TagList + Type ClaimType + Version int + type Header struct + Algorithm string + Type string + func (h *Header) Valid() error + type Import struct + Account string + LocalSubject RenamingSubject + Name string + Share bool + Subject Subject + To Subject + Token string + Type ExportType + func (i *Import) GetTo() string + func (i *Import) IsService() bool + func (i *Import) IsStream() bool + func (i *Import) Validate(actPubKey string, vr *ValidationResults) + type Imports []*Import + func (i *Imports) Add(a ...*Import) + func (i *Imports) Validate(acctPubKey string, vr *ValidationResults) + func (i Imports) Len() int + func (i Imports) Less(j, k int) bool + func (i Imports) Swap(j, k int) + type Info struct + Description string + InfoURL string + func (s Info) Validate(vr *ValidationResults) + type JetStreamLimits struct + Consumer int64 + DiskStorage int64 + MemoryStorage int64 + Streams int64 + func (j *JetStreamLimits) IsUnlimited() bool + type Limits struct + func (l *Limits) IsUnlimited() bool + func (l *Limits) Validate(vr *ValidationResults) + type Mapping map[Subject][]WeightedMapping + func (m *Mapping) Validate(vr *ValidationResults) + type NatsLimits struct + Data int64 + Payload int64 + Subs int64 + func (n *NatsLimits) IsUnlimited() bool + type Operator struct + AccountServerURL string + AssertServerVersion string + OperatorServiceURLs StringList + SigningKeys StringList + StrictSigningKeyUsage bool + SystemAccount string + func (o *Operator) Validate(vr *ValidationResults) + type OperatorClaims struct + func DecodeOperatorClaims(token string) (*OperatorClaims, error) + func NewOperatorClaims(subject string) *OperatorClaims + func (oc *OperatorClaims) ClaimType() ClaimType + func (oc *OperatorClaims) Claims() *ClaimsData + func (oc *OperatorClaims) DidSign(op Claims) bool + func (oc *OperatorClaims) Encode(pair nkeys.KeyPair) (string, error) + func (oc *OperatorClaims) ExpectedPrefixes() []nkeys.PrefixByte + func (oc *OperatorClaims) Payload() interface{} + func (oc *OperatorClaims) String() string + func (oc *OperatorClaims) Validate(vr *ValidationResults) + type OperatorLimits struct + func (o *OperatorLimits) IsEmpty() bool + func (o *OperatorLimits) IsUnlimited() bool + func (o *OperatorLimits) Validate(_ *ValidationResults) + type Permission struct + Allow StringList + Deny StringList + func (p *Permission) Empty() bool + func (p *Permission) Validate(vr *ValidationResults, permitQueue bool) + type Permissions struct + Pub Permission + Resp *ResponsePermission + Sub Permission + func (p *Permissions) Validate(vr *ValidationResults) + type Prefix struct + type RenamingSubject Subject + func (s RenamingSubject) ToSubject() Subject + func (s RenamingSubject) Validate(from Subject, vr *ValidationResults) + type ResponsePermission struct + Expires time.Duration + MaxMsgs int + func (p *ResponsePermission) Validate(_ *ValidationResults) + type ResponseType string + type RevocationEntry struct + PublicKey string + TimeStamp int64 + type RevocationList map[string]int64 + func (r RevocationList) ClearRevocation(pubKey string) + func (r RevocationList) IsRevoked(pubKey string, timestamp time.Time) bool + func (r RevocationList) MaybeCompact() []RevocationEntry + func (r RevocationList) Revoke(pubKey string, timestamp time.Time) + type SamplingRate int + func (r *SamplingRate) MarshalJSON() ([]byte, error) + func (t *SamplingRate) UnmarshalJSON(b []byte) error + type Scope interface + SigningKey func() string + Validate func(vr *ValidationResults) + ValidateScopedSigner func(claim Claims) error + type ScopeType int + const UserScopeType + func (t *ScopeType) MarshalJSON() ([]byte, error) + func (t *ScopeType) UnmarshalJSON(b []byte) error + func (t ScopeType) String() string + type ServiceLatency struct + Results Subject + Sampling SamplingRate + func (sl *ServiceLatency) Validate(vr *ValidationResults) + type SigningKeys map[string]Scope + func (sk SigningKeys) Add(keys ...string) + func (sk SigningKeys) AddScopedSigner(s Scope) + func (sk SigningKeys) Contains(k string) bool + func (sk SigningKeys) GetScope(k string) (Scope, bool) + func (sk SigningKeys) Keys() []string + func (sk SigningKeys) MarshalJSON() ([]byte, error) + func (sk SigningKeys) Remove(keys ...string) + func (sk SigningKeys) UnmarshalJSON(data []byte) error + func (sk SigningKeys) Validate(vr *ValidationResults) + type StringList []string + func (u *StringList) Add(p ...string) + func (u *StringList) Contains(p string) bool + func (u *StringList) Remove(p ...string) + type Subject string + func (s Subject) HasWildCards() bool + func (s Subject) IsContainedIn(other Subject) bool + func (s Subject) Validate(vr *ValidationResults) + type TagList []string + func (u *TagList) Add(p ...string) + func (u *TagList) Contains(p string) bool + func (u *TagList) Remove(p ...string) + type TimeRange struct + End string + Start string + func (tr *TimeRange) Validate(vr *ValidationResults) + type User struct + IssuerAccount string + func (u *User) Validate(vr *ValidationResults) + type UserClaims struct + func DecodeUserClaims(token string) (*UserClaims, error) + func NewUserClaims(subject string) *UserClaims + func (u *UserClaims) ClaimType() ClaimType + func (u *UserClaims) Claims() *ClaimsData + func (u *UserClaims) Encode(pair nkeys.KeyPair) (string, error) + func (u *UserClaims) ExpectedPrefixes() []nkeys.PrefixByte + func (u *UserClaims) HasEmptyPermissions() bool + func (u *UserClaims) IsBearerToken() bool + func (u *UserClaims) Payload() interface{} + func (u *UserClaims) SetScoped(t bool) + func (u *UserClaims) String() string + func (u *UserClaims) Validate(vr *ValidationResults) + type UserLimits struct + Locale string + Src CIDRList + Times []TimeRange + func (u *UserLimits) Empty() bool + func (u *UserLimits) IsUnlimited() bool + type UserPermissionLimits struct + AllowedConnectionTypes StringList + BearerToken bool + type UserScope struct + Key string + Kind ScopeType + Role string + Template UserPermissionLimits + func NewUserScope() *UserScope + func (us UserScope) SigningKey() string + func (us UserScope) Validate(vr *ValidationResults) + func (us UserScope) ValidateScopedSigner(c Claims) error + type ValidationIssue struct + Blocking bool + Description string + TimeCheck bool + func (ve *ValidationIssue) Error() string + type ValidationResults struct + Issues []*ValidationIssue + func CreateValidationResults() *ValidationResults + func (v *ValidationResults) Add(vi *ValidationIssue) + func (v *ValidationResults) AddError(format string, args ...interface{}) + func (v *ValidationResults) AddTimeCheck(format string, args ...interface{}) + func (v *ValidationResults) AddWarning(format string, args ...interface{}) + func (v *ValidationResults) Errors() []error + func (v *ValidationResults) IsBlocking(includeTimeChecks bool) bool + func (v *ValidationResults) IsEmpty() bool + func (v *ValidationResults) Warnings() []string + type WeightedMapping struct + Cluster string + Subject Subject + Weight uint8 + func (m *WeightedMapping) GetWeight() uint8 Other modules containing this package github.com/itsabgr/nats-jwt