jwt

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "AuthService"

Variables

View Source
var ErrFailedToParsePemFile = errors.New("failed to parse pem-encoded file")
View Source
var ErrJWTSetURLMustHaveHTTPSScheme = errors.New("jwt_set_url must have https scheme")
View Source
var ErrKeySetConfigurationAmbiguous = errors.New("key set configuration is ambiguous: you should set either key_file, jwk_set_file or jwk_set_url")
View Source
var ErrKeySetIsNotConfigured = errors.New("key set for jwt verification is not configured")

Functions

func HasSubClaim

func HasSubClaim(jwtToken string) bool

HasSubClaim checks if the provided JWT token contains a non-empty "sub" claim. Returns true if it contains, otherwise returns false.

Types

type AuthService

type AuthService struct {
	Cfg         *setting.Cfg
	RemoteCache *remotecache.RemoteCache
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *setting.Cfg, remoteCache *remotecache.RemoteCache) (*AuthService, error)

func (*AuthService) Verify

func (s *AuthService) Verify(ctx context.Context, strToken string) (JWTClaims, error)

type FakeJWTService

type FakeJWTService struct {
	VerifyProvider func(context.Context, string) (JWTClaims, error)
}

func NewFakeJWTService

func NewFakeJWTService() *FakeJWTService

func (*FakeJWTService) Verify

func (s *FakeJWTService) Verify(ctx context.Context, token string) (JWTClaims, error)

type JWTClaims

type JWTClaims map[string]interface{}

type JWTService

type JWTService interface {
	Verify(ctx context.Context, strToken string) (JWTClaims, error)
}

Jump to

Keyboard shortcuts

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