Skip to content

Commit 67e25bd

Browse files
NFC-46 Add web-eid-1.1 token support
Signed-off-by: Sander Kondratjev <[email protected]>
1 parent 2d8b399 commit 67e25bd

33 files changed

+1458
-245
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2020-2025 Estonian Information System Authority
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in all
12+
* copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
* SOFTWARE.
21+
*/
22+
23+
package eu.webeid.security.authtoken;
24+
25+
public class SupportedSignatureAlgorithm {
26+
private String cryptoAlgorithm;
27+
private String hashFunction;
28+
private String paddingScheme;
29+
30+
public String getCryptoAlgorithm() {
31+
return cryptoAlgorithm;
32+
}
33+
34+
public void setCryptoAlgorithm(String cryptoAlgorithm) {
35+
this.cryptoAlgorithm = cryptoAlgorithm;
36+
}
37+
38+
public String getHashFunction() {
39+
return hashFunction;
40+
}
41+
42+
public void setHashFunction(String hashFunction) {
43+
this.hashFunction = hashFunction;
44+
}
45+
46+
public String getPaddingScheme() {
47+
return paddingScheme;
48+
}
49+
50+
public void setPaddingScheme(String paddingScheme) {
51+
this.paddingScheme = paddingScheme;
52+
}
53+
}

src/main/java/eu/webeid/security/authtoken/WebEidAuthToken.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
2626

27+
import java.util.List;
28+
2729
@JsonIgnoreProperties(ignoreUnknown = true)
2830
public class WebEidAuthToken {
2931

@@ -32,6 +34,9 @@ public class WebEidAuthToken {
3234
private String algorithm;
3335
private String format;
3436

37+
private String unverifiedSigningCertificate;
38+
private List<SupportedSignatureAlgorithm> supportedSignatureAlgorithms;
39+
3540
public String getUnverifiedCertificate() {
3641
return unverifiedCertificate;
3742
}
@@ -64,4 +69,19 @@ public void setFormat(String format) {
6469
this.format = format;
6570
}
6671

72+
public String getUnverifiedSigningCertificate() {
73+
return unverifiedSigningCertificate;
74+
}
75+
76+
public void setUnverifiedSigningCertificate(String unverifiedSigningCertificate) {
77+
this.unverifiedSigningCertificate = unverifiedSigningCertificate;
78+
}
79+
80+
public List<SupportedSignatureAlgorithm> getSupportedSignatureAlgorithms() {
81+
return supportedSignatureAlgorithms;
82+
}
83+
84+
public void setSupportedSignatureAlgorithms(List<SupportedSignatureAlgorithm> supportedSignatureAlgorithms) {
85+
this.supportedSignatureAlgorithms = supportedSignatureAlgorithms;
86+
}
6787
}

src/main/java/eu/webeid/security/challenge/ChallengeNonceStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
package eu.webeid.security.challenge;
2424

25-
import eu.webeid.security.exceptions.ChallengeNonceExpiredException;
2625
import eu.webeid.security.exceptions.AuthTokenException;
26+
import eu.webeid.security.exceptions.ChallengeNonceExpiredException;
2727
import eu.webeid.security.exceptions.ChallengeNonceNotFoundException;
2828

2929
import static eu.webeid.security.util.DateAndTime.utcNow;

src/main/java/eu/webeid/security/validator/AuthTokenValidationConfiguration.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import static eu.webeid.security.util.DateAndTime.requirePositiveDuration;
4141

4242
/**
43-
* Stores configuration parameters for {@link AuthTokenValidatorImpl}.
43+
* Stores configuration parameters for {@link AuthTokenValidatorManager}.
4444
*/
4545
public final class AuthTokenValidationConfiguration {
4646

@@ -79,15 +79,15 @@ void setSiteOrigin(URI siteOrigin) {
7979
this.siteOrigin = siteOrigin;
8080
}
8181

82-
URI getSiteOrigin() {
82+
public URI getSiteOrigin() {
8383
return siteOrigin;
8484
}
8585

86-
Collection<X509Certificate> getTrustedCACertificates() {
86+
public Collection<X509Certificate> getTrustedCACertificates() {
8787
return trustedCACertificates;
8888
}
8989

90-
boolean isUserCertificateRevocationCheckWithOcspEnabled() {
90+
public boolean isUserCertificateRevocationCheckWithOcspEnabled() {
9191
return isUserCertificateRevocationCheckWithOcspEnabled;
9292
}
9393

@@ -152,7 +152,7 @@ void validate() {
152152
requirePositiveDuration(maxOcspResponseThisUpdateAge, "Max OCSP response thisUpdate age");
153153
}
154154

155-
AuthTokenValidationConfiguration copy() {
155+
public AuthTokenValidationConfiguration copy() {
156156
return new AuthTokenValidationConfiguration(this);
157157
}
158158

src/main/java/eu/webeid/security/validator/AuthTokenValidator.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
*/
3535
public interface AuthTokenValidator {
3636

37-
String CURRENT_TOKEN_FORMAT_VERSION = "web-eid:1";
38-
3937
/**
4038
* Parses the Web eID authentication token signed by the subject.
4139
*

src/main/java/eu/webeid/security/validator/AuthTokenValidatorBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public AuthTokenValidator build() throws NullPointerException, IllegalArgumentEx
214214
if (configuration.isUserCertificateRevocationCheckWithOcspEnabled() && ocspClient == null) {
215215
ocspClient = OcspClientImpl.build(configuration.getOcspRequestTimeout());
216216
}
217-
return new AuthTokenValidatorImpl(configuration, ocspClient);
217+
return new AuthTokenValidatorManager(configuration, ocspClient);
218218
}
219219

220220
}

src/main/java/eu/webeid/security/validator/AuthTokenValidatorImpl.java

Lines changed: 0 additions & 193 deletions
This file was deleted.

0 commit comments

Comments
 (0)