Skip to content

Commit 70019ee

Browse files
committed
Update IdentityZone related classes and tests
Signed-off-by: Duane May <duane.may@broadcom.com>
1 parent 0b64d08 commit 70019ee

File tree

9 files changed

+416
-720
lines changed

9 files changed

+416
-720
lines changed

model/src/main/java/org/cloudfoundry/identity/uaa/zone/IdentityZone.java

Lines changed: 23 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,21 @@
44
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
55
import com.fasterxml.jackson.annotation.JsonInclude;
66
import com.fasterxml.jackson.annotation.JsonProperty;
7+
import lombok.Data;
8+
import lombok.EqualsAndHashCode;
79
import org.cloudfoundry.identity.uaa.constants.OriginKeys;
810

911
import javax.validation.constraints.NotNull;
1012
import java.util.Calendar;
1113
import java.util.Date;
1214

15+
@Data
16+
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
1317
@JsonInclude(JsonInclude.Include.NON_NULL)
1418
@JsonIgnoreProperties(ignoreUnknown = true)
1519
public class IdentityZone {
16-
public static IdentityZone getUaa() {
17-
Calendar calendar = Calendar.getInstance();
18-
calendar.clear();
19-
calendar.set(Calendar.YEAR, 2000);
20-
IdentityZone uaa = new IdentityZone();
21-
uaa.setCreated(calendar.getTime());
22-
uaa.setLastModified(calendar.getTime());
23-
uaa.setVersion(0);
24-
uaa.setId(OriginKeys.UAA);
25-
uaa.setName(OriginKeys.UAA);
26-
uaa.setDescription("The system zone for backwards compatibility");
27-
uaa.setSubdomain("");
28-
return uaa;
29-
}
30-
31-
public static String getUaaZoneId() {
32-
return getUaa().getId();
33-
}
34-
35-
@JsonIgnore
36-
public boolean isUaa() {
37-
return this.equals(getUaa());
38-
}
3920

21+
@EqualsAndHashCode.Include
4022
private String id;
4123

4224
@NotNull
@@ -58,97 +40,27 @@ public boolean isUaa() {
5840

5941
private boolean active = true;
6042

61-
public Date getCreated() {
62-
return created;
63-
}
64-
65-
public void setCreated(Date created) {
66-
this.created = created;
67-
}
68-
69-
public Date getLastModified() {
70-
return lastModified;
71-
}
72-
73-
public void setLastModified(Date lastModified) {
74-
this.lastModified = lastModified;
75-
}
76-
77-
public void setVersion(int version) {
78-
this.version = version;
79-
}
80-
81-
public int getVersion() {
82-
return version;
83-
}
84-
85-
public String getName() {
86-
return name;
87-
}
88-
89-
public void setName(String name) {
90-
this.name = name;
91-
}
92-
93-
public String getSubdomain() {
94-
return subdomain;
95-
}
96-
97-
public void setSubdomain(String subdomain) {
98-
this.subdomain = subdomain;
99-
}
100-
101-
public String getId() {
102-
return id;
103-
}
104-
105-
public void setId(String id) {
106-
this.id = id;
107-
}
108-
109-
public String getDescription() {
110-
return description;
111-
}
112-
113-
public void setDescription(String description) {
114-
this.description = description;
115-
}
116-
117-
public boolean isActive() {
118-
return active;
119-
}
120-
121-
public void setActive(boolean active) {
122-
this.active = active;
123-
}
124-
125-
public IdentityZoneConfiguration getConfig() {
126-
return config;
127-
}
128-
129-
public void setConfig(IdentityZoneConfiguration config) {
130-
this.config = config;
43+
public static IdentityZone getUaa() {
44+
Calendar calendar = Calendar.getInstance();
45+
calendar.clear();
46+
calendar.set(Calendar.YEAR, 2000);
47+
IdentityZone uaa = new IdentityZone();
48+
uaa.setCreated(calendar.getTime());
49+
uaa.setLastModified(calendar.getTime());
50+
uaa.setVersion(0);
51+
uaa.setId(OriginKeys.UAA);
52+
uaa.setName(OriginKeys.UAA);
53+
uaa.setDescription("The system zone for backwards compatibility");
54+
uaa.setSubdomain("");
55+
return uaa;
13156
}
13257

133-
@Override
134-
public int hashCode() {
135-
final int prime = 31;
136-
int result = 1;
137-
result = prime * result + ((id == null) ? 0 : id.hashCode());
138-
return result;
58+
public static String getUaaZoneId() {
59+
return getUaa().getId();
13960
}
14061

141-
@Override
142-
public boolean equals(Object obj) {
143-
if (this == obj)
144-
return true;
145-
if (obj == null)
146-
return false;
147-
if (getClass() != obj.getClass())
148-
return false;
149-
IdentityZone other = (IdentityZone) obj;
150-
if (id == null) {
151-
return other.id == null;
152-
} else return id.equals(other.id);
62+
@JsonIgnore
63+
public boolean isUaa() {
64+
return this.equals(getUaa());
15365
}
15466
}

model/src/main/java/org/cloudfoundry/identity/uaa/zone/IdentityZoneConfiguration.java

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515

1616
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
1717
import com.fasterxml.jackson.annotation.JsonInclude;
18+
import lombok.Data;
1819
import org.cloudfoundry.identity.uaa.login.Prompt;
1920

2021
import java.net.MalformedURLException;
2122
import java.net.URL;
2223
import java.util.Arrays;
2324
import java.util.List;
2425

26+
@Data
2527
@JsonInclude(JsonInclude.Include.NON_NULL)
2628
@JsonIgnoreProperties(ignoreUnknown = true)
2729
public class IdentityZoneConfiguration {
@@ -32,118 +34,44 @@ public class IdentityZoneConfiguration {
3234
private CorsPolicy corsPolicy = new CorsPolicy();
3335
private Links links = new Links();
3436
private List<Prompt> prompts = Arrays.asList(
35-
new Prompt("username", "text", "Email"),
36-
new Prompt("password", "password", "Password"),
37-
new Prompt("passcode", "password", "Temporary Authentication Code (Get on at /passcode)")
37+
new Prompt("username", "text", "Email"),
38+
new Prompt("password", "password", "Password"),
39+
new Prompt("passcode", "password", "Temporary Authentication Code (Get on at /passcode)")
3840
);
3941
private boolean idpDiscoveryEnabled = false;
4042
private BrandingInformation branding;
4143
private boolean accountChooserEnabled;
4244
private UserConfig userConfig = new UserConfig();
45+
@JsonInclude(JsonInclude.Include.NON_NULL)
4346
private String issuer;
4447
private String defaultIdentityProvider;
4548

46-
public IdentityZoneConfiguration() {}
47-
48-
public IdentityZoneConfiguration(TokenPolicy tokenPolicy) {
49-
this.tokenPolicy = tokenPolicy;
50-
}
51-
52-
public ClientSecretPolicy getClientSecretPolicy() {
53-
return clientSecretPolicy;
49+
public IdentityZoneConfiguration() {
5450
}
5551

56-
public void setClientSecretPolicy(ClientSecretPolicy clientSecretPolicy) {
57-
this.clientSecretPolicy = clientSecretPolicy;
58-
}
59-
60-
public TokenPolicy getTokenPolicy() {
61-
return tokenPolicy;
62-
}
63-
64-
public void setTokenPolicy(TokenPolicy tokenPolicy) {
52+
public IdentityZoneConfiguration(TokenPolicy tokenPolicy) {
6553
this.tokenPolicy = tokenPolicy;
6654
}
6755

68-
public SamlConfig getSamlConfig() {
69-
return samlConfig;
70-
}
71-
7256
public IdentityZoneConfiguration setSamlConfig(SamlConfig samlConfig) {
7357
this.samlConfig = samlConfig;
7458
return this;
7559
}
7660

77-
public Links getLinks() {
78-
return links;
79-
}
80-
8161
public IdentityZoneConfiguration setLinks(Links links) {
8262
this.links = links;
8363
return this;
8464
}
8565

86-
public List<Prompt> getPrompts() {
87-
return prompts;
88-
}
89-
9066
public IdentityZoneConfiguration setPrompts(List<Prompt> prompts) {
9167
this.prompts = prompts;
9268
return this;
9369
}
9470

95-
public boolean isIdpDiscoveryEnabled() {
96-
return idpDiscoveryEnabled;
97-
}
98-
99-
public void setIdpDiscoveryEnabled(boolean idpDiscoveryEnabled) {
100-
this.idpDiscoveryEnabled = idpDiscoveryEnabled;
101-
}
102-
103-
public BrandingInformation getBranding() {
104-
return branding;
105-
}
106-
107-
public void setBranding(BrandingInformation branding) {
108-
this.branding = branding;
109-
}
110-
111-
public void setAccountChooserEnabled(boolean accountChooserEnabled) {
112-
this.accountChooserEnabled = accountChooserEnabled;
113-
}
114-
115-
public CorsPolicy getCorsPolicy() {
116-
return corsPolicy;
117-
}
118-
11971
public IdentityZoneConfiguration setCorsPolicy(CorsPolicy corsPolicy) {
12072
this.corsPolicy = corsPolicy;
12173
return this;
12274
}
123-
public boolean isAccountChooserEnabled() {
124-
return accountChooserEnabled;
125-
}
126-
127-
public UserConfig getUserConfig() {
128-
return userConfig;
129-
}
130-
131-
public void setUserConfig(UserConfig userConfig) {
132-
this.userConfig = userConfig;
133-
}
134-
135-
public String getDefaultIdentityProvider() {
136-
return defaultIdentityProvider;
137-
}
138-
139-
public void setDefaultIdentityProvider(String defaultIdentityProvider) {
140-
this.defaultIdentityProvider = defaultIdentityProvider;
141-
}
142-
143-
@JsonInclude(JsonInclude.Include.NON_NULL)
144-
public String getIssuer() {
145-
return issuer;
146-
}
14775

14876
@JsonInclude(JsonInclude.Include.NON_NULL)
14977
public void setIssuer(String issuer) {

0 commit comments

Comments
 (0)