Skip to content

Commit 015b69d

Browse files
aarmamSanderKondratjevNortal
authored andcommitted
NFC-46 Check null authToken
Signed-off-by: Sander Kondratjev [email protected]
1 parent 15e849a commit 015b69d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import java.io.IOException;
3737
import java.security.cert.X509Certificate;
38+
import java.util.Objects;
3839

3940
/**
4041
* Provides the default implementation of {@link AuthTokenValidator}.
@@ -46,10 +47,10 @@ final class AuthTokenValidatorManager implements AuthTokenValidator {
4647
private final AuthTokenVersionValidatorFactory tokenValidatorFactory;
4748

4849
// Use human-readable meaningful names for token length limits.
49-
private final int TOKEN_MIN_LENGTH = 100;
50-
private final int TOKEN_MAX_LENGTH = 10000;
50+
private static final int TOKEN_MIN_LENGTH = 100;
51+
private static final int TOKEN_MAX_LENGTH = 10000;
5152

52-
private final ObjectReader TOKEN_READER = new ObjectMapper().readerFor(WebEidAuthToken.class);
53+
private static final ObjectReader TOKEN_READER = new ObjectMapper().readerFor(WebEidAuthToken.class);
5354

5455
AuthTokenValidatorManager(AuthTokenValidationConfiguration configuration, OcspClient ocspClient)
5556
throws JceException {
@@ -72,6 +73,7 @@ public WebEidAuthToken parse(String authToken) throws AuthTokenException {
7273
@Override
7374
public X509Certificate validate(WebEidAuthToken authToken, String currentChallengeNonce) throws AuthTokenException {
7475
try {
76+
Objects.requireNonNull(authToken, "authToken must not be null");
7577
LOG.info("Starting token validation");
7678
return tokenValidatorFactory
7779
.getValidatorFor(authToken.getFormat())

0 commit comments

Comments
 (0)