auth

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// TokenFactory instance used for generating and validating token
	TokenFactory helper.TokenFactory
)

Functions

func Authentication

func Authentication(w http.ResponseWriter, r *http.Request)

Authentication serve normal authentication

func Authentication2FA

func Authentication2FA(w http.ResponseWriter, r *http.Request)

Authentication2FA serve authentication with 2fa secret key

func InitializeAuthRouter

func InitializeAuthRouter(router *mux.Router)

InitializeAuthRouter initializes the module's repository and routing

func Refresh

func Refresh(w http.ResponseWriter, r *http.Request)

Refresh serves token refresh

func TwoFA

func TwoFA(w http.ResponseWriter, r *http.Request)

TwoFA validate 2FA token and authenticate the user

func TwoFATest

func TwoFATest(w http.ResponseWriter, r *http.Request)

TwoFATest is an endpoint handler used for testing 2FA

Types

type RefreshResponse

type RefreshResponse struct {
	AccessToken string `json:"access_token"`
}

RefreshResponse a model for responding successful refresh

type Request

type Request struct {
	Email      string `json:"email"`
	Passphrase string `json:"passphrase"`
}

Request a model for authentication request.

type RequestWith2FA

type RequestWith2FA struct {
	Email      string `json:"email"`
	Passphrase string `json:"passphrase"`
	SecretKey  string `json:"2FA_recovery_code"`
}

RequestWith2FA a model for authentication using 2fa secret key

type Response

type Response struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

Response a model for responding successful authentication

type TwoFARequest

type TwoFARequest struct {
	Token string `json:"2FA_token"`
	Otp   string `json:"2FA_otp"`
}

TwoFARequest model for sending 2FA authentication

type TwoFATestRequest

type TwoFATestRequest struct {
	Email string `json:"email"`
	Otp   string `json:"2FA_otp"`
}

TwoFATestRequest model for sending 2FA authentication

Jump to

Keyboard shortcuts

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