本文整理匯總了Java中uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever類的典型用法代碼示例。如果您正苦於以下問題:Java IdaKeyStoreCredentialRetriever類的具體用法?Java IdaKeyStoreCredentialRetriever怎麽用?Java IdaKeyStoreCredentialRetriever使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IdaKeyStoreCredentialRetriever類屬於uk.gov.ida.saml.security包,在下文中一共展示了IdaKeyStoreCredentialRetriever類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configure
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Override
protected void configure() {
bind(EncryptionKeyStore.class).to(HubEncryptionKeyStore.class).asEagerSingleton();
bind(SigningKeyStore.class).annotatedWith(Names.named("authnRequestKeyStore")).to(AuthnRequestKeyStore.class).asEagerSingleton();
bind(SigningKeyStore.class).annotatedWith(Names.named("samlResponseFromMatchingServiceKeyStore")).to(SamlResponseFromMatchingServiceKeyStore.class).asEagerSingleton();
bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
bind(CertificateChainValidator.class);
bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
bind(CertificatesConfigProxy.class);
bind(TrustStoreForCertificateProvider.class);
bind(EncryptionCredentialFactory.class);
bind(KeyStoreCache.class);
bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
bind(SignatureFactory.class);
bind(IdaKeyStoreCredentialRetriever.class);
bind(SamlResponseAssertionEncrypter.class);
bind(AssertionBlobEncrypter.class);
bind(EncrypterFactory.class).toInstance(new EncrypterFactory());
bind(SignatureAlgorithm.class).toInstance(new SignatureRSASHA1());
bind(DigestAlgorithm.class).toInstance(new DigestSHA256());
}
示例2: getResponseToElementTransformer
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
public ResponseToElementTransformer getResponseToElementTransformer(
EncryptionKeyStore encryptionKeyStore,
IdaKeyStore keyStore,
EntityToEncryptForLocator entityToEnryptForLocator,
MatchingServiceAdapterConfiguration configuration
) {
SignatureFactory signatureFactory = new SignatureFactory(
new IdaKeyStoreCredentialRetriever(keyStore),
new SignatureRSASHA1(),
new DigestSHA256()
);
SamlResponseAssertionEncrypter assertionEncrypter = new SamlResponseAssertionEncrypter(
new EncryptionCredentialFactory(encryptionKeyStore),
new EncrypterFactory(),
entityToEnryptForLocator);
return new ResponseToElementTransformer(
new XmlObjectToElementTransformer<>(),
new SamlSignatureSigner<>(),
assertionEncrypter,
new ResponseAssertionSigner(signatureFactory),
new ResponseSignatureCreator(signatureFactory)
);
}
示例3: getVerifyAttributeQueryToInboundMatchingServiceRequestTransformer
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
public VerifyAttributeQueryToInboundMatchingServiceRequestTransformer getVerifyAttributeQueryToInboundMatchingServiceRequestTransformer(
final MetadataResolver metaDataResolver,
final IdaKeyStore keyStore,
final MatchingServiceAdapterConfiguration matchingServiceAdapterConfiguration,
final String hubEntityId,
CertificateChainEvaluableCriterion certificateChainEvaluableCriterion) throws ComponentInitializationException {
HubAssertionUnmarshaller hubAssertionTransformer = coreTransformersFactory.getAssertionToHubAssertionTransformer(hubEntityId);
IdentityProviderAssertionUnmarshaller identityProviderAssertionTransformer = new IdentityProviderAssertionUnmarshaller(
new MatchingDatasetUnmarshaller(new AddressFactory()),
new IdentityProviderAuthnStatementUnmarshaller(new AuthnContextFactory()),
hubEntityId
);
SignatureValidator signatureValidator = getMetadataBackedSignatureValidator(metaDataResolver, certificateChainEvaluableCriterion);
return new VerifyAttributeQueryToInboundMatchingServiceRequestTransformer(
new SamlAttributeQueryValidator(),
new AttributeQuerySignatureValidator(new SamlMessageSignatureValidator(signatureValidator)),
new SamlAssertionsSignatureValidator(new SamlMessageSignatureValidator(signatureValidator)),
new InboundMatchingServiceRequestUnmarshaller(hubAssertionTransformer, identityProviderAssertionTransformer),
new SamlAttributeQueryAssertionsValidator(getAssertionValidator(), getIdentityProviderAssertionValidator(), matchingServiceAdapterConfiguration, hubEntityId),
new AssertionDecrypter(new IdaKeyStoreCredentialRetriever(keyStore), new EncryptionAlgorithmValidator(), new DecrypterFactory()),
hubEntityId);
}
示例4: getAttributeQueryToElementTransformer
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
public static AttributeQueryToElementTransformer getAttributeQueryToElementTransformer(SignatureAlgorithm signatureAlgorithm, DigestAlgorithm digestAlgorithm, String hubEntityId) {
PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
PrivateKey privateKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.PRIVATE_SIGNING_KEYS.get(TestEntityIds.HUB_ENTITY_ID)));
PublicKey publicKey = publicKeyFactory.createPublicKey(TestCertificateStrings.getPrimaryPublicEncryptionCert(TestEntityIds.HUB_ENTITY_ID));
PrivateKey privateEncryptionKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.HUB_TEST_PRIVATE_ENCRYPTION_KEY));
PublicKey publicEncryptionKey = publicKeyFactory.createPublicKey(TestCertificateStrings.HUB_TEST_PUBLIC_ENCRYPTION_CERT);
KeyPair encryptionKeyPair = new KeyPair(publicEncryptionKey, privateEncryptionKey);
KeyPair signingKeyPair = new KeyPair(publicKey, privateKey);
IdaKeyStore keyStore = new IdaKeyStore(signingKeyPair, Collections.singletonList(encryptionKeyPair));
IdaKeyStoreCredentialRetriever privateCredentialFactory = new IdaKeyStoreCredentialRetriever(keyStore);
return new AttributeQueryToElementTransformer(
new SigningRequestAbstractTypeSignatureCreator<>(new SignatureFactory(privateCredentialFactory, signatureAlgorithm, digestAlgorithm)),
new SamlAttributeQueryAssertionSignatureSigner(privateCredentialFactory, new OpenSamlXmlObjectFactory(), hubEntityId),
new SamlSignatureSigner<>(),
new XmlObjectToElementTransformer<>(),
new SamlAttributeQueryAssertionEncrypter(new EncryptionCredentialFactory(new HardCodedKeyStore(hubEntityId)), new EncrypterFactory(), requestId -> TEST_RP_MS)
);
}
示例5: setup
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Before
public void setup() throws Exception {
PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
PrivateKey privateKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.PRIVATE_SIGNING_KEYS.get(HUB_ENTITY_ID)));
PublicKey publicKey = publicKeyFactory.createPublicKey(TestCertificateStrings.getPrimaryPublicEncryptionCert(HUB_ENTITY_ID));
PrivateKey privateEncryptionKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.HUB_TEST_PRIVATE_ENCRYPTION_KEY));
PublicKey publicEncryptionKey = publicKeyFactory.createPublicKey(TestCertificateStrings.HUB_TEST_PUBLIC_ENCRYPTION_CERT);
KeyPair encryptionKeyPair = new KeyPair(publicEncryptionKey, privateEncryptionKey);
KeyPair signingKeyPair = new KeyPair(publicKey, privateKey);
IdaKeyStore keyStore = new IdaKeyStore(signingKeyPair, Collections.singletonList(encryptionKeyPair));
assertionDecrypter = new AssertionDecrypter(new IdaKeyStoreCredentialRetriever(
keyStore),
new EncryptionAlgorithmValidator(),
new DecrypterFactory());
setUpMatchingService();
}
開發者ID:alphagov,項目名稱:verify-matching-service-adapter,代碼行數:21,代碼來源:UserAccountCreationAppRuleTest.java
示例6: createResponse_shouldReturnValidSamlResponse
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Test
public void createResponse_shouldReturnValidSamlResponse() throws Exception {
PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
PrivateKey privateKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.PRIVATE_SIGNING_KEYS.get(TestEntityIds.STUB_IDP_ONE)));
PublicKey publicKey = publicKeyFactory.createPublicKey(TestCertificateStrings.getPrimaryPublicEncryptionCert(TestEntityIds.HUB_ENTITY_ID));
PrivateKey privateEncryptionKey = new PrivateKeyFactory().createPrivateKey(Base64.decodeBase64(TestCertificateStrings.HUB_TEST_PRIVATE_ENCRYPTION_KEY));
PublicKey publicEncryptionKey = publicKeyFactory.createPublicKey(TestCertificateStrings.HUB_TEST_PUBLIC_ENCRYPTION_CERT);
KeyPair encryptionKeyPair = new KeyPair(publicEncryptionKey, privateEncryptionKey);
KeyPair signingKeyPair = new KeyPair(publicKey, privateKey);
IdaKeyStore keyStore = new IdaKeyStore(signingKeyPair, Arrays.asList(encryptionKeyPair));
ExceptionResponseFactory exceptionResponseFactory = new ExceptionResponseFactory(new OpenSamlXmlObjectFactory(), new IdaKeyStoreCredentialRetriever(keyStore), new IdGenerator());
String errorMessage = "some message";
String requestId = UUID.randomUUID().toString();
Element element = exceptionResponseFactory.createResponse(requestId, TEST_ENTITY_ID, errorMessage);
Response attributeQueryResponse = (Response) XMLObjectProviderRegistrySupport.getUnmarshallerFactory().getUnmarshaller(element).unmarshall(element);
assertThat(attributeQueryResponse.getStatus().getStatusCode().getValue()).isEqualTo(StatusCode.REQUESTER);
assertThat(attributeQueryResponse.getStatus().getStatusMessage().getMessage()).isEqualTo(errorMessage);
assertThat(attributeQueryResponse.getInResponseTo()).isEqualTo(requestId);
assertThat(attributeQueryResponse.getIssuer().getValue()).isEqualTo(TEST_ENTITY_ID);
}
示例7: sendSignedJsonAuthnResponseFromHub_shouldRespondWithNextLocation
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Test
public void sendSignedJsonAuthnResponseFromHub_shouldRespondWithNextLocation() throws Exception {
SessionId sessionId = SessionId.createNewSessionId();
URI nextLocationUri = URI.create("http://blah");
String requestId = UUID.randomUUID().toString();
ResponseAssertionSigner responseAssertionSigner = new ResponseAssertionSigner(
new SignatureFactory(new IdaKeyStoreCredentialRetriever(getKeyStore()), SIGNATURE_ALGORITHM, DIGEST_ALGORITHM)
);
Function<OutboundResponseFromHub, String> outboundResponseFromHubToStringTransformer = new HubTransformersFactory()
.getOutboundResponseFromHubToStringTransformer(
new HardCodedKeyStore(HUB_ENTITY_ID),
getKeyStore(),
new IdpHardCodedEntityToEncryptForLocator(),
responseAssertionSigner,
SIGNATURE_ALGORITHM,
DIGEST_ALGORITHM
);
OutboundResponseFromHub authnResponseFromHub = anAuthnResponse()
.withInResponseTo(requestId)
.withIssuerId(HUB_ENTITY_ID)
.withTransactionIdaStatus(TransactionIdaStatus.Success)
.buildOutboundResponseFromHub();
String samlString = outboundResponseFromHubToStringTransformer.apply(authnResponseFromHub);
AuthnResponseFromHubContainerDto authnResponseFromHubContainerDto = new AuthnResponseFromHubContainerDto(
samlString,
nextLocationUri,
com.google.common.base.Optional.absent(),
authnResponseFromHub.getId());
policyStubRule.anAuthnResponseFromHubToRp(sessionId, authnResponseFromHubContainerDto);
javax.ws.rs.core.Response response = getResponseFromSamlProxy(Urls.SamlProxyUrls.SEND_RESPONSE_FROM_HUB_API_RESOURCE, sessionId);
assertThat(response.readEntity(SamlMessageSenderHandler.SamlMessage.class).getPostEndpoint()).isEqualTo(nextLocationUri.toASCIIString());
}
示例8: getAES256WithGCMAssertionDecrypter
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Provides
@Named("AES256DecrypterWithGCM")
private AssertionDecrypter getAES256WithGCMAssertionDecrypter(IdaKeyStore keyStore) {
return new AssertionDecrypter(
new IdaKeyStoreCredentialRetriever(keyStore), new EncryptionAlgorithmValidator(ImmutableSet.of(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256, EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256_GCM)), new DecrypterFactory()
);
}
示例9: decryptAssertions
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
public List<Assertion> decryptAssertions(Response response) {
KeyPair encryptionKeyPair = new KeyPair(publicKey, privateKey);
KeyPair signingKeyPair = new KeyPair(publicKey, privateKey);
IdaKeyStore keyStore = new IdaKeyStore(signingKeyPair, Collections.singletonList(encryptionKeyPair));
uk.gov.ida.saml.security.AssertionDecrypter assertionDecrypter = new uk.gov.ida.saml.security.AssertionDecrypter(
new IdaKeyStoreCredentialRetriever(keyStore), new EncryptionAlgorithmValidator(ImmutableSet.of(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256_GCM)), new DecrypterFactory()
);
return assertionDecrypter.decryptAssertions(new ValidatedResponse(response));
}
示例10: createSignature
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
private Signature createSignature() {
KeyPair signingKeyPair = new KeyPair(publicKeyFromPrivateKey(signingKey), signingKey);
IdaKeyStore keyStore = new IdaKeyStore(signingKeyPair, Collections.emptyList());
IdaKeyStoreCredentialRetriever keyStoreCredentialRetriever = new IdaKeyStoreCredentialRetriever(keyStore);
SignatureRSASHA256 signatureAlgorithm = new SignatureRSASHA256();
DigestSHA256 digestAlgorithm = new DigestSHA256();
SignatureFactory signatureFactory = new SignatureFactory(keyStoreCredentialRetriever, signatureAlgorithm, digestAlgorithm);
return signatureFactory.createSignature();
}
示例11: createAssertionDecrypter
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
public AssertionDecrypter createAssertionDecrypter() {
return new AssertionDecrypter(
new IdaKeyStoreCredentialRetriever(createEncryptionKeyStore()),
encryptionAlgorithmValidator,
decrypterFactory
);
}
示例12: configure
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Override
protected void configure() {
bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
bind(SoapMessageManager.class).toInstance(new SoapMessageManager());
bind(X509CertificateFactory.class);
bind(KeyStoreLoader.class);
bind(IdGenerator.class);
bind(IdaKeyStoreCredentialRetriever.class);
bind(ExpiredCertificateMetadataFilter.class);
bind(ExceptionResponseFactory.class);
bind(InboundMatchingServiceRequestToMatchingServiceRequestDtoMapper.class);
bind(MatchingServiceResponseDtoToOutboundResponseFromMatchingServiceMapper.class);
bind(MatchingServiceAdapterMetadataRepository.class);
bind(DocumentToInboundMatchingServiceRequestMapper.class);
bind(IdGenerator.class);
bind(MatchingServiceAssertionFactory.class);
bind(UserAccountCreationAttributeExtractor.class);
bind(UnknownUserAttributeQueryHandler.class);
bind(SigningKeyStore.class).to(MetadataPublicKeyStore.class).in(Singleton.class);
bind(EncryptionKeyStore.class).to(MetadataPublicKeyStore.class).in(Singleton.class);
bind(PublicKeyInputStreamFactory.class).to(PublicKeyFileInputStreamFactory.class).in(Singleton.class);
bind(AssertionLifetimeConfiguration.class).to(MatchingServiceAdapterConfiguration.class).in(Singleton.class);
bind(MatchingServiceProxy.class).to(MatchingServiceProxyImpl.class).in(Singleton.class);
bind(ManifestReader.class).toInstance(new ManifestReader());
bind(MatchingDatasetToMatchingDatasetDtoMapper.class).toInstance(new MatchingDatasetToMatchingDatasetDtoMapper());
}
示例13: ExceptionResponseFactory
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Inject
public ExceptionResponseFactory(OpenSamlXmlObjectFactory factory, IdaKeyStoreCredentialRetriever credentialFactory, IdGenerator idGenerator) {
this.factory = factory;
this.credentialFactory = credentialFactory;
this.idGenerator = idGenerator;
}
示例14: getAssertionDecrypter
import uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever; //導入依賴的package包/類
@Provides
public AssertionDecrypter getAssertionDecrypter(IdaKeyStore eidasKeystore) {
return new AssertionDecrypter(new IdaKeyStoreCredentialRetriever(eidasKeystore), new EncryptionAlgorithmValidator(), new DecrypterFactory());
}