From f226b8957ff6fc4b88499da922057641353884df Mon Sep 17 00:00:00 2001 From: Marco Massenzio Date: Tue, 25 Jan 2022 22:08:19 -0800 Subject: [PATCH] Moved constant to Constants class --- jwt-opa/src/main/java/com/alertavert/opa/Constants.java | 2 ++ .../alertavert/opa/security/crypto/KeypairFileReader.java | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jwt-opa/src/main/java/com/alertavert/opa/Constants.java b/jwt-opa/src/main/java/com/alertavert/opa/Constants.java index e74452e..68aad04 100644 --- a/jwt-opa/src/main/java/com/alertavert/opa/Constants.java +++ b/jwt-opa/src/main/java/com/alertavert/opa/Constants.java @@ -83,6 +83,8 @@ public class Constants { + "({}) not an instance of ApiTokenAuthentication, cannot progress authorization"; public static final String CANNOT_PARSE_AUTHORIZATION_REQUEST = "Cannot parse Authorization " + "request: {}"; + public static final String ERROR_CANNOT_READ_KEY = "Could not read key: path = {}, algorithm = {}"; + public static final String API_TOKEN = "api_token"; /** diff --git a/jwt-opa/src/main/java/com/alertavert/opa/security/crypto/KeypairFileReader.java b/jwt-opa/src/main/java/com/alertavert/opa/security/crypto/KeypairFileReader.java index ad75c55..a6db527 100644 --- a/jwt-opa/src/main/java/com/alertavert/opa/security/crypto/KeypairFileReader.java +++ b/jwt-opa/src/main/java/com/alertavert/opa/security/crypto/KeypairFileReader.java @@ -29,6 +29,8 @@ import java.security.PrivateKey; import java.security.PublicKey; +import static com.alertavert.opa.Constants.ERROR_CANNOT_READ_KEY; + /** *

KeypairFileReader

* @@ -49,15 +51,10 @@ */ @Slf4j @Value public class KeypairFileReader implements KeypairReader { - - public static final String ERROR_CANNOT_READ_KEY = - "Could not read key: path = {}, algorithm = {}"; - String algorithm; Path secretKeyPath; Path publicKeyPath; - @Override public KeyPair loadKeys() throws KeyLoadException { return new KeyPair(loadPublicKey(), loadPrivateKey());