server

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: BSD-3-Clause Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionKeyAuthenticated = "authenticated"
	SessionKeySID           = "sid"
	SessionKeyUsername      = "user"
	SessionKeyCSRF          = "csrf"
	ContextKeyUser          = "user"
	ContextKeyUsername      = "username"
	ContextKeyIPAClient     = "ipa"
	UserCategoryUnverified  = "mokey-user-unverified"
	TokenAccountVerify      = "verify"
	TokenPasswordReset      = "reset"
	TokenUsedPrefix         = "used-"
	TokenIssuedPrefix       = "issued-"
)
View Source
const (
	DefaultPort = 80
)

Variables

View Source
var (
	PasswordCheckLower  = regexp.MustCompile(`[a-z]`)
	PasswordCheckUpper  = regexp.MustCompile(`[A-Z]`)
	PasswordCheckNumber = regexp.MustCompile(`[0-9]`)
	PasswordCheckMarks  = regexp.MustCompile(`[^0-9a-zA-Z]`)
)
View Source
var (
	ErrDomainNotAllowed = errors.New("Email domain not allowed")
	ErrInvalidUsername  = errors.New("Username is invalid. May only include letters, numbers, _, -, .")
)
View Source
var Version = "dev"

Functions

func AllowedDomains added in v0.6.0

func AllowedDomains() string

func BaseURL added in v0.6.0

func BaseURL(ctx *fiber.Ctx) string

func BreakNewlines added in v0.6.0

func BreakNewlines(s string) template.HTML

func ConfigValueBool added in v0.6.0

func ConfigValueBool(key string) bool

func ConfigValueString added in v0.6.0

func ConfigValueString(key string) string

func GenerateSecret added in v0.6.0

func GenerateSecret(n int) (string, error)

func GenerateSecretString added in v0.6.0

func GenerateSecretString(n int) (string, error)

func HTTPErrorHandler

func HTTPErrorHandler(c *fiber.Ctx, err error) error

func LimitReachedHandler added in v0.6.0

func LimitReachedHandler(c *fiber.Ctx) error

func NewToken added in v0.6.0

func NewToken(username, email, prefix string, storage fiber.Storage) (string, error)

func NotFoundHandler added in v0.6.0

func NotFoundHandler(c *fiber.Ctx) error

func QRCode added in v0.6.0

func QRCode(otptoken *ipa.OTPToken, realm string) (string, error)

func RemoteIP added in v0.6.0

func RemoteIP(c *fiber.Ctx) string

func SecureHeaders added in v0.6.0

func SecureHeaders(c *fiber.Ctx) error

func SetDefaults added in v0.6.0

func SetDefaults()

func SplitSSHFP added in v0.6.0

func SplitSSHFP(fp string) []string

func TimeAgo added in v0.6.0

func TimeAgo(t time.Time) string

Types

type Emailer added in v0.6.0

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

func NewEmailer added in v0.6.0

func NewEmailer(storage fiber.Storage) (*Emailer, error)

func (*Emailer) SendAccountVerifyEmail added in v0.6.0

func (e *Emailer) SendAccountVerifyEmail(user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendMFAChangedEmail added in v0.6.0

func (e *Emailer) SendMFAChangedEmail(enabled bool, user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendOTPTokenUpdatedEmail added in v0.6.0

func (e *Emailer) SendOTPTokenUpdatedEmail(added bool, user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendPasswordChangedEmail added in v0.6.0

func (e *Emailer) SendPasswordChangedEmail(user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendPasswordResetEmail added in v0.6.0

func (e *Emailer) SendPasswordResetEmail(user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendSSHKeyUpdatedEmail added in v0.6.0

func (e *Emailer) SendSSHKeyUpdatedEmail(added bool, user *ipa.User, ctx *fiber.Ctx) error

func (*Emailer) SendWelcomeEmail added in v0.6.0

func (e *Emailer) SendWelcomeEmail(user *ipa.User, ctx *fiber.Ctx) error

type FakeTLSTransport added in v0.5.3

type FakeTLSTransport struct {
	T http.RoundTripper
}

func (*FakeTLSTransport) RoundTrip added in v0.5.3

func (ftt *FakeTLSTransport) RoundTrip(req *http.Request) (*http.Response, error)

type Metrics added in v0.6.0

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

func NewMetrics added in v0.6.0

func NewMetrics() *Metrics

func (*Metrics) Handler added in v0.6.0

func (m *Metrics) Handler(c *fiber.Ctx) error

type Router added in v0.6.0

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

func NewRouter added in v0.6.0

func NewRouter(storage fiber.Storage) (*Router, error)

func (*Router) AccountCreate added in v0.6.0

func (r *Router) AccountCreate(c *fiber.Ctx) error

func (*Router) AccountSettings added in v0.6.0

func (r *Router) AccountSettings(c *fiber.Ctx) error

func (*Router) AccountVerify added in v0.6.0

func (r *Router) AccountVerify(c *fiber.Ctx) error

func (*Router) AccountVerifyResend added in v0.6.0

func (r *Router) AccountVerifyResend(c *fiber.Ctx) error

func (*Router) Authenticate added in v0.6.0

func (r *Router) Authenticate(c *fiber.Ctx) error

func (*Router) CSRF added in v0.6.0

func (r *Router) CSRF(c *fiber.Ctx) error

func (*Router) Captcha added in v0.6.0

func (r *Router) Captcha(c *fiber.Ctx) error

Captcha handler displays captcha image

func (*Router) CheckUser added in v0.6.0

func (r *Router) CheckUser(c *fiber.Ctx) error

func (*Router) ConsentGet added in v0.6.0

func (r *Router) ConsentGet(c *fiber.Ctx) error

func (*Router) HydraError added in v0.6.0

func (r *Router) HydraError(c *fiber.Ctx) error

func (*Router) Index added in v0.6.0

func (r *Router) Index(c *fiber.Ctx) error

func (*Router) Login added in v0.6.0

func (r *Router) Login(c *fiber.Ctx) error

func (*Router) LoginOAuthGet added in v0.6.0

func (r *Router) LoginOAuthGet(c *fiber.Ctx) error

func (*Router) LoginOAuthPost added in v0.6.0

func (r *Router) LoginOAuthPost(username, challenge string, c *fiber.Ctx) error
func (r *Router) Logo(c *fiber.Ctx) error

func (*Router) Logout added in v0.6.0

func (r *Router) Logout(c *fiber.Ctx) error

func (*Router) Metrics added in v0.6.0

func (r *Router) Metrics(c *fiber.Ctx) error

func (*Router) OTPTokenAdd added in v0.6.0

func (r *Router) OTPTokenAdd(c *fiber.Ctx) error

func (*Router) OTPTokenDisable added in v0.6.0

func (r *Router) OTPTokenDisable(c *fiber.Ctx) error

func (*Router) OTPTokenEnable added in v0.6.0

func (r *Router) OTPTokenEnable(c *fiber.Ctx) error

func (*Router) OTPTokenList added in v0.6.0

func (r *Router) OTPTokenList(c *fiber.Ctx) error

func (*Router) OTPTokenModal added in v0.6.0

func (r *Router) OTPTokenModal(c *fiber.Ctx) error

func (*Router) OTPTokenRemove added in v0.6.0

func (r *Router) OTPTokenRemove(c *fiber.Ctx) error

func (*Router) OTPTokenVerify added in v0.6.0

func (r *Router) OTPTokenVerify(c *fiber.Ctx) error

func (*Router) PasswordChange added in v0.6.0

func (r *Router) PasswordChange(c *fiber.Ctx) error

func (*Router) PasswordExpired added in v0.6.0

func (r *Router) PasswordExpired(c *fiber.Ctx) error

func (*Router) PasswordForgot added in v0.6.0

func (r *Router) PasswordForgot(c *fiber.Ctx) error

func (*Router) PasswordReset added in v0.6.0

func (r *Router) PasswordReset(c *fiber.Ctx) error

func (*Router) RequireHTMX added in v0.6.0

func (r *Router) RequireHTMX(c *fiber.Ctx) error

func (*Router) RequireLogin added in v0.6.0

func (r *Router) RequireLogin(c *fiber.Ctx) error

func (*Router) RequireMFA added in v0.6.0

func (r *Router) RequireMFA(c *fiber.Ctx) error

func (*Router) RequireNoLogin added in v0.6.0

func (r *Router) RequireNoLogin(c *fiber.Ctx) error

func (*Router) SSHKeyAdd added in v0.6.0

func (r *Router) SSHKeyAdd(c *fiber.Ctx) error

func (*Router) SSHKeyList added in v0.6.0

func (r *Router) SSHKeyList(c *fiber.Ctx) error

func (*Router) SSHKeyModal added in v0.6.0

func (r *Router) SSHKeyModal(c *fiber.Ctx) error

func (*Router) SSHKeyRemove added in v0.6.0

func (r *Router) SSHKeyRemove(c *fiber.Ctx) error

func (*Router) SecurityList added in v0.6.0

func (r *Router) SecurityList(c *fiber.Ctx) error

func (*Router) SetupRoutes added in v0.6.0

func (r *Router) SetupRoutes(app *fiber.App)

func (*Router) Styles added in v0.6.0

func (r *Router) Styles(c *fiber.Ctx) error

func (*Router) TwoFactorDisable added in v0.6.0

func (r *Router) TwoFactorDisable(c *fiber.Ctx) error

func (*Router) TwoFactorEnable added in v0.6.0

func (r *Router) TwoFactorEnable(c *fiber.Ctx) error

type Server added in v0.6.0

type Server struct {
	ListenAddress string
	Scheme        string
	KeyFile       string
	CertFile      string
	// contains filtered or unexported fields
}

func NewServer added in v0.6.0

func NewServer(address string) (*Server, error)

func (*Server) Serve added in v0.6.0

func (s *Server) Serve() error

func (*Server) Shutdown added in v0.6.0

func (s *Server) Shutdown(ctx context.Context) error

type TemplateRenderer

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

func NewTemplateRenderer

func NewTemplateRenderer() (*TemplateRenderer, error)

func (*TemplateRenderer) Load added in v0.6.0

func (t *TemplateRenderer) Load() error

func (*TemplateRenderer) Render

func (t *TemplateRenderer) Render(w io.Writer, name string, data interface{}, layouts ...string) error

type Token added in v0.6.0

type Token struct {
	Username  string    `json:"username"`
	Email     string    `json:"email"`
	Timestamp time.Time `json:"-"`
}

func ParseToken added in v0.6.0

func ParseToken(token, prefix string, storage fiber.Storage) (*Token, error)

Jump to

Keyboard shortcuts

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