services

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePermissions

func ValidatePermissions(perms ...string) (valid bool, messages map[string]string)

Types

type AuthService

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

AuthService contains auth related operations

func NewAuthService

func NewAuthService(log *zerolog.Logger, userService *UserService, permService *PermissionsService, options *models.AuthOptions) *AuthService

NewAuthService configures a new instance of AuthService

func (*AuthService) Callback

func (s *AuthService) Callback(c *gin.Context, ctx context.Context, provider, state, code, callbackErr, errDescription string) (token string, err error)

Callback processes the OIDC flow return values

func (*AuthService) Login

func (s *AuthService) Login(provider string) (redirect string, err error)

Login gets the OIDC login URL for the given provider

func (*AuthService) Token

func (s *AuthService) Token(ctx context.Context, subject string) (token *pkgModels.Token, err error)

Token generates an auth token for the given user

func (*AuthService) Verify

func (s *AuthService) Verify(tok string) (bool, jwt.Token)

Verify parses and verifies the provided token

type PermissionsService

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

func NewPermissionsService

func NewPermissionsService(log *zerolog.Logger, options *models.PermissionsOptions) *PermissionsService

NewPermissionService initialises a new PermissionService based on the options supplied

func (*PermissionsService) DefaultPermissions

func (s *PermissionsService) DefaultPermissions() (out []string)

func (*PermissionsService) ListPermissions

func (s *PermissionsService) ListPermissions() (out []string, err error)

type UserService

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

func NewUserService

func NewUserService(log *zerolog.Logger, backend backends.Backend) *UserService

NewUserService initialises a new UserService based on the options supplied

func (*UserService) CreateUser

func (s *UserService) CreateUser(ctx context.Context, in *models.User) (out *models.User, err error)

CreateUser uses the configured backend to create the supplied user after having validted it

func (*UserService) DeleteUser

func (s *UserService) DeleteUser(ctx context.Context, sub string) error

DeleteUser uses the configured backend to mark the user as deleted

func (*UserService) GetUser

func (s *UserService) GetUser(ctx context.Context, sub string) (out *models.User, err error)

GetUser uses the configured backend to get a single user based on it's subject claim

func (*UserService) ListUsers

func (s *UserService) ListUsers(ctx context.Context) (out []*models.User, err error)

ListUsers uses the configured backend to list all users

func (*UserService) UpdateUser

func (s *UserService) UpdateUser(ctx context.Context, in *models.User, sub string) (out *models.User, err error)

CreateUser uses the configured backend to update the supplied user after having validted it

Jump to

Keyboard shortcuts

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