jwtv1

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_config_middleware_jwt_v1_jwt_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AuthConfig added in v0.2.13

type AuthConfig struct {
	SigningMethod        string   `protobuf:"bytes,1,opt,name=signing_method,proto3" json:"signing_method,omitempty"`
	SigningKey           string   `protobuf:"bytes,2,opt,name=signing_key,proto3" json:"signing_key,omitempty"`
	SecondarySigningKey  string   `protobuf:"bytes,3,opt,name=secondary_signing_key,proto3" json:"secondary_signing_key,omitempty"`
	AccessTokenLifetime  int64    `protobuf:"varint,4,opt,name=access_token_lifetime,proto3" json:"access_token_lifetime,omitempty"`
	RefreshTokenLifetime int64    `protobuf:"varint,5,opt,name=refresh_token_lifetime,proto3" json:"refresh_token_lifetime,omitempty"`
	Issuer               string   `protobuf:"bytes,6,opt,name=issuer,proto3" json:"issuer,omitempty"`
	Audience             []string `protobuf:"bytes,7,rep,name=audience,proto3" json:"audience,omitempty"` // Audience
	// Optional: Defines how to extract the token from the request.
	// Defaults to "header:Authorization" with "Bearer " prefix.
	// Example: "cookie:access_token"
	TokenSource *string `protobuf:"bytes,8,opt,name=token_source,proto3,oneof" json:"token_source,omitempty"`
	// contains filtered or unexported fields
}

AuthConfig contains configuration parameters for creating and validating a JWT.

func (*AuthConfig) Descriptor deprecated added in v0.2.13

func (*AuthConfig) Descriptor() ([]byte, []int)

Deprecated: Use AuthConfig.ProtoReflect.Descriptor instead.

func (*AuthConfig) GetAccessTokenLifetime added in v0.2.13

func (x *AuthConfig) GetAccessTokenLifetime() int64

func (*AuthConfig) GetAudience added in v0.2.13

func (x *AuthConfig) GetAudience() []string

func (*AuthConfig) GetIssuer added in v0.2.13

func (x *AuthConfig) GetIssuer() string

func (*AuthConfig) GetRefreshTokenLifetime added in v0.2.13

func (x *AuthConfig) GetRefreshTokenLifetime() int64

func (*AuthConfig) GetSecondarySigningKey added in v0.2.13

func (x *AuthConfig) GetSecondarySigningKey() string

func (*AuthConfig) GetSigningKey added in v0.2.13

func (x *AuthConfig) GetSigningKey() string

func (*AuthConfig) GetSigningMethod added in v0.2.13

func (x *AuthConfig) GetSigningMethod() string

func (*AuthConfig) GetTokenSource added in v0.2.13

func (x *AuthConfig) GetTokenSource() string

func (*AuthConfig) ProtoMessage added in v0.2.13

func (*AuthConfig) ProtoMessage()

func (*AuthConfig) ProtoReflect added in v0.2.13

func (x *AuthConfig) ProtoReflect() protoreflect.Message

func (*AuthConfig) Reset added in v0.2.13

func (x *AuthConfig) Reset()

func (*AuthConfig) String added in v0.2.13

func (x *AuthConfig) String() string

func (*AuthConfig) Validate added in v0.2.13

func (m *AuthConfig) Validate() error

Validate checks the field values on AuthConfig with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*AuthConfig) ValidateAll added in v0.2.13

func (m *AuthConfig) ValidateAll() error

ValidateAll checks the field values on AuthConfig with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in AuthConfigMultiError, or nil if none found.

type AuthConfigMultiError added in v0.2.13

type AuthConfigMultiError []error

AuthConfigMultiError is an error wrapping multiple validation errors returned by AuthConfig.ValidateAll() if the designated constraints aren't met.

func (AuthConfigMultiError) AllErrors added in v0.2.13

func (m AuthConfigMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (AuthConfigMultiError) Error added in v0.2.13

func (m AuthConfigMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type AuthConfigValidationError added in v0.2.13

type AuthConfigValidationError struct {
	// contains filtered or unexported fields
}

AuthConfigValidationError is the validation error returned by AuthConfig.Validate if the designated constraints aren't met.

func (AuthConfigValidationError) Cause added in v0.2.13

func (e AuthConfigValidationError) Cause() error

Cause function returns cause value.

func (AuthConfigValidationError) Error added in v0.2.13

Error satisfies the builtin error interface

func (AuthConfigValidationError) ErrorName added in v0.2.13

func (e AuthConfigValidationError) ErrorName() string

ErrorName returns error name.

func (AuthConfigValidationError) Field added in v0.2.13

Field function returns field value.

func (AuthConfigValidationError) Key added in v0.2.13

Key function returns key value.

func (AuthConfigValidationError) Reason added in v0.2.13

func (e AuthConfigValidationError) Reason() string

Reason function returns reason value.

type JWT

type JWT struct {
	ClaimType   string           `protobuf:"bytes,1,opt,name=claim_type,proto3" json:"claim_type,omitempty"`
	TokenHeader *structpb.Struct `protobuf:"bytes,2,opt,name=token_header,proto3" json:"token_header,omitempty"`
	// The configuration for creating and validating a JWT.
	Config *AuthConfig `protobuf:"bytes,100,opt,name=config,proto3" json:"config,omitempty"`
	// contains filtered or unexported fields
}

JSON Web Token

func (*JWT) Descriptor deprecated

func (*JWT) Descriptor() ([]byte, []int)

Deprecated: Use JWT.ProtoReflect.Descriptor instead.

func (*JWT) GetClaimType

func (x *JWT) GetClaimType() string

func (*JWT) GetConfig

func (x *JWT) GetConfig() *AuthConfig

func (*JWT) GetTokenHeader

func (x *JWT) GetTokenHeader() *structpb.Struct

func (*JWT) ProtoMessage

func (*JWT) ProtoMessage()

func (*JWT) ProtoReflect

func (x *JWT) ProtoReflect() protoreflect.Message

func (*JWT) Reset

func (x *JWT) Reset()

func (*JWT) String

func (x *JWT) String() string

func (*JWT) Validate

func (m *JWT) Validate() error

Validate checks the field values on JWT with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*JWT) ValidateAll

func (m *JWT) ValidateAll() error

ValidateAll checks the field values on JWT with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in JWTMultiError, or nil if none found.

type JWTMultiError

type JWTMultiError []error

JWTMultiError is an error wrapping multiple validation errors returned by JWT.ValidateAll() if the designated constraints aren't met.

func (JWTMultiError) AllErrors

func (m JWTMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (JWTMultiError) Error

func (m JWTMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type JWTValidationError

type JWTValidationError struct {
	// contains filtered or unexported fields
}

JWTValidationError is the validation error returned by JWT.Validate if the designated constraints aren't met.

func (JWTValidationError) Cause

func (e JWTValidationError) Cause() error

Cause function returns cause value.

func (JWTValidationError) Error

func (e JWTValidationError) Error() string

Error satisfies the builtin error interface

func (JWTValidationError) ErrorName

func (e JWTValidationError) ErrorName() string

ErrorName returns error name.

func (JWTValidationError) Field

func (e JWTValidationError) Field() string

Field function returns field value.

func (JWTValidationError) Key

func (e JWTValidationError) Key() bool

Key function returns key value.

func (JWTValidationError) Reason

func (e JWTValidationError) Reason() string

Reason function returns reason value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL