@@ -77,8 +77,7 @@ public ChallengeNonceGenerator generator(ChallengeNonceStore challengeNonceStore
77
77
.build ();
78
78
}
79
79
80
- @ Bean
81
- public X509Certificate [] loadTrustedCACertificatesFromCerFiles () {
80
+ private X509Certificate [] loadTrustedCACertificatesFromCerFiles () {
82
81
List <X509Certificate > caCertificates = new ArrayList <>();
83
82
84
83
try {
@@ -99,8 +98,7 @@ public X509Certificate[] loadTrustedCACertificatesFromCerFiles() {
99
98
return caCertificates .toArray (new X509Certificate [0 ]);
100
99
}
101
100
102
- @ Bean
103
- public X509Certificate [] loadTrustedCACertificatesFromTrustStore () {
101
+ private X509Certificate [] loadTrustedCACertificatesFromTrustStore (YAMLConfig yamlConfig ) {
104
102
List <X509Certificate > caCertificates = new ArrayList <>();
105
103
106
104
try (InputStream is = ValidationConfiguration .class .getResourceAsStream (CERTS_RESOURCE_PATH + activeProfile + "/" + TRUSTED_CERTIFICATES_JKS )) {
@@ -109,7 +107,7 @@ public X509Certificate[] loadTrustedCACertificatesFromTrustStore() {
109
107
return new X509Certificate [0 ];
110
108
}
111
109
KeyStore keystore = KeyStore .getInstance (KeyStore .getDefaultType ());
112
- keystore .load (is , yamlConfig () .getTrustStorePassword ().toCharArray ());
110
+ keystore .load (is , yamlConfig .getTrustStorePassword ().toCharArray ());
113
111
Enumeration <String > aliases = keystore .aliases ();
114
112
while (aliases .hasMoreElements ()) {
115
113
String alias = aliases .nextElement ();
@@ -124,12 +122,13 @@ public X509Certificate[] loadTrustedCACertificatesFromTrustStore() {
124
122
}
125
123
126
124
@ Bean
127
- public AuthTokenValidator validator () {
125
+ public AuthTokenValidator validator (YAMLConfig yamlConfig ) {
128
126
try {
129
127
return new AuthTokenValidatorBuilder ()
130
- .withSiteOrigin (URI .create (yamlConfig () .getLocalOrigin ()))
128
+ .withSiteOrigin (URI .create (yamlConfig .getLocalOrigin ()))
131
129
.withTrustedCertificateAuthorities (loadTrustedCACertificatesFromCerFiles ())
132
- .withTrustedCertificateAuthorities (loadTrustedCACertificatesFromTrustStore ())
130
+ .withTrustedCertificateAuthorities (loadTrustedCACertificatesFromTrustStore (yamlConfig ))
131
+ .withOcspRequestTimeout (yamlConfig .getOcspRequestTimeout ())
133
132
.build ();
134
133
} catch (JceException e ) {
135
134
throw new RuntimeException ("Error building the Web eID auth token validator." , e );
0 commit comments