}
private AuthenticationState transition() {
if (mechanismIterator.hasNext()) {
final AuthenticationMechanism mechanism = mechanismIterator.next();
ChallengeResult result = mechanism.sendChallenge(exchange, SecurityContextImpl.this);
if (result.isChallengeSent()) {
atLeastOneChallenge = true;
Integer desiredCode = result.getDesiredResponseCode();
if (chosenStatusCode == null) {
chosenStatusCode = desiredCode;
} else if (desiredCode != null) {
if (chosenStatusCode.equals(StatusCodes.OK)) {
// Allows a more specific code to be chosen.