authentication

package
v0.0.0-...-10d5746 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: AGPL-3.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTicketValidationFailed = errors.NewErrUnauthorized("La validation du ticket a échoué.")
)
View Source
var (
	ErrUnauthorized = errors.NewErrUnauthorized("Accès non autorisé")
)

Functions

This section is empty.

Types

type AuthenticationService

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

func New

func New(repo Repository, sso Sso, sessions sessions.Sessions) *AuthenticationService

func (*AuthenticationService) Login

func (service *AuthenticationService) Login(ticket string) (*LoginResult, error)

func (*AuthenticationService) Logout

func (service *AuthenticationService) Logout(token string) error

func (*AuthenticationService) ValidateToken

func (service *AuthenticationService) ValidateToken(token string) (*domain.UserContext, error)

type LoginResult

type LoginResult struct {
	Token string      `json:"token"`
	User  models.User `json:"user"`
}

type Repository

type Repository interface {
	GetUserByEmail(email string) (*models.User, error)
	GetUserByID(id int64) (*models.User, error)
}

type Sso

type Sso interface {
	ValidateTicket(ticket string) (string, error)
}

type SsoConfig

type SsoConfig struct {
	URL string `json:"url" default:"https://authentification.din.developpement-durable.gouv.fr/cas/public"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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