userauth

package
v0.0.0-...-29c7da1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package userauth contains the User/Authentication HTTP endpoint logic/router group

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	GetJWT(ctx *gin.Context) (users.User, error)
}

Authenticator is the interface for objects that allow JWT authentication for other (non-sign in) endpoints

type GroupPlanClaims

type GroupPlanClaims struct {
	jwt.StandardClaims
	Email       string `json:"email"`
	AvatarURL   string `json:"pfp"`
	DisplayName string `json:"name"`
}

GroupPlanClaims is the JWT authentication claims object for GroupPlan

type Handler

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

Handler is the object responsible for the /auth endpoint

func New

func New(router *gin.Engine, userH *userman.Manager, cfg config.AppSettings) *Handler

New creates a new instance of the authentication Handler

func (Handler) AuthCallback

func (h Handler) AuthCallback(ctx *gin.Context)

AuthCallback is the HTTP endpoint for the Discord authorization callback

func (Handler) GetJWT

func (h Handler) GetJWT(ctx *gin.Context) (users.User, error)

GetJWT takes the request context and returns a parsed claim object if the authentication is valid

func (Handler) StartAuth

func (h Handler) StartAuth(ctx *gin.Context)

StartAuth is the endpoint to begin the authentication process

Jump to

Keyboard shortcuts

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