diff --git a/openid-connect-common/src/main/java/org/mitre/oauth2/model/ClientDetailsEntity.java b/openid-connect-common/src/main/java/org/mitre/oauth2/model/ClientDetailsEntity.java index d81d724bc..fc733b34d 100644 --- a/openid-connect-common/src/main/java/org/mitre/oauth2/model/ClientDetailsEntity.java +++ b/openid-connect-common/src/main/java/org/mitre/oauth2/model/ClientDetailsEntity.java @@ -122,6 +122,14 @@ public class ClientDetailsEntity implements ClientDetails { private final String value; + // map to aid reverse lookup + private static final Map lookup = new HashMap(); + static { + for (AuthType a : AuthType.values()) { + lookup.put(a.getValue(), a); + } + } + AuthType(String value) { this.value = value; } @@ -129,6 +137,10 @@ public class ClientDetailsEntity implements ClientDetails { public String getValue() { return value; } + + public static AuthType getByValue(String value) { + return lookup.get(value); + } } public enum AppType { @@ -136,6 +148,14 @@ public class ClientDetailsEntity implements ClientDetails { private final String value; + // map to aid reverse lookup + private static final Map lookup = new HashMap(); + static { + for (AppType a : AppType.values()) { + lookup.put(a.getValue(), a); + } + } + AppType(String value) { this.value = value; } @@ -143,6 +163,10 @@ public class ClientDetailsEntity implements ClientDetails { public String getValue() { return value; } + + public static AppType getByValue(String value) { + return lookup.get(value); + } } /**