tfa

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntriesType_TOTP     EntriesType = "totp"
	EntriesType_U2F      EntriesType = "u2f"
	EntriesType_WEBAUTHN EntriesType = "webauthn"
	EntriesType_RECOVERY EntriesType = "recovery"
	EntriesType_YUBICO   EntriesType = "yubico"

	Type_TOTP     Type = "totp"
	Type_U2F      Type = "u2f"
	Type_WEBAUTHN Type = "webauthn"
	Type_RECOVERY Type = "recovery"
	Type_YUBICO   Type = "yubico"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildCreateRequest

type ChildCreateRequest struct {
	Type   Type   `url:"type" json:"type"`     // TFA Entry Type.
	Userid string `url:"userid" json:"userid"` // Full User ID, in the `name@realm` format.

	// The following parameters are optional
	Challenge   *string `url:"challenge,omitempty" json:"challenge,omitempty"`     // When responding to a u2f challenge: the original challenge string
	Description *string `url:"description,omitempty" json:"description,omitempty"` // A description to distinguish multiple entries from one another
	Password    *string `url:"password,omitempty" json:"password,omitempty"`       // The current password.
	Totp        *string `url:"totp,omitempty" json:"totp,omitempty"`               // A totp URI.
	Value       *string `url:"value,omitempty" json:"value,omitempty"`             // The current value for the provided totp URI, or a Webauthn/U2F challenge response
}

type ChildCreateResponse

type ChildCreateResponse struct {
	Id string `url:"id" json:"id"` // The id of a newly added TFA entry.

	// The following parameters are optional
	Challenge *string   `url:"challenge,omitempty" json:"challenge,omitempty"` // When adding u2f entries, this contains a challenge the user must respond to in order to finish the registration.
	Recovery  *[]string `url:"recovery,omitempty" json:"recovery,omitempty"`   // When adding recovery codes, this contains the list of codes to be displayed to the user
}

type Client

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

func New

func New(c HTTPClient) *Client

func (*Client) ChildCreate

func (c *Client) ChildCreate(ctx context.Context, req ChildCreateRequest) (ChildCreateResponse, error)

ChildCreate Add a TFA entry for a user.

func (*Client) Create

func (c *Client) Create(ctx context.Context, req CreateRequest) (CreateResponse, error)

Create Finish a u2f challenge.

func (*Client) DeleteTfaId

func (c *Client) DeleteTfaId(ctx context.Context, req DeleteTfaIdRequest) error

DeleteTfaId Delete a TFA entry by ID.

func (*Client) Find

func (c *Client) Find(ctx context.Context, req FindRequest) ([]FindResponse, error)

Find List TFA configurations of users.

func (*Client) GetTfaEntryId

func (c *Client) GetTfaEntryId(ctx context.Context, req GetTfaEntryIdRequest) (GetTfaEntryIdResponse, error)

GetTfaEntryId Fetch a requested TFA entry if present.

func (*Client) Index

func (c *Client) Index(ctx context.Context) ([]IndexResponse, error)

Index List TFA configurations of users.

func (*Client) UpdateTfaEntryId

func (c *Client) UpdateTfaEntryId(ctx context.Context, req UpdateTfaEntryIdRequest) error

UpdateTfaEntryId Add a TFA entry for a user.

type CreateRequest

type CreateRequest struct {
	Response string `url:"response" json:"response"` // The response to the current authentication challenge.

}

type CreateResponse

type CreateResponse struct {
	Ticket string `url:"ticket" json:"ticket"`
}

type DeleteTfaIdRequest

type DeleteTfaIdRequest struct {
	Id     string `url:"id" json:"id"`         // A TFA entry id.
	Userid string `url:"userid" json:"userid"` // Full User ID, in the `name@realm` format.

	// The following parameters are optional
	Password *string `url:"password,omitempty" json:"password,omitempty"` // The current password.
}

type Entries added in v0.0.10

type Entries struct {
	Created     int         `url:"created" json:"created"`         // Creation time of this entry as unix epoch.
	Description string      `url:"description" json:"description"` // User chosen description for this entry.
	Id          string      `url:"id" json:"id"`                   // The id used to reference this entry.
	Type        EntriesType `url:"type" json:"type"`               // TFA Entry Type.

	// The following parameters are optional
	Enable *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"` // Whether this TFA entry is currently enabled.
}

TFA Entry.

type EntriesType added in v0.0.15

type EntriesType string

func PtrEntriesType added in v0.0.15

func PtrEntriesType(i EntriesType) *EntriesType

type FindRequest

type FindRequest struct {
	Userid string `url:"userid" json:"userid"` // Full User ID, in the `name@realm` format.

}

type FindResponse

type FindResponse struct {
	Created     int    `url:"created" json:"created"`         // Creation time of this entry as unix epoch.
	Description string `url:"description" json:"description"` // User chosen description for this entry.
	Id          string `url:"id" json:"id"`                   // The id used to reference this entry.
	Type        Type   `url:"type" json:"type"`               // TFA Entry Type.

	// The following parameters are optional
	Enable *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"` // Whether this TFA entry is currently enabled.
}

TFA Entry.

type GetTfaEntryIdRequest

type GetTfaEntryIdRequest struct {
	Id     string `url:"id" json:"id"`         // A TFA entry id.
	Userid string `url:"userid" json:"userid"` // Full User ID, in the `name@realm` format.

}

type GetTfaEntryIdResponse

type GetTfaEntryIdResponse struct {
	Created     int    `url:"created" json:"created"`         // Creation time of this entry as unix epoch.
	Description string `url:"description" json:"description"` // User chosen description for this entry.
	Id          string `url:"id" json:"id"`                   // The id used to reference this entry.
	Type        Type   `url:"type" json:"type"`               // TFA Entry Type.

	// The following parameters are optional
	Enable *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"` // Whether this TFA entry is currently enabled.
}

TFA Entry.

type HTTPClient

type HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexResponse

type IndexResponse struct {
	Entries []Entries `url:"entries" json:"entries"`
	Userid  string    `url:"userid" json:"userid"` // User this entry belongs to.

}

type Type added in v0.0.15

type Type string

func PtrType added in v0.0.15

func PtrType(i Type) *Type

type UpdateTfaEntryIdRequest

type UpdateTfaEntryIdRequest struct {
	Id     string `url:"id" json:"id"`         // A TFA entry id.
	Userid string `url:"userid" json:"userid"` // Full User ID, in the `name@realm` format.

	// The following parameters are optional
	Description *string       `url:"description,omitempty" json:"description,omitempty"` // A description to distinguish multiple entries from one another
	Enable      *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"`           // Whether the entry should be enabled for login.
	Password    *string       `url:"password,omitempty" json:"password,omitempty"`       // The current password.
}

Jump to

Keyboard shortcuts

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