@Test public void getCertificateAuthorityInfo() throws Exception { ApprovedCAInfo caInfo = certificateAuthorityService.getCertificateAuthorityInfo("fi-not-auth-only"); assertEquals("ee.ria.xroad.common.certificateprofile.impl.FiVRKCertificateProfileInfoProvider", caInfo.getCertificateProfileInfo()); try { certificateAuthorityService.getCertificateAuthorityInfo("does-not-exist"); fail("should have thrown exception"); } catch (CertificateAuthorityNotFoundException expected) { } }
public ApprovedCAInfo getCertificateAuthorityInfo(String caName) throws CertificateAuthorityNotFoundException { Collection<ApprovedCAInfo> cas = globalConfService.getApprovedCAsForThisInstance(); Optional<ApprovedCAInfo> ca = cas.stream() .filter(item -> caName.equals(item.getName())) .findFirst(); if (!ca.isPresent()) { throw new CertificateAuthorityNotFoundException("certificate authority " + caName + " not_found"); } return ca.get(); }
CertificateAuthorityService { public ApprovedCAInfo getCertificateAuthorityInfo(String caName) throws CertificateAuthorityNotFoundException { Collection<ApprovedCAInfo> cas = globalConfService.getApprovedCAsForThisInstance(); Optional<ApprovedCAInfo> ca = cas.stream() .filter(item -> caName.equals(item.getName())) .findFirst(); if (!ca.isPresent()) { throw new CertificateAuthorityNotFoundException("certificate authority " + caName + " not_found"); } return ca.get(); } }
CertificateAuthorityService { public ApprovedCAInfo getCertificateAuthorityInfo(String caName) throws CertificateAuthorityNotFoundException { Collection<ApprovedCAInfo> cas = globalConfService.getApprovedCAsForThisInstance(); Optional<ApprovedCAInfo> ca = cas.stream() .filter(item -> caName.equals(item.getName())) .findFirst(); if (!ca.isPresent()) { throw new CertificateAuthorityNotFoundException("certificate authority " + caName + " not_found"); } return ca.get(); } @Autowired  CertificateAuthorityService(GlobalConfService globalConfService,
            GlobalConfFacade globalConfFacade,
            ClientService clientService,
            SignerProxyFacade signerProxyFacade,
            CurrentSecurityServerId currentSecurityServerId); }
CertificateAuthorityService { public ApprovedCAInfo getCertificateAuthorityInfo(String caName) throws CertificateAuthorityNotFoundException { Collection<ApprovedCAInfo> cas = globalConfService.getApprovedCAsForThisInstance(); Optional<ApprovedCAInfo> ca = cas.stream() .filter(item -> caName.equals(item.getName())) .findFirst(); if (!ca.isPresent()) { throw new CertificateAuthorityNotFoundException("certificate authority " + caName + " not_found"); } return ca.get(); } @Autowired  CertificateAuthorityService(GlobalConfService globalConfService,
            GlobalConfFacade globalConfFacade,
            ClientService clientService,
            SignerProxyFacade signerProxyFacade,
            CurrentSecurityServerId currentSecurityServerId); @Cacheable(GET_CERTIFICATE_AUTHORITIES_CACHE) List<ApprovedCaDto> getCertificateAuthorities(KeyUsageInfo keyUsageInfo); @Cacheable(GET_CERTIFICATE_AUTHORITIES_CACHE) List<ApprovedCaDto> getCertificateAuthorities(KeyUsageInfo keyUsageInfo,
            boolean includeIntermediateCas); CertificateProfileInfo getCertificateProfile(String caName, KeyUsageInfo keyUsageInfo, ClientId memberId,
            boolean isNewMember); ApprovedCAInfo getCertificateAuthorityInfo(String caName); }
CertificateAuthorityService { public ApprovedCAInfo getCertificateAuthorityInfo(String caName) throws CertificateAuthorityNotFoundException { Collection<ApprovedCAInfo> cas = globalConfService.getApprovedCAsForThisInstance(); Optional<ApprovedCAInfo> ca = cas.stream() .filter(item -> caName.equals(item.getName())) .findFirst(); if (!ca.isPresent()) { throw new CertificateAuthorityNotFoundException("certificate authority " + caName + " not_found"); } return ca.get(); } @Autowired  CertificateAuthorityService(GlobalConfService globalConfService,
            GlobalConfFacade globalConfFacade,
            ClientService clientService,
            SignerProxyFacade signerProxyFacade,
            CurrentSecurityServerId currentSecurityServerId); @Cacheable(GET_CERTIFICATE_AUTHORITIES_CACHE) List<ApprovedCaDto> getCertificateAuthorities(KeyUsageInfo keyUsageInfo); @Cacheable(GET_CERTIFICATE_AUTHORITIES_CACHE) List<ApprovedCaDto> getCertificateAuthorities(KeyUsageInfo keyUsageInfo,
            boolean includeIntermediateCas); CertificateProfileInfo getCertificateProfile(String caName, KeyUsageInfo keyUsageInfo, ClientId memberId,
            boolean isNewMember); ApprovedCAInfo getCertificateAuthorityInfo(String caName); static final String OCSP_RESPONSE_NOT_AVAILABLE; }