auth

package
v0.0.0-...-6c91261 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims interface {
	jwt.Claims
}

type JWTHelper

type JWTHelper interface {
	Parse(token string, claims Claims) error
	CreateToken(claims Claims) (string, error)
}

func NewFxJWTHelper

func NewFxJWTHelper(
	provider application.Provider,
) (JWTHelper, error)

type RightsEnforcer

type RightsEnforcer interface {
	Enforce(ctx context.Context, session pbv1.Session, value protoreflect.Value) (context.Context, error)
}

type RightsEnforcerDescriptor

type RightsEnforcerDescriptor struct {
	Name           string
	RightsEnforcer RightsEnforcer
}

type RightsEnforcerDescriptorOut

type RightsEnforcerDescriptorOut struct {
	fx.Out
	Descriptor RightsEnforcerDescriptor `group:"rights_enforcer"`
}

type RoleEnforcer

type RoleEnforcer interface {
	Enforce(session pbv1.Session, role pbv1.Role, permission pbv1.Permission) (bool, error)
}

func NewFxRoleEnforcer

func NewFxRoleEnforcer(
	logger log.Logger,
	configProvider application.Provider,
) (RoleEnforcer, error)

type RoleEnforcerConfig

type RoleEnforcerConfig struct {
	ModelFile  string `yaml:"model_file"`
	PolicyFile string `yaml:"policy_file"`
}

type SessionClaims

type SessionClaims struct {
	jwt.StandardClaims
	pbv1.Session
}

func (SessionClaims) Valid

func (c SessionClaims) Valid() error

type SessionConfig

type SessionConfig struct {
	Audience string        `yaml:"audience"`
	Issuer   string        `yaml:"issuer"`
	Duration time.Duration `yaml:"duration"`
}

type SessionManager

type SessionManager interface {
	CreateTokenBySession(context.Context, pbv1.Session) (string, error)
	CreateToken(ctx context.Context, userUUID string, group pbv1.UserGroup) (string, error)
	GetSessionByToken(ctx context.Context, token string) (pbv1.Session, error)
}

func NewFxSessionManager

func NewFxSessionManager(
	provider application.Provider,
	logger log.Logger,
	jwtHelper JWTHelper,
) (SessionManager, error)

type SslConfig

type SslConfig struct {
	CertFile       string `yaml:"cert_file"`
	PrivateKeyFile string `yaml:"private_key_file"`
	PublicKeyFile  string `yaml:"public_key_file"`
}

Jump to

Keyboard shortcuts

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