Skip to content

Commit 5ab201b

Browse files
committed
Polishing
This change polishes up a couple of the enums in the system.
1 parent b029ce8 commit 5ab201b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

cloudfoundry-client/src/main/java/org/cloudfoundry/uaa/groups/MemberType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@
2323
*/
2424
public enum MemberType {
2525

26+
/**
27+
* The user type
28+
*/
2629
USER("USER"),
2730

31+
/**
32+
* The group type
33+
*/
2834
GROUP("GROUP");
2935

3036
private final String value;

cloudfoundry-client/src/main/java/org/cloudfoundry/uaa/identityproviders/ExternalGroupMappingMode.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,33 @@
1616

1717
package org.cloudfoundry.uaa.identityproviders;
1818

19+
import com.fasterxml.jackson.annotation.JsonCreator;
20+
1921
/**
2022
* The mapping mode for a {@link SamlConfiguration}
2123
*/
2224
public enum ExternalGroupMappingMode {
2325

26+
/**
27+
* The explicitly mapped type
28+
*/
2429
EXPLICITLY_MAPPED,
2530

26-
AS_SCOPES
31+
/**
32+
* The as scopes type
33+
*/
34+
AS_SCOPES;
35+
36+
@JsonCreator
37+
static ExternalGroupMappingMode from(String s) {
38+
switch (s.toLowerCase()) {
39+
case "explicitly_mapped":
40+
return EXPLICITLY_MAPPED;
41+
case "as_scopes":
42+
return AS_SCOPES;
43+
default:
44+
throw new IllegalArgumentException(String.format("Unknown external group mapping mode: %s", s));
45+
}
46+
}
2747

2848
}

0 commit comments

Comments
 (0)