diff options
-rw-r--r-- | eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/Rfc7636Utils.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/Rfc7636Utils.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/Rfc7636Utils.java index b213d932..70d8f3fc 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/Rfc7636Utils.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/utils/Rfc7636Utils.java @@ -1,11 +1,16 @@ package at.gv.egiz.eaaf.core.impl.utils; +import java.io.Serializable; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Base64; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; @@ -119,12 +124,18 @@ public class Rfc7636Utils { */ @Getter @Builder(toBuilder = true) - public static class PkceInfo { + @AllArgsConstructor + public static class PkceInfo implements Serializable { + + private static final long serialVersionUID = -6108734621247661621L; + @JsonProperty(PARAM_NAME_VERIFIER) String codeVerifier; + @JsonProperty(PARAM_NAME_CHALLENGE) String codeChallenge; + @JsonProperty(PARAM_NAME_METHOD) Method codeMethod; /** @@ -132,10 +143,22 @@ public class Rfc7636Utils { * * @return PKCE method */ + @JsonProperty(PARAM_NAME_METHOD) public String getMethod() { return codeMethod.toString(); } + @JsonCreator + protected PkceInfo( + @JsonProperty(PARAM_NAME_VERIFIER) final String verifyer, + @JsonProperty(PARAM_NAME_CHALLENGE) final String challenge, + @JsonProperty(PARAM_NAME_METHOD) final String method) { + this.codeVerifier = verifyer; + this.codeChallenge = challenge; + this.codeMethod = Method.valueOf(method); + + } + } } |