html

package
v0.1.1-0...-f9b01a3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CookieKeyWebCookieToken cookie key to keep the web cookie token.
	CookieKeyWebCookieToken = "identifo-user"
)
View Source
const (
	// ErrorRegistrationForbidden means that registration is forbidden.
	ErrorRegistrationForbidden = Error("Registration in this app is forbidden.")
)
View Source
const (
	// FlashErrorMessageKey flash message key to keep error message across pages.
	FlashErrorMessageKey = "error"
)
View Source
const (
	// FormKeyAppID is a form key to keep application ID.
	FormKeyAppID = "appId"
)

Variables

This section is empty.

Functions

func CorsOption

func CorsOption(corsOptions *model.CorsOptions) func(*Router) error

CorsOption sets cors option.

func GetFlash

func GetFlash(w http.ResponseWriter, r *http.Request, name string) (string, error)

GetFlash gets flash message

func HostOption

func HostOption(host string) func(r *Router) error

HostOption sets hostname.

func NewRouter

NewRouter creates and initializes new router.

func PathPrefixOptions

func PathPrefixOptions(prefix string) func(r *Router) error

PathPrefixOptions set path prefix options.

func SetFlash

func SetFlash(w http.ResponseWriter, name, value string)

SetFlash sets new flash message

Types

type Error

type Error string

Error - http level error type.

func (Error) Error

func (e Error) Error() string

Error implements std.Error interface.

type Router

type Router struct {
	Middleware     *negroni.Negroni
	Logger         *log.Logger
	Router         *mux.Router
	AppStorage     model.AppStorage
	UserStorage    model.UserStorage
	TokenStorage   model.TokenStorage
	TokenBlacklist model.TokenBlacklist
	TokenService   jwtService.TokenService
	SMSService     model.SMSService
	EmailService   model.EmailService

	Authorizer *authorization.Authorizer
	PathPrefix string
	Host       string
	// contains filtered or unexported fields
}

Router handles incoming http connections.

func (*Router) AppID

func (ar *Router) AppID() negroni.HandlerFunc

AppID gets app id from the request body.

func (*Router) DisableTFA

func (ar *Router) DisableTFA() http.HandlerFunc

DisableTFA handles TFA disablement form submission (POST request).

func (*Router) DisableTFAHandler

func (ar *Router) DisableTFAHandler() http.HandlerFunc

DisableTFAHandler handles disable TFA GET request.

func (*Router) DumpRequest

func (ar *Router) DumpRequest() negroni.HandlerFunc

DumpRequest dumps request to logger.

func (*Router) Error

func (ar *Router) Error(w http.ResponseWriter, err error, code int, userInfo string)

Error writes an API error message to the response and logger.

func (*Router) HTMLFileHandler

func (ar *Router) HTMLFileHandler(templateName string) http.HandlerFunc

HTMLFileHandler receives path to a template and serves it over HTTP.

func (*Router) Login

func (ar *Router) Login() http.HandlerFunc

Login logs user in with email and password.

func (*Router) LoginHandler

func (ar *Router) LoginHandler() http.HandlerFunc

LoginHandler serves login page or redirects to the callback_url if user is already authenticated.

func (*Router) Logout

func (ar *Router) Logout() http.HandlerFunc

Logout removes user's session.

func (*Router) Register

func (ar *Router) Register() http.HandlerFunc

Register creates user.

func (*Router) RegistrationHandler

func (ar *Router) RegistrationHandler() http.HandlerFunc

RegistrationHandler serves registration page.

func (*Router) RenewToken

func (ar *Router) RenewToken() http.HandlerFunc

RenewToken creates new id_token if user is already authenticated.

func (*Router) ResetPassword

func (ar *Router) ResetPassword() http.HandlerFunc

ResetPassword handles password reset form submission (POST request).

func (*Router) ResetPasswordHandler

func (ar *Router) ResetPasswordHandler() http.HandlerFunc

ResetPasswordHandler handles reset password GET request.

func (*Router) ResetTFA

func (ar *Router) ResetTFA() http.HandlerFunc

ResetTFA handles TFA resetting form submission (POST request).

func (*Router) ResetTFAHandler

func (ar *Router) ResetTFAHandler() http.HandlerFunc

ResetTFAHandler handles reset TFA GET request.

func (*Router) ResetTokenMiddleware

func (ar *Router) ResetTokenMiddleware() negroni.HandlerFunc

ResetTokenMiddleware extracts reset token and validates it.

func (*Router) SendResetToken

func (ar *Router) SendResetToken() http.HandlerFunc

SendResetToken POST form request handle with password request handle

func (*Router) ServeHTTP

func (ar *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements identifo.Router interface.

Jump to

Keyboard shortcuts

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