Skip to content

Commit

Permalink
remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcraig committed Nov 22, 2024
1 parent a4e3181 commit 8934a6c
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions vault/login_mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -2072,30 +2072,17 @@ func (c *Core) validateOkta(ctx context.Context, mConfig *mfa.Config, username s

// Okta doesn't return the transactionID as a parameter in the response, but it's encoded in the URL
// this approach comes from: https://github.com/okta/okta-sdk-golang/issues/300, but it's not ideal.
// It is, however, what the dotnet library by okta does.
txRx := regexp.MustCompile(".*/transactions/(.*)")
// It is, however, what the dotnet library by Okta themselves does.
txRx := regexp.MustCompile("^.*/transactions/(.*)$")
matches := txRx.FindStringSubmatch(url.Path)
if len(matches) != 2 {
return fmt.Errorf("couldn't determine transaction id from url")
}
transactionID := matches[1]

// poll verifyfactor until termination (e.g., the user responds to the push factor
// poll verifyfactor until termination (e.g., the user responds to the push factor)
for {
// Okta provides an SDK method `GetFactorTransactionStatus` but does not provide the transaction id in
// the VerifyFactor respone. This code effectively reimplements that method.
// client.UserFactorAPI.GetFactorTransactionStatus(client.GetConfig().Context, user.GetId(), userFactor.GetId())

//req, err := rq.WithAccept("application/json").WithContentType("application/json").NewRequest("GET", url.String(), nil)
//if err != nil {
// return err
//}
//var result *okta.VerifyUserFactorResponse
//_, err = rq.Do(ctx, req, &result)
//if err != nil {
// return err
//}
//

result, _, err := client.UserFactorAPI.GetFactorTransactionStatus(client.GetConfig().Context, user.GetId(), userFactor.GetId(), transactionID).Execute()
if err != nil {
return err
Expand Down

0 comments on commit 8934a6c

Please sign in to comment.