auth

package
v1.3.37 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoginWithEmailAndPasswordHandler

func LoginWithEmailAndPasswordHandler(getUserByEmail func(email string) (AuthUserEmail, error)) func(c *fiber.Ctx) error

func LoginWithPhoneOTPHandler

func LoginWithPhoneOTPHandler(getUserByPhone func(phone string) (AuthUserPhone, error)) func(c *fiber.Ctx) error

func VerifyPhoneOTPHandler

func VerifyPhoneOTPHandler(getUserByPhone func(phone string) (AuthUserPhone, error)) func(c *fiber.Ctx) error

Types

type AuthUserEmail

type AuthUserEmail interface {
	GetEmail() string
	GetPassword() string
	GetID() string
	JWTClaimsProvider
}

type AuthUserPhone

type AuthUserPhone interface {
	GetPhone() string
	GetPassword() string
	GetID() string
	JWTClaimsProvider
}

func NewAuthUserEmail added in v1.2.23

func NewAuthUserEmail(email, password, id string) AuthUserPhone

func NewAuthUserPhone added in v1.2.23

func NewAuthUserPhone(phone, password, id string) AuthUserPhone

type GoogleAuth added in v1.2.12

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

func InitializeGoogleAuth added in v1.2.12

func InitializeGoogleAuth(config GoogleConfig) *GoogleAuth

func NewGoogleAuth added in v1.2.12

func NewGoogleAuth(config GoogleConfig) *GoogleAuth

func (*GoogleAuth) GetGoogleOauthURL added in v1.2.12

func (ga *GoogleAuth) GetGoogleOauthURL() string

func (*GoogleAuth) GetSessionData added in v1.2.19

func (ga *GoogleAuth) GetSessionData() func(c *fiber.Ctx) error

func (*GoogleAuth) GoogleCallbackBuilder added in v1.2.12

func (ga *GoogleAuth) GoogleCallbackBuilder(callbackHandler func(c *fiber.Ctx, user *models.GoogleCallbackData, tokenSess *session.Session) error) func(c *fiber.Ctx) error

func (*GoogleAuth) GoogleHandleCallback added in v1.2.12

func (ga *GoogleAuth) GoogleHandleCallback() func(c *fiber.Ctx) error

func (*GoogleAuth) GoogleLoginBuilder added in v1.2.12

func (ga *GoogleAuth) GoogleLoginBuilder(authHandler func(c *fiber.Ctx) error) func(c *fiber.Ctx) error

func (*GoogleAuth) GoogleLoginHandler added in v1.2.12

func (ga *GoogleAuth) GoogleLoginHandler() func(c *fiber.Ctx) error

func (*GoogleAuth) IsGoogleAuthenticated added in v1.2.12

func (ga *GoogleAuth) IsGoogleAuthenticated(c *fiber.Ctx) bool

func (*GoogleAuth) RequireGoogleAuth added in v1.2.12

func (ga *GoogleAuth) RequireGoogleAuth() func(c *fiber.Ctx) error

type GoogleCallbackData added in v1.2.15

type GoogleCallbackData struct {
	Email         string `json:"email"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	VerifiedEmail bool   `json:"verified_email"`
	ID            string `json:"id"`
}

type GoogleConfig added in v1.2.12

type GoogleConfig struct {
	CookieExpiration time.Duration
	CookieDomain     string
	CookieHTTPSOnly  bool
	OAuthStateString string
}

type JWTClaimsProvider

type JWTClaimsProvider interface {
	AdditionalClaims() map[string]interface{}
	SetAdditionalClaims(claims map[string]interface{})
}

type LoginWithEmailAndPasswordRequest

type LoginWithEmailAndPasswordRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginWithPhoneOTPRequest

type LoginWithPhoneOTPRequest struct {
	Phone string `json:"phone"`
}

type ResponseHTTP

type ResponseHTTP struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
	Message string      `json:"message"`
}

type User added in v1.2.23

type User struct {
	Id          string                 `json:"id"`
	Email       string                 `json:"email"`
	Phone       string                 `json:"phone"`
	Password    string                 `json:"password"`
	AddedClaims map[string]interface{} `json:"additional_claims"`
}

func (*User) AdditionalClaims added in v1.2.23

func (u *User) AdditionalClaims() map[string]interface{}

func (*User) GetEmail added in v1.2.23

func (u *User) GetEmail() string

func (*User) GetID added in v1.2.23

func (u *User) GetID() string

func (*User) GetJWTClaims added in v1.2.23

func (u *User) GetJWTClaims() map[string]interface{}

func (*User) GetPassword added in v1.2.23

func (u *User) GetPassword() string

func (*User) GetPhone added in v1.2.23

func (u *User) GetPhone() string

func (*User) SetAdditionalClaims added in v1.3.34

func (u *User) SetAdditionalClaims(claims map[string]interface{})

type VerifyPhoneOTPRequest

type VerifyPhoneOTPRequest struct {
	Phone string `json:"phone"`
	OTP   string `json:"otp"`
}

Jump to

Keyboard shortcuts

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