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
returnresponse, fmt.Errorf("rejecting JSON response from server as it was too large or was truncated")
319
328
}
320
329
330
+
logger.Error(err, "")
321
331
returnresponse, fmt.Errorf("failed to parse JSON from otherwise successful request to start authentication: %s", err)
322
332
}
323
333
324
334
if!startAuthResponse.Success {
325
-
returnresponse, fmt.Errorf("got a failure response from request to start authentication: message=%q, error=%q", startAuthResponse.Message, startAuthResponse.ErrorID)
335
+
err:=fmt.Errorf("got a failure response from request to start authentication: message=%q, error=%q", startAuthResponse.Message, startAuthResponse.ErrorID)
336
+
logger.Error(err, "")
337
+
returnresponse, err
326
338
}
327
339
328
340
logger.V(logs.Debug).Info("made successful request to StartAuthentication", "summary", startAuthResponse.Result.Summary)
// This means we can't respond to whatever summary the server sent.
332
344
// The best thing to do is try and find a challenge we can solve anyway.
333
-
klog.FromContext(ctx).Info("got an unexpected Summary from StartAuthentication response; will attempt to complete a login challenge anyway", "summary", startAuthResponse.Result.Summary)
345
+
logger.Info("got an unexpected Summary from StartAuthentication response; will attempt to complete a login challenge anyway", "summary", startAuthResponse.Result.Summary)
334
346
}
335
347
336
348
// 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.
returnresponse, fmt.Errorf("got no valid challenges in response to start authentication; unable to log in")
352
+
err:=fmt.Errorf("got no valid challenges in response to start authentication; unable to log in")
353
+
logger.Error(err, "")
354
+
returnresponse, err
341
355
342
356
case1:
343
357
// do nothing, this is ideal
344
358
345
359
default:
346
-
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))
360
+
err:=fmt.Errorf("got %d challenges in response to start authentication, which means MFA may be enabled; unable to log in", len(startAuthResponse.Result.Challenges))
361
+
logger.Error(err, "")
362
+
returnresponse, err
347
363
}
348
364
349
365
challenge:=startAuthResponse.Result.Challenges[0]
350
366
351
367
switchlen(challenge.Mechanisms) {
352
368
case0:
353
369
// presumably this shouldn't happen, but handle the case anyway
354
-
returnresponse, fmt.Errorf("got no mechanisms for challenge from Identity server")
370
+
err:=fmt.Errorf("got no mechanisms for challenge from Identity server")
371
+
logger.Error(err, "")
372
+
returnresponse, err
355
373
356
374
case1:
357
375
// do nothing, this is ideal
358
376
359
377
default:
360
-
returnresponse, fmt.Errorf("got %d mechanisms in response to start authentication, which means MFA may be enabled; unable to log in", len(challenge.Mechanisms))
378
+
err:=fmt.Errorf("got %d mechanisms in response to start authentication, which means MFA may be enabled; unable to log in", len(challenge.Mechanisms))
returnfmt.Errorf("rejecting JSON response from server as it was too large or was truncated")
429
459
}
430
460
461
+
logger.Error(err, "")
431
462
returnfmt.Errorf("failed to parse JSON from otherwise successful request to advance authentication: %s", err)
432
463
}
433
464
434
465
if!advanceAuthResponse.Success {
435
-
returnfmt.Errorf("got a failure response from request to advance authentication: message=%q, error=%q", advanceAuthResponse.Message, advanceAuthResponse.ErrorID)
466
+
// TODO: Permanent error?
467
+
err:=fmt.Errorf("got a failure response from request to advance authentication: message=%q, error=%q", advanceAuthResponse.Message, advanceAuthResponse.ErrorID)
returnbackoff.Permanent(fmt.Errorf("got a %s response from AdvanceAuthentication; this implies that the user account %s requires MFA, which is not supported. Try unlocking MFA for this user", advanceAuthResponse.Result.Summary, username))
0 commit comments