Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jans-auth-server): device auth is failing #8223

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,19 @@ public void validateAcrs(AuthzRequest authzRequest, Client client) throws AcrCha
}

public void checkAcrScriptIsAvailable(AuthzRequest authzRequest) {
if (Util.isBuiltInPasswordAuthn(authzRequest.getAcrValues())) {
final String acrValues = authzRequest.getAcrValues();
if (StringUtils.isBlank(acrValues)) {
return; // nothing to validate
}

if (Util.isBuiltInPasswordAuthn(acrValues)) {
return; // no need for script for built-in "simple_password_auth"
}

CustomScriptConfiguration script = externalAuthenticationService.determineCustomScriptConfiguration(AuthenticationScriptUsageType.INTERACTIVE, authzRequest.getAcrValuesList());
if (script == null) {
String msg = String.format("Unable to find script for acr: %s. Send error: %s",
authzRequest.getAcrValues(), AuthorizeErrorResponseType.UNMET_AUTHENTICATION_REQUIREMENTS.getParameter());
acrValues, AuthorizeErrorResponseType.UNMET_AUTHENTICATION_REQUIREMENTS.getParameter());
log.debug(msg);
throw authzRequest.getRedirectUriResponse().createWebException(AuthorizeErrorResponseType.UNMET_AUTHENTICATION_REQUIREMENTS, msg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public class AuthorizeRestWebServiceValidatorTest {
@Mock
private ExternalAuthenticationService externalAuthenticationService;

@Test
public void checkAcrScriptIsAvailable_forBlankAcr_shouldPass() {
AuthzRequest authzRequest = new AuthzRequest();

authorizeRestWebServiceValidator.checkAcrScriptIsAvailable(authzRequest);
}

@Test
public void checkAcrScriptIsAvailable_forBuildInAcr_shouldPass() {
AuthzRequest authzRequest = new AuthzRequest();
Expand Down