authenticating

package
v0.0.0-...-43fa908 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type AuthenticateAPI

type AuthenticateAPI struct {
	AuthenticateService AuthenticateService
}

func (*AuthenticateAPI) Create

func (a *AuthenticateAPI) Create(c *gin.Context)

type AuthenticateService

type AuthenticateService interface {
	Save(user User) User
	FindByUsername(username string) (User, error)
}

func ProviderAuthenticatingService

func ProviderAuthenticatingService(u UserRepository) AuthenticateService

type Login

type Login struct {
	Username string `form:"username" json:"username" binding:"required"`
	Password string `form:"password" json:"password" binding:"required"`
}

type User

type User struct {
	gorm.Model
	UserName  string
	FirstName string
	LastName  string
	Password  string
}

User defines the properties of a user to be authenticated

func ToUser

func ToUser(userDTO UserDTO) User

type UserDTO

type UserDTO struct {
	ID        uint   `json:"id,string,omitempty"`
	UserName  string `json:"username"`
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
	Password  string `json:"password"`
}

func ToUserDTO

func ToUserDTO(user User) UserDTO

type UserRepository

type UserRepository interface {
	Save(user User) User
	FindByUsername(username string) User
}

Jump to

Keyboard shortcuts

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