authhandler

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	AuthService    *domain.AuthService
	CookieService  *domain.CookieService
	AuthMiddleware *authmiddleware.AuthMiddleware
}

AuthHandler is the handler that manages authentication for the API.

func Provide

func Provide(authService domain.AuthService, cookieService domain.CookieService, authMiddleware *authmiddleware.AuthMiddleware) *AuthHandler

Provide provides a new AuthHandler containing the given AuthService.

func (*AuthHandler) Login

func (a *AuthHandler) Login(c *gin.Context)

Login attempts to authenticate the given credentials retrieved from the body as JSON.

func (*AuthHandler) Logout

func (a *AuthHandler) Logout(c *gin.Context)

Logout attempts to unauthenticate the given credentials retrieved from the body as JSON.

func (*AuthHandler) Refresh

func (a *AuthHandler) Refresh(c *gin.Context)

Refresh attempts to preform a refresh for a user's auth token.

func (*AuthHandler) Register

func (a *AuthHandler) Register(parentGroup *gin.RouterGroup) error

Register creates three endpoints to handle login, logout, and refresh functionality. / (POST) - Login / (DELETE) - Logout /refresh (POST) - Refresh

Jump to

Keyboard shortcuts

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