Ejemplo n.º 1
0
 /**
  * Returns user claims
  *
  * @return
  */
 public UserIdentityClaimDTO[] getUserIdentityRecoveryData() {
   Map<String, String> tempMap = new HashMap<String, String>();
   // reading them to a temporary map
   for (Map.Entry<String, String> entry : userIdentityDataMap.entrySet()) {
     // only if not a security question uri or an identity claim uri
     if (!entry.getKey().contains(UserCoreConstants.ClaimTypeURIs.CHALLENGE_QUESTION_URI)
         && !entry.getKey().contains(UserCoreConstants.ClaimTypeURIs.IDENTITY_CLAIM_URI)) {
       tempMap.put(entry.getKey(), entry.getValue());
     }
   }
   // no user claim found
   if (tempMap.size() == 0) {
     return null;
   }
   // creating claim dtos
   UserIdentityClaimDTO[] identityRecoveryData = new UserIdentityClaimDTO[tempMap.size()];
   int i = 0;
   for (Map.Entry<String, String> entry : tempMap.entrySet()) {
     UserIdentityClaimDTO dto = new UserIdentityClaimDTO();
     dto.setClaimUri(entry.getKey());
     dto.setClaimValue(entry.getValue());
     identityRecoveryData[i] = dto;
     i++;
   }
   return identityRecoveryData;
 }
Ejemplo n.º 2
0
 /**
  * Returns all user identity claims
  *
  * @return
  */
 public UserIdentityClaimDTO[] getUserSequeiryQuestions() {
   Map<String, String> tempMap = new HashMap<String, String>();
   // reading them to a temporary map
   for (Map.Entry<String, String> entry : userIdentityDataMap.entrySet()) {
     // only if a security question uri
     if (entry.getKey().contains(UserCoreConstants.ClaimTypeURIs.CHALLENGE_QUESTION_URI)) {
       tempMap.put(entry.getKey(), entry.getValue());
     }
   }
   // no security questions found
   if (tempMap.size() == 0) {
     return null;
   }
   // creating claim dtos
   UserIdentityClaimDTO[] securityQuestions = new UserIdentityClaimDTO[tempMap.size()];
   int i = 0;
   for (Map.Entry<String, String> entry : tempMap.entrySet()) {
     UserIdentityClaimDTO dto = new UserIdentityClaimDTO();
     dto.setClaimUri(entry.getKey());
     dto.setClaimValue(entry.getValue());
     securityQuestions[i] = dto;
     i++;
   }
   return securityQuestions;
 }