services

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 17 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.Auth) *AuthService

NewAuthService configures a new instance of AuthService

func (*AuthService) Callback

func (s *AuthService) Callback(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(subject string) (token *models.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) *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(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(sub string) error

DeleteUser uses the configured backend to mark the user as deleted

func (*UserService) GetUser

func (s *UserService) GetUser(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() (out *[]models.User, err error)

ListUsers uses the configured backend to list all users

func (*UserService) UpdateUser

func (s *UserService) UpdateUser(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