@@ -77,8 +77,7 @@ public ChallengeNonceGenerator generator(ChallengeNonceStore challengeNonceStore
7777 .build ();
7878 }
7979
80- @ Bean
81- public X509Certificate [] loadTrustedCACertificatesFromCerFiles () {
80+ private X509Certificate [] loadTrustedCACertificatesFromCerFiles () {
8281 List <X509Certificate > caCertificates = new ArrayList <>();
8382
8483 try {
@@ -99,8 +98,7 @@ public X509Certificate[] loadTrustedCACertificatesFromCerFiles() {
9998 return caCertificates .toArray (new X509Certificate [0 ]);
10099 }
101100
102- @ Bean
103- public X509Certificate [] loadTrustedCACertificatesFromTrustStore () {
101+ private X509Certificate [] loadTrustedCACertificatesFromTrustStore (YAMLConfig yamlConfig ) {
104102 List <X509Certificate > caCertificates = new ArrayList <>();
105103
106104 try (InputStream is = ValidationConfiguration .class .getResourceAsStream (CERTS_RESOURCE_PATH + activeProfile + "/" + TRUSTED_CERTIFICATES_JKS )) {
@@ -109,7 +107,7 @@ public X509Certificate[] loadTrustedCACertificatesFromTrustStore() {
109107 return new X509Certificate [0 ];
110108 }
111109 KeyStore keystore = KeyStore .getInstance (KeyStore .getDefaultType ());
112- keystore .load (is , yamlConfig () .getTrustStorePassword ().toCharArray ());
110+ keystore .load (is , yamlConfig .getTrustStorePassword ().toCharArray ());
113111 Enumeration <String > aliases = keystore .aliases ();
114112 while (aliases .hasMoreElements ()) {
115113 String alias = aliases .nextElement ();
@@ -124,12 +122,13 @@ public X509Certificate[] loadTrustedCACertificatesFromTrustStore() {
124122 }
125123
126124 @ Bean
127- public AuthTokenValidator validator () {
125+ public AuthTokenValidator validator (YAMLConfig yamlConfig ) {
128126 try {
129127 return new AuthTokenValidatorBuilder ()
130- .withSiteOrigin (URI .create (yamlConfig () .getLocalOrigin ()))
128+ .withSiteOrigin (URI .create (yamlConfig .getLocalOrigin ()))
131129 .withTrustedCertificateAuthorities (loadTrustedCACertificatesFromCerFiles ())
132- .withTrustedCertificateAuthorities (loadTrustedCACertificatesFromTrustStore ())
130+ .withTrustedCertificateAuthorities (loadTrustedCACertificatesFromTrustStore (yamlConfig ))
131+ .withOcspRequestTimeout (yamlConfig .getOcspRequestTimeout ())
133132 .build ();
134133 } catch (JceException e ) {
135134 throw new RuntimeException ("Error building the Web eID auth token validator." , e );
0 commit comments