auth

package
v0.0.0-...-2eb00bf Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeGetOauthCallbackEndpoint

func MakeGetOauthCallbackEndpoint(s Service) endpoint.Endpoint

func MakeGetOauthUrlEndpoint

func MakeGetOauthUrlEndpoint(s Service) endpoint.Endpoint

func MakeHandler

func MakeHandler(authSvc Service, logger log.Logger) http.Handler

func MakeLogoutEndpoint

func MakeLogoutEndpoint(s Service) endpoint.Endpoint

Types

type Endpoints

type Endpoints struct {
	LogoutEndpoint           endpoint.Endpoint
	GetOauthUrlEndpoint      endpoint.Endpoint
	GetOauthCallbackEndpoint endpoint.Endpoint
}

func MakeEndpoints

func MakeEndpoints(s Service) Endpoints

type MailxClaims

type MailxClaims struct {
	ID string
	jwt.StandardClaims
}

type Service

type Service interface {
	// Creates the oath authorization URL
	GetOauthUrl(context.Context) (string, error)
	// Generates the token access after a successful sign in
	GenerateOauthToken(context.Context, string) (*oauth2.Token, error)
	// Configuration of a gmail service for a current user
	ConfigGmailServiceUser(context.Context, string) (*models.User, error)
	// CreateJWT generates a json web token for mailx-google-service authentication.
	CreateJWT(context.Context, *models.User) (string, error)
}

func New

func New(logger log.Logger, config google.OAuthConfiguration, repo repos.Repository, mailx mailx.Service) Service

New creates a new Auth Service.

Jump to

Keyboard shortcuts

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