■ ■ ■ ■ ■ ■
src/main/java/org/owasp/wrongsecrets/challenges/cloud/Challenge11.java
| skipped 42 lines |
43 | 43 | | private final String azureDefaultValue; |
44 | 44 | | private final String challengeAnswer; |
45 | 45 | | private final String projectId; |
46 | | - | private final RuntimeEnvironment runtimeEnvironment; |
47 | 46 | | private final String azureVaultUri; |
48 | 47 | | private final String azureWrongSecret3; |
49 | 48 | | |
| skipped 16 lines |
66 | 65 | | this.gcpDefaultValue = gcpDefaultValue; |
67 | 66 | | this.azureDefaultValue = azureDefaultValue; |
68 | 67 | | this.projectId = projectId; |
69 | | - | this.runtimeEnvironment = runtimeEnvironment; |
70 | 68 | | this.azureVaultUri = azureVaultUri; |
71 | 69 | | this.azureWrongSecret3 = azureWrongSecret3; |
72 | | - | this.challengeAnswer = getChallenge11Value(this.runtimeEnvironment); |
| 70 | + | this.challengeAnswer = getChallenge11Value(runtimeEnvironment); |
73 | 71 | | } |
74 | 72 | | |
75 | 73 | | @Override |
| skipped 12 lines |
88 | 86 | | |
89 | 87 | | private String getChallenge11Value(RuntimeEnvironment runtimeEnvironment) { |
90 | 88 | | if (runtimeEnvironment != null && runtimeEnvironment.getRuntimeEnvironment() != null) { |
91 | | - | switch (runtimeEnvironment.getRuntimeEnvironment()) { |
92 | | - | case AWS: |
93 | | - | return getAWSChallenge11Value(); |
94 | | - | case GCP: |
95 | | - | return getGCPChallenge11Value(); |
96 | | - | case AZURE: |
97 | | - | return getAzureChallenge11Value(); |
98 | | - | default: |
99 | | - | return "please_use_supported_cloud_env"; |
100 | | - | } |
| 89 | + | return switch (runtimeEnvironment.getRuntimeEnvironment()) { |
| 90 | + | case AWS -> getAWSChallenge11Value(); |
| 91 | + | case GCP -> getGCPChallenge11Value(); |
| 92 | + | case AZURE -> getAzureChallenge11Value(); |
| 93 | + | default -> "please_use_supported_cloud_env"; |
| 94 | + | }; |
101 | 95 | | } |
102 | 96 | | return "please_use_supported_cloud_env"; |
103 | 97 | | } |
| skipped 75 lines |