Skip to content
Snippets Groups Projects
Commit 5bd48398 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-7092 adjust decrypter factory

parent 834ae524
No related branches found
No related tags found
1 merge request!1OZG-7092 Anpassung TokenChecker
......@@ -41,12 +41,16 @@ import org.opensaml.xmlsec.encryption.support.SimpleRetrievalMethodEncryptedKeyR
import org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver;
import org.opensaml.xmlsec.keyinfo.impl.CollectionKeyInfoCredentialResolver;
import org.springframework.security.converter.RsaKeyConverters;
import org.springframework.stereotype.Component;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.token.TokenValidationProperties.TokenValidationProperty;
@Component
class SamlDecrypterFactory {
private static final String X509_CERTIFICATE_TYPE = "X.509";
public Decrypter buildDecrypter(TokenValidationProperty tokenValidationProperty) {
return DecrypterBuilder.builder()
.keyEncryptionKeyResolver(buildKeyInfoCredentialResolver(tokenValidationProperty))
......@@ -61,7 +65,7 @@ class SamlDecrypterFactory {
X509Certificate getCertificate(TokenValidationProperty tokenValidationProperty) {
try (var inputStream = tokenValidationProperty.getCertificate().getInputStream()) {
return (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(inputStream);
return (X509Certificate) CertificateFactory.getInstance(X509_CERTIFICATE_TYPE).generateCertificate(inputStream);
} catch (IOException | CertificateException e) {
throw new TechnicalException("Cannot read certificate", e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment