Skip to content

Commit 771ad96

Browse files
committed
Fix the UTs
1 parent 0b70a71 commit 771ad96

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/IdServer/SimpleIdServer.IdServer/Api/Authorization/Validators/OAuthAuthorizationRequestValidator.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,13 @@ public virtual async Task ValidateAuthorizationRequestWhenUserIsAuthenticated(Gr
228228
throw new OAuthException(ErrorCodes.INVALID_REQUEST, string.Format(Global.InvalidClaims, string.Join(",", invalidClaims.Select(i => i.Name))));
229229
}
230230

231-
var acr = await _amrHelper.FetchDefaultAcr(context.Realm, acrValues, claims, openidClient, cancellationToken);
232-
var notAuthorizedAmrs = acr.AuthenticationMethodReferences.Where(c => !context.Request.Amrs.Contains(c));
233-
if (notAuthorizedAmrs.Any())
234-
throw new OAuthAuthenticatedUserAmrMissingException(acr.Name, notAuthorizedAmrs.First(), acr.AuthenticationMethodReferences);
231+
if(context.Request.Amrs.Any())
232+
{
233+
var acr = await _amrHelper.FetchDefaultAcr(context.Realm, acrValues, claims, openidClient, cancellationToken);
234+
var notAuthorizedAmrs = acr.AuthenticationMethodReferences.Where(c => !context.Request.Amrs.Contains(c));
235+
if (notAuthorizedAmrs.Any())
236+
throw new OAuthAuthenticatedUserAmrMissingException(acr.Name, notAuthorizedAmrs.First(), acr.AuthenticationMethodReferences);
237+
}
235238
}
236239

237240
protected virtual void RedirectToConsentView(HandlerContext context)

0 commit comments

Comments
 (0)