Skip to content

Commit ddccfe2

Browse files
svenzikmrts
authored andcommitted
refactor: move private methods after public
WE2-1113 Signed-off-by: Sven Mitt <[email protected]>
1 parent 57fe847 commit ddccfe2

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

example/src/main/java/eu/webeid/example/config/ValidationConfiguration.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,25 @@ public ChallengeNonceGenerator generator(ChallengeNonceStore challengeNonceStore
7777
.build();
7878
}
7979

80+
@Bean
81+
public AuthTokenValidator validator(YAMLConfig yamlConfig) {
82+
try {
83+
return new AuthTokenValidatorBuilder()
84+
.withSiteOrigin(URI.create(yamlConfig.getLocalOrigin()))
85+
.withTrustedCertificateAuthorities(loadTrustedCACertificatesFromCerFiles())
86+
.withTrustedCertificateAuthorities(loadTrustedCACertificatesFromTrustStore(yamlConfig))
87+
.withOcspRequestTimeout(yamlConfig.getOcspRequestTimeout())
88+
.build();
89+
} catch (JceException e) {
90+
throw new RuntimeException("Error building the Web eID auth token validator.", e);
91+
}
92+
}
93+
94+
@Bean
95+
public YAMLConfig yamlConfig() {
96+
return new YAMLConfig();
97+
}
98+
8099
private X509Certificate[] loadTrustedCACertificatesFromCerFiles() {
81100
List<X509Certificate> caCertificates = new ArrayList<>();
82101

@@ -121,23 +140,6 @@ private X509Certificate[] loadTrustedCACertificatesFromTrustStore(YAMLConfig yam
121140
return caCertificates.toArray(new X509Certificate[0]);
122141
}
123142

124-
@Bean
125-
public AuthTokenValidator validator(YAMLConfig yamlConfig) {
126-
try {
127-
return new AuthTokenValidatorBuilder()
128-
.withSiteOrigin(URI.create(yamlConfig.getLocalOrigin()))
129-
.withTrustedCertificateAuthorities(loadTrustedCACertificatesFromCerFiles())
130-
.withTrustedCertificateAuthorities(loadTrustedCACertificatesFromTrustStore(yamlConfig))
131-
.withOcspRequestTimeout(yamlConfig.getOcspRequestTimeout())
132-
.build();
133-
} catch (JceException e) {
134-
throw new RuntimeException("Error building the Web eID auth token validator.", e);
135-
}
136-
}
137143

138-
@Bean
139-
public YAMLConfig yamlConfig() {
140-
return new YAMLConfig();
141-
}
142144

143145
}

0 commit comments

Comments
 (0)