mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 02:58:20 +00:00
Merge pull request #30 from lenforiee/fix-spelling-mistakes
Fix spelling mistakes in the code
This commit is contained in:
commit
488bf7043a
4 changed files with 11 additions and 9 deletions
|
@ -84,7 +84,7 @@ For sharing with groups the `--group` argument exists.
|
|||
You can setup MFA also using the configuration sub command, only TOTP is supported, there are multiple modes for MFA: `none`, `interactive-totp` and `noninteractive-totp`.
|
||||
| Mode | Description |
|
||||
| --- | --- |
|
||||
|`none`|just errors if challanged for MFA.
|
||||
|`none`|just errors if challenged for MFA.
|
||||
|`interactive-totp` | prompts for interactive entry of TOTP Codes.
|
||||
|`noninteractive-totp` | automatically generates TOTP Codes when challenged, it requires the `totpToken` flag to be set to your totp Secret, you can configure the behavior using the `mfaDelay`, `mfaRetrys` and `totpOffset` flags
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.18
|
|||
|
||||
require (
|
||||
github.com/alessio/shellescape v1.4.1
|
||||
github.com/passbolt/go-passbolt v0.5.8
|
||||
github.com/passbolt/go-passbolt v0.6.0
|
||||
github.com/pterm/pterm v0.12.51
|
||||
github.com/spf13/cobra v1.6.1
|
||||
github.com/spf13/viper v1.14.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -203,6 +203,8 @@ github.com/passbolt/go-passbolt v0.5.7 h1:qpFZBcuyjcqUqnptnrCYTCOzzjtv7a8qTeohRU
|
|||
github.com/passbolt/go-passbolt v0.5.7/go.mod h1:drZXAx/5iLqH9MH46HCgy+taTkJ0Akw3igoBV8TnbF4=
|
||||
github.com/passbolt/go-passbolt v0.5.8 h1:cKogZ1w2qY/MHdwwG5Ppef+xLoQw+w8djUBCsYvoUw8=
|
||||
github.com/passbolt/go-passbolt v0.5.8/go.mod h1:86tXSTxBwbjg9Qmt2LiTAoMJqIFgHX15BVReRtbKiyE=
|
||||
github.com/passbolt/go-passbolt v0.6.0 h1:qTrFPWwcE6Q8Ss238ph3LortnlPkx0R31WPgmiYrd48=
|
||||
github.com/passbolt/go-passbolt v0.6.0/go.mod h1:86tXSTxBwbjg9Qmt2LiTAoMJqIFgHX15BVReRtbKiyE=
|
||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
|
||||
|
|
|
@ -84,12 +84,12 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
switch viper.GetString("mfaMode") {
|
||||
case "interactive-totp":
|
||||
client.MFACallback = func(ctx context.Context, c *api.Client, res *api.APIResponse) (http.Cookie, error) {
|
||||
challange := api.MFAChallange{}
|
||||
err := json.Unmarshal(res.Body, &challange)
|
||||
challenge := api.MFAChallenge{}
|
||||
err := json.Unmarshal(res.Body, &challenge)
|
||||
if err != nil {
|
||||
return http.Cookie{}, fmt.Errorf("Parsing MFA Challange")
|
||||
return http.Cookie{}, fmt.Errorf("Parsing MFA Challenge")
|
||||
}
|
||||
if challange.Provider.TOTP == "" {
|
||||
if challenge.Provider.TOTP == "" {
|
||||
return http.Cookie{}, fmt.Errorf("Server Provided no TOTP Provider")
|
||||
}
|
||||
for i := 0; i < 3; i++ {
|
||||
|
@ -100,14 +100,14 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
return http.Cookie{}, fmt.Errorf("Reading TOTP: %w", err)
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
req := api.MFAChallangeResponse{
|
||||
req := api.MFAChallengeResponse{
|
||||
TOTP: code,
|
||||
}
|
||||
var raw *http.Response
|
||||
raw, _, err = c.DoCustomRequestAndReturnRawResponse(ctx, "POST", "mfa/verify/totp.json", "v2", req, nil)
|
||||
if err != nil {
|
||||
if errors.Unwrap(err) != api.ErrAPIResponseErrorStatusCode {
|
||||
return http.Cookie{}, fmt.Errorf("Doing MFA Challange Response: %w", err)
|
||||
return http.Cookie{}, fmt.Errorf("Doing MFA Challenge Response: %w", err)
|
||||
}
|
||||
fmt.Println("TOTP Verification Failed")
|
||||
} else {
|
||||
|
@ -120,7 +120,7 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
return http.Cookie{}, fmt.Errorf("Unable to find Passbolt MFA Cookie")
|
||||
}
|
||||
}
|
||||
return http.Cookie{}, fmt.Errorf("Failed MFA Challange 3 times: %w", err)
|
||||
return http.Cookie{}, fmt.Errorf("Failed MFA Challenge 3 times: %w", err)
|
||||
}
|
||||
case "noninteractive-totp":
|
||||
helper.AddMFACallbackTOTP(client, viper.GetUint("mfaRetrys"), viper.GetDuration("mfaDelay"), viper.GetDuration("totpOffset"), viper.GetString("totpToken"))
|
||||
|
|
Loading…
Add table
Reference in a new issue