Skip to content

Commit

Permalink
fix for showing of question with enabled by default (MID-6286)
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Jun 25, 2020
1 parent a209bd0 commit 3cfd14c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -78,7 +78,7 @@ private JSONArray generateAnswer(PrismObject<UserType> user) {
return null;
}
for (SecurityQuestionDefinitionType question : questions) {
if (Boolean.TRUE.equals(question.isEnabled())) {
if (!Boolean.FALSE.equals(question.isEnabled())) {
JSONObject json = new JSONObject();
json.put(SecurityQuestionsAuthenticationFilter.J_QID, question.getIdentifier());
json.put(SecurityQuestionsAuthenticationFilter.J_QTXT, question.getQuestionText());
Expand Down
Expand Up @@ -15,6 +15,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.Base64Exception;
import org.apache.cxf.common.util.Base64Utility;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
Expand Down Expand Up @@ -46,13 +47,14 @@ public void testChallengeResponse() {

response = getUserAdministrator("SecQ " + Base64Utility.encode(secQusernameChallenge.getBytes()));
challengeBase64 = assertAndGetChallenge(response);
String answerChallenge;
String answerChallenge = null;
try {
answerChallenge = new String(Base64Utility.decode(challengeBase64));
logger.info("Answer challenge: " + answerChallenge);
} catch (Base64Exception e) {
fail("Failed to decode base64 username challenge");
}
assertEquals("Wrong number of questions", 3, StringUtils.countMatches(answerChallenge, "\"qid\":"));
String secQAnswerChallenge = "{"
+ "\"user\" : \"administrator\","
+ "\"answer\" : ["
Expand Down

0 comments on commit 3cfd14c

Please sign in to comment.