mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-05-09 09:48:20 +00:00
add MFA structs, Make Callback Public
This commit is contained in:
parent
21c833b742
commit
f01926b1c5
3 changed files with 17 additions and 3 deletions
|
@ -58,8 +58,8 @@ start:
|
|||
// if we are here this probably means that the MFA callback is broken, to prevent a infinit loop lets error here
|
||||
return r, &res, fmt.Errorf("Got MFA challenge twice in a row, is your MFA Callback broken? Bailing to prevent loop...:")
|
||||
}
|
||||
if c.mfaCallback != nil {
|
||||
err = c.mfaCallback(c, &res)
|
||||
if c.MFACallback != nil {
|
||||
err = c.MFACallback(ctx, c, &res)
|
||||
if err != nil {
|
||||
return r, &res, fmt.Errorf("MFA Callback: %w", err)
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@ type Client struct {
|
|||
userPublicKey string
|
||||
userID string
|
||||
|
||||
mfaCallback func(c *Client, res *APIResponse) error
|
||||
// used for solving MFA challanges. You can block this to for example wait for user input. You shouden't run any unrelated API Calls while you are in this callback.
|
||||
MFACallback func(ctx context.Context, c *Client, res *APIResponse) error
|
||||
|
||||
// Enable Debug Logging
|
||||
Debug bool
|
||||
|
|
13
api/mfa.go
Normal file
13
api/mfa.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package api
|
||||
|
||||
type MFAChallange struct {
|
||||
Provider MFAProviders `json:"providers,omitempty"`
|
||||
}
|
||||
|
||||
type MFAProviders struct {
|
||||
TOTP string `json:"totp,omitempty"`
|
||||
}
|
||||
|
||||
type MFAChallangeResponse struct {
|
||||
TOTP string `json:"totp,omitempty"`
|
||||
}
|
Loading…
Add table
Reference in a new issue