localauth

package
v0.0.0-...-6aee27a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalAuthScheme

type LocalAuthScheme struct {
	RegistrationEnabled bool
}

LocalAuthScheme is a small structure capturing the data requirements specific to local authentication

func (LocalAuthScheme) BindRoutes

func (p LocalAuthScheme) BindRoutes(r chi.Router, bridge authschemes.AShirtAuthBridge)

BindRoutes creates many routes for local database routes:

* POST ${prefix}/register Flags that a new user should be created

* POST ${prefix}/login Verifies the username/password combo

* POST ${prefix}/login/resetpassword Second authentication step for users to reset their password if forced to

* PUT ${prefix}/password Allows users to change their password

* PUT ${prefix}/admin/password Allows admins to reset a user's password

* POST ${prefix}/admin/register Allows admins to create new users on behalf of that user.

* POST ${prefix}/link Adds local auth to a non-local user

* TOTP-Related

  • POST ${prefix}/login/totp Completes login with totp passcode
  • GET ${prefix}/totp Returns boolean true if the user has totp enabled, false otherwise
  • GET ${prefix}/totp/generate Returns a new generated totp secret/uri/qrcode
  • POST ${prefix}/totp Enables totp on a user's account by accepting a secret and verifying a corresponding one time passcode (errors if one already exists)
  • DELETE ${prefix}/totp Removes a totp secret from a user's account

In each case above, the actual action is deferred to the bridge connecting this auth scheme to the underlying system/database

func (LocalAuthScheme) Flags

func (s LocalAuthScheme) Flags() []string

Flags returns auth flags associated with local auth in particular, notes if registration is open or closed

func (LocalAuthScheme) FriendlyName

func (LocalAuthScheme) FriendlyName() string

FriendlyName returns "ASHIRT Local Authentication"

func (LocalAuthScheme) Name

func (LocalAuthScheme) Name() string

Name returns the name of this authscheme

func (LocalAuthScheme) Type

func (LocalAuthScheme) Type() string

type RegistrationInfo

type RegistrationInfo struct {
	Password           string
	Username           string
	Email              string
	FirstName          string
	LastName           string
	ForceResetPassword bool
}

type TOTPKey

type TOTPKey struct {
	URL    string `json:"url"`
	Secret string `json:"secret"`
	QRCode string `json:"qr"`
}

TOTPKey represents the secret and QR code for a given URL to authenticate with

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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