Documentation
¶
Index ¶
- func CreateTokenFor(userId string) (string, error)
- func DeleteJWTCookie(c echo.Context)
- func ParseToken(jwtToken string) (*jwt.Token, error)
- func SetJWTCookie(c echo.Context, token string)
- type AuthDriver
- type AuthHandler
- type Driver
- type Email
- type EmailResponse
- type Module
- type User
- type UserDriver
- type UserDriverMock
- func (d *UserDriverMock) FindUserByEmail(email string) (*User, error)
- func (d *UserDriverMock) FindUserByID(id string) (*User, error)
- func (d *UserDriverMock) InsertUser(u *User) (*User, error)
- func (d *UserDriverMock) UpdateUserEmail(user *User) error
- func (d *UserDriverMock) UpdateUserNotification(user *User) error
- type UserRequest
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTokenFor ¶
func DeleteJWTCookie ¶
func ParseToken ¶
func SetJWTCookie ¶
Types ¶
type AuthDriver ¶
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(mongoDB *mongodb.MongoDB) *AuthHandler
func (*AuthHandler) TokenAuthentication ¶
func (h *AuthHandler) TokenAuthentication(next echo.HandlerFunc) echo.HandlerFunc
type Email ¶
type Email struct { Address string `validate:"required,max=64,email" json:"address" bson:"address"` Hash string `json:"hash" bson:"hash"` Confirmed bool `json:"confirmed" bson:"confirmed"` ExpireAt time.Time `json:"expireAt" bson:"expireAt"` ConfirmedAt time.Time `json:"confirmedAt" bson:"confirmedAt"` ConfirmationRequested bool `json:"confirmationRequested" bson:"confirmationRequested"` }
type EmailResponse ¶
type Module ¶
type Module struct { Handler *handler // contains filtered or unexported fields }
func (*Module) RegisterRoutes ¶
type User ¶
type User struct { ID string `json:"id,omitempty" bson:"_id"` Email Email `validate:"required" json:"email" bson:"email"` Password string `validate:"required,max=128" json:"password" bson:"password"` Notification bool `json:"notification,omitempty" bson:"notification" query:"notification"` }
func NewUser ¶
func NewUser(u UserRequest) *User
type UserDriver ¶
type UserDriver struct {
// contains filtered or unexported fields
}
func (*UserDriver) FindUserByEmail ¶
func (d *UserDriver) FindUserByEmail(email string) (*User, error)
func (*UserDriver) FindUserByID ¶
func (d *UserDriver) FindUserByID(id string) (*User, error)
func (*UserDriver) InsertUser ¶
func (d *UserDriver) InsertUser(u *User) (*User, error)
func (*UserDriver) UpdateUserEmail ¶
func (d *UserDriver) UpdateUserEmail(user *User) error
func (*UserDriver) UpdateUserNotification ¶
func (d *UserDriver) UpdateUserNotification(user *User) error
type UserDriverMock ¶
type UserDriverMock struct { InsertUserCalled bool InsertedUser *User InsertUserErr error FindUserByEmailCalled bool FindUserByEmailUser *User FindUserByEmailErr error FindUserByIDCalled bool FindUserByIDUser *User FindUserByIDErr error UpdateUserNotificationCalled bool UpdateUserNotificationUser *User UpdateUserNotificationErr error UpdateUserEmailCalled bool UpdateUserEmailUser *User UpdateUserEmailErr error }
func (*UserDriverMock) FindUserByEmail ¶
func (d *UserDriverMock) FindUserByEmail(email string) (*User, error)
func (*UserDriverMock) FindUserByID ¶
func (d *UserDriverMock) FindUserByID(id string) (*User, error)
func (*UserDriverMock) InsertUser ¶
func (d *UserDriverMock) InsertUser(u *User) (*User, error)
func (*UserDriverMock) UpdateUserEmail ¶
func (d *UserDriverMock) UpdateUserEmail(user *User) error
func (*UserDriverMock) UpdateUserNotification ¶
func (d *UserDriverMock) UpdateUserNotification(user *User) error
type UserRequest ¶
type UserResponse ¶
type UserResponse struct { ID string `json:"id,omitempty" bson:"_id"` Email EmailResponse `validate:"required" json:"email" bson:"email"` }
Click to show internal directories.
Click to hide internal directories.