auth

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserTable = "user"
)

Variables

View Source
var UserModelStruct = sqlbuilder.NewStruct(new(UserModel))

Functions

func Init

func Init(app *fiber.App, db *sql.DB) error

func RequiresValidAccessToken

func RequiresValidAccessToken(handler FiberClaimsHandler) common.FiberHandler

func T_Login_fail added in v0.11.0

func T_Login_fail(t *testing.T, app *fiber.App, r LoginRequest) (int, common.OutboundErrResponse)

Types

type ChangePasswordRequest added in v0.9.0

type ChangePasswordRequest struct {
	NewPassword string `json:"new_password"`
}

type ChangePasswordResponse added in v0.9.0

type ChangePasswordResponse struct {
	Success bool `json:"success"`
}

func T_ChangePassword_ok added in v0.11.0

func T_ChangePassword_ok(t *testing.T, app *fiber.App, r ChangePasswordRequest, o commontest.AuthOpts) (int, ChangePasswordResponse)

type ClaimsHttpHandler

type ClaimsHttpHandler func(http.ResponseWriter, *http.Request, jwt.Claims)

type FiberClaimsHandler added in v0.5.0

type FiberClaimsHandler func(*fiber.Ctx, jwt.Claims) error

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Username     string `json:"username,omitempty"`
	AccessToken  string `json:"access_token,omitempty"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

func T_Login_ok added in v0.11.0

func T_Login_ok(t *testing.T, app *fiber.App, r LoginRequest) (int, LoginResponse)

type RefreshTokenResponse

type RefreshTokenResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToekn string `json:"refresh_token"`
}

type RegisterNewUserRequest

type RegisterNewUserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type RegisterNewUserResponse

type RegisterNewUserResponse struct {
	Success bool `json:"success"`
}

func T_RegisterUser added in v0.11.0

func T_RegisterUser(t *testing.T, app *fiber.App, r RegisterNewUserRequest) (int, RegisterNewUserResponse)

type User

type User struct {
	Username string
	Password string
}

type UserModel

type UserModel struct {
	Username string `db:"username"`
	Password string `db:"password"`
}

Jump to

Keyboard shortcuts

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