Skip to content

Commit

Permalink
[ES-482] changed logic to create list object.
Browse files Browse the repository at this point in the history
Signed-off-by: Mahammed Taheer <[email protected]>
  • Loading branch information
mahammedtaheer committed Nov 28, 2023
1 parent 7f46153 commit 832288e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ protected void checkAllowedAuthTypeForPassword(Map<String, Object> requestBody,
KycAuthRequestDTO authRequestDTO = mapper.readValue(mapper.writeValueAsBytes(requestBody),
KycAuthRequestDTO.class);

if (AuthTypeUtil.isPassword(authRequestDTO) && !isAllowedAuthType(MatchType.Category.PASSWORD.getType(), authPolicies)) {
if (AuthTypeUtil.isPassword(authRequestDTO) && !isAllowedAuthType(MatchType.Category.PASSWORD.getType(), authPolicies)) {
throw new IdAuthenticationAppException(
IdAuthenticationErrorConstants.AUTHTYPE_NOT_ALLOWED.getErrorCode(),
String.format(IdAuthenticationErrorConstants.AUTHTYPE_NOT_ALLOWED.getErrorMessage(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package io.mosip.authentication.common.service.repository;

import static io.mosip.authentication.core.constant.IdAuthCommonConstants.OIDC_CLIENT_DATA;

import java.util.Optional;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import io.mosip.authentication.common.service.entity.OIDCClientData;
Expand All @@ -16,5 +21,7 @@
@Repository
public interface OIDCClientDataRepository extends JpaRepository<OIDCClientData, String> {

Optional<OIDCClientData> findByClientId(String clientId);
@Cacheable(value = OIDC_CLIENT_DATA, key="#oidc_client_id", condition="#oidc_client_id!=null")
@Query("select oi from OIDCClientData oi where oi.clientId = :clientId")
Optional<OIDCClientData> findByClientId(@Param("clientId") String clientId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ public final class IdAuthCommonConstants {

public static final String SEMI_COLON = ";";

public static final String OIDC_CLIENT_DATA = "oidc_client_data";

private IdAuthCommonConstants() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -76,7 +77,8 @@ public List<String> filterAllowedUserClaims(String oidcClientId, List<String> co
return List.of();
}

List<String> oidcClientAllowedUserClaims = List.of(oidcClientData.get().getUserClaims());
List<String> oidcClientAllowedUserClaims = Stream.of(oidcClientData.get().getUserClaims())
.collect(Collectors.toList());

if (consentAttributes.isEmpty()) {
return oidcClientAllowedUserClaims;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@
package io.mosip.authentication.esignet.integration.service;


import com.fasterxml.jackson.databind.ObjectMapper;
import io.mosip.authentication.esignet.integration.dto.*;
import io.mosip.esignet.api.dto.AuthChallenge;
import io.mosip.esignet.api.dto.KeyBindingResult;
import io.mosip.esignet.api.dto.SendOtpResult;
import io.mosip.esignet.api.exception.KeyBindingException;
import io.mosip.esignet.api.exception.KycAuthException;
import io.mosip.esignet.api.exception.SendOtpException;
import io.mosip.esignet.api.spi.KeyBinder;
import io.mosip.esignet.api.util.ErrorConstants;
import lombok.extern.slf4j.Slf4j;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
Expand All @@ -32,10 +24,20 @@
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.mosip.authentication.esignet.integration.dto.IdaResponseWrapper;
import io.mosip.authentication.esignet.integration.dto.IdaSendOtpRequest;
import io.mosip.authentication.esignet.integration.dto.KeyBindingRequest;
import io.mosip.authentication.esignet.integration.dto.KeyBindingResponse;
import io.mosip.esignet.api.dto.AuthChallenge;
import io.mosip.esignet.api.dto.KeyBindingResult;
import io.mosip.esignet.api.dto.SendOtpResult;
import io.mosip.esignet.api.exception.KeyBindingException;
import io.mosip.esignet.api.exception.SendOtpException;
import io.mosip.esignet.api.spi.KeyBinder;
import io.mosip.esignet.api.util.ErrorConstants;
import lombok.extern.slf4j.Slf4j;

@ConditionalOnProperty(value = "mosip.esignet.integration.key-binder", havingValue = "IdaKeyBinderImpl")
@Component
Expand Down

0 comments on commit 832288e

Please sign in to comment.