routes

package
v0.0.0-...-68e8b16 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingUserContext = errors.New("no user context provided") // ErrMissingUserContext is returned when no context is found while attempting to load user from http.Requests context.
)

Functions

func NewGoogleAuthenticationRoutes

func NewGoogleAuthenticationRoutes(router net.AppRouter, gAuthService service.GoogleAuthenicationService, jwtAuthService service.AuthenticationService, lw logging.LogWriter) *googleAuthenticationRoutes

NewGoogleAuthenticationRoutes creates routes using GoogleAuthenicationService and mounts them to the provided router.

func NewJsonWebTokenAuthenticationRoutes

func NewJsonWebTokenAuthenticationRoutes(router net.AppRouter, authService service.AuthenticationService, jwtService *service.JsonWebTokenService, lw logging.LogWriter) *jwtAuthRoutes

NewJsonWebTokenAuthenticationRoutes creates routes using AuthenticationService and JsonWebTokenService then mounts them to the provided router.

func NewJsonWebTokenUserRoutes

func NewJsonWebTokenUserRoutes(router net.AppRouter, userRepository repository.UserRepository, jwtService *service.JsonWebTokenService, lw logging.LogWriter) jwtUserRoutes

NewJsonWebTokenUserRoutes creates routes using UserRepository and JsonWebTokenService then mounts them to the provided router.

Types

type UserContextHelpers

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

func (UserContextHelpers) LoadUserFromContext

func (h UserContextHelpers) LoadUserFromContext(r *http.Request) (*models.UserModel, error)

LoadUserFromContext helper that attempts to read the http.Request's user context key or returns an error if it was not found.

func (UserContextHelpers) LoadUserFromContextWithRole

func (h UserContextHelpers) LoadUserFromContextWithRole(r *http.Request, role types.Role) (*models.UserModel, error)

Jump to

Keyboard shortcuts

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