You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/internal/cyberark/identity/identity.go
+24-23Lines changed: 24 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -172,7 +172,8 @@ type advanceAuthenticationResponseResult struct {
172
172
// Other fields omitted as they're not needed
173
173
}
174
174
175
-
// Client is an client for interacting with the CyberArk Identity API and performing a login
175
+
// Client is an client for interacting with the CyberArk Identity API and performing a login using a username and password.
176
+
// For context on the behaviour of this client, see the Pytho SDK: https://github.com/cyberark/ark-sdk-python/blob/3be12c3f2d3a2d0407025028943e584b6edc5996/ark_sdk_python/auth/identity/ark_identity.py
klog.FromContext(ctx).Info("got an unexpected Summary from StartAuthentication response; will attempt to complete a login challenge anyway", "summary", startAuthResponse.Result.Summary)
332
333
}
333
334
334
-
iflen(startAuthResponse.Result.Challenges) ==0 {
335
+
// We can only handle a UP type challenge, and if there are any other challenges, we'll have to fail because we can't handle them.
logger.V(logs.Debug).Info("found a challenge", "idx", i, "mechanismCount", len(challenge.Mechanisms))
344
+
default:
345
+
returnresponse, fmt.Errorf("got %d challenges in response to start authentication, which means MFA may be enabled; unable to log in", len(startAuthResponse.Result.Challenges))
346
+
}
342
347
343
-
iflen(challenge.Mechanisms) ==0 {
344
-
// presumably this shouldn't happen, but handle the case anyway
345
-
logger.Info("got no mechanisms for challenge from Identity server; skipping this challenge")
346
-
continue
347
-
}
348
+
challenge:=startAuthResponse.Result.Challenges[0]
348
349
349
-
forj, mechanism:=rangechallenge.Mechanisms {
350
-
logger.V(logs.Debug).Info("found a mechanism in challenge", "idx", j, "enrolled", mechanism.Enrolled, "name", mechanism.Name)
350
+
switchlen(challenge.Mechanisms) {
351
+
case0:
352
+
// presumably this shouldn't happen, but handle the case anyway
353
+
returnresponse, fmt.Errorf("got no mechanisms for challenge from Identity server")
returnresponse, fmt.Errorf("got %d mechanisms in response to start authentication, which means MFA may be enabled; unable to log in", len(challenge.Mechanisms))
0 commit comments