aboutsummaryrefslogtreecommitdiffstats
path: root/security-utils
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2018-12-05 16:13:08 +0100
committerBjørn Christian Seime <bjorncs@oath.com>2018-12-05 16:35:35 +0100
commitb3758264b1f374500408ecc8c6a5976012749574 (patch)
treeb4751c49703c1d5ebbccdc7af67e300d963d3bd0 /security-utils
parent0b4bd58456ae968d17e0a1a56486f1051f8dc1fe (diff)
Add AutorizationMode
Diffstat (limited to 'security-utils')
-rw-r--r--security-utils/src/main/java/com/yahoo/security/tls/AuthorizationMode.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/security-utils/src/main/java/com/yahoo/security/tls/AuthorizationMode.java b/security-utils/src/main/java/com/yahoo/security/tls/AuthorizationMode.java
new file mode 100644
index 00000000000..141214dc478
--- /dev/null
+++ b/security-utils/src/main/java/com/yahoo/security/tls/AuthorizationMode.java
@@ -0,0 +1,30 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.security.tls;
+
+import java.util.Arrays;
+
+/**
+ * @author bjorncs
+ */
+public enum AuthorizationMode {
+ DISABLE("disable"),
+ LOG_ONLY("log-only"),
+ ENFORCE("enforce");
+
+ final String configValue;
+
+ AuthorizationMode(String configValue) {
+ this.configValue = configValue;
+ }
+
+ public String configValue() {
+ return configValue;
+ }
+
+ static AuthorizationMode fromConfigValue(String configValue) {
+ return Arrays.stream(values())
+ .filter(v -> v.configValue.equals(configValue))
+ .findFirst()
+ .orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
+ }
+}