blob: 580a8cc5dfdc0d12ac0f2775970fa50321a03e1d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// 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 MixedMode {
PLAINTEXT_CLIENT_MIXED_SERVER("plaintext_client_mixed_server"),
TLS_CLIENT_MIXED_SERVER("tls_client_mixed_server"),
DISABLED("tls_client_tls_server");
final String configValue;
MixedMode(String configValue) {
this.configValue = configValue;
}
public String configValue() {
return configValue;
}
/**
* @return Default value when mixed mode is not explicitly specified
*/
public static MixedMode defaultValue() {
return DISABLED;
}
public static MixedMode fromConfigValue(String configValue) {
return Arrays.stream(values())
.filter(v -> v.configValue.equals(configValue))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unknown value: " + configValue));
}
}
|