diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java index 9796bed5cff..2dd03849495 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/filter/IdAuthFilter.java @@ -869,7 +869,7 @@ protected void checkAllowedAuthTypeForPassword(Map 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(), diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java index 22e2fc14412..f4b6143408b 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/repository/OIDCClientDataRepository.java @@ -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; @@ -16,5 +21,7 @@ @Repository public interface OIDCClientDataRepository extends JpaRepository { - Optional 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 findByClientId(@Param("clientId") String clientId); } diff --git a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java index 9ec8fe6d3d2..94f2e1ea739 100644 --- a/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java +++ b/authentication/authentication-core/src/main/java/io/mosip/authentication/core/constant/IdAuthCommonConstants.java @@ -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() { } } diff --git a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/util/ExchangeDataAttributesUtil.java b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/util/ExchangeDataAttributesUtil.java index 73a86159bff..477ce9b5568 100644 --- a/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/util/ExchangeDataAttributesUtil.java +++ b/authentication/authentication-service/src/main/java/io/mosip/authentication/service/kyc/util/ExchangeDataAttributesUtil.java @@ -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; @@ -76,7 +77,8 @@ public List filterAllowedUserClaims(String oidcClientId, List co return List.of(); } - List oidcClientAllowedUserClaims = List.of(oidcClientData.get().getUserClaims()); + List oidcClientAllowedUserClaims = Stream.of(oidcClientData.get().getUserClaims()) + .collect(Collectors.toList()); if (consentAttributes.isEmpty()) { return oidcClientAllowedUserClaims; diff --git a/authentication/esignet-integration-impl/src/main/java/io/mosip/authentication/esignet/integration/service/IdaKeyBinderImpl.java b/authentication/esignet-integration-impl/src/main/java/io/mosip/authentication/esignet/integration/service/IdaKeyBinderImpl.java index 245a7821ebf..2848be4f3cb 100644 --- a/authentication/esignet-integration-impl/src/main/java/io/mosip/authentication/esignet/integration/service/IdaKeyBinderImpl.java +++ b/authentication/esignet-integration-impl/src/main/java/io/mosip/authentication/esignet/integration/service/IdaKeyBinderImpl.java @@ -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; @@ -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