log.log(Level.SEVERE, LogStringsMessages.WSS_1504_UNSUPPORTED_CALLBACK_TYPE());
throw unsupported;
}
} else if (callbacks[i] instanceof EncryptionKeyCallback) {
EncryptionKeyCallback cb = (EncryptionKeyCallback) callbacks[i];
if (cb.getRequest() instanceof EncryptionKeyCallback.AliasX509CertificateRequest) {
EncryptionKeyCallback.AliasX509CertificateRequest request =
(EncryptionKeyCallback.AliasX509CertificateRequest) cb.getRequest();
String alias = request.getAlias();
if ("".equals(alias) || (alias == null)) {
getDefaultCertificateFromTrustStore(cb.getRuntimeProperties(), request);
} else {
try {
KeyStore tStore = this.getTrustStore(cb.getRuntimeProperties());
if (tStore != null) {
X509Certificate cert =
(X509Certificate) tStore.getCertificate(alias);
request.setX509Certificate(cert);
}
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1526_FAILEDTO_GETCERTIFICATE(), e);
throw new RuntimeException(e);
}
}
} else if (cb.getRequest() instanceof EncryptionKeyCallback.PublicKeyBasedRequest) {
EncryptionKeyCallback.PublicKeyBasedRequest request =
(EncryptionKeyCallback.PublicKeyBasedRequest) cb.getRequest();
try {
X509Certificate cert =
getCertificateFromTrustStoreForSAML(request.getPublicKey(), cb.getRuntimeProperties());
request.setX509Certificate(cert);
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1526_FAILEDTO_GETCERTIFICATE(), e);
throw new RuntimeException(e);
}
} else if (cb.getRequest() instanceof EncryptionKeyCallback.AliasSymmetricKeyRequest) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1504_UNSUPPORTED_CALLBACK_TYPE());
throw unsupported;
}
} else if (callbacks[i] instanceof CertificateValidationCallback) {
CertificateValidationCallback cb = (CertificateValidationCallback) callbacks[i];
getTrustStore(cb.getRuntimeProperties());
cb.setValidator(certValidator);
} else if (callbacks[i] instanceof DynamicPolicyCallback) {
DynamicPolicyCallback dp = (DynamicPolicyCallback) callbacks[i];
SecurityPolicy policy = dp.getSecurityPolicy();