io.imunity.scim.config.SCIMEndpointConfiguration Maven / Gradle / Ivy
/*
* Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.scim.config;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class SCIMEndpointConfiguration
{
public final List allowedCorsHeaders;
public final List allowedCorsOrigins;
public final String rootGroup;
public final String restAdminGroup;
public final List membershipGroups;
public final List schemas;
public final List membershipAttributes;
public final List excludedMembershipGroups;
private SCIMEndpointConfiguration(Builder builder)
{
this.allowedCorsHeaders = List.copyOf(builder.allowedCORSheaders);
this.allowedCorsOrigins = List.copyOf(builder.allowedCORSorigins);
this.rootGroup = builder.rootGroup;
this.restAdminGroup = builder.restAdminGroup;
this.membershipGroups = List.copyOf(builder.membershipGroups);
this.excludedMembershipGroups = List.copyOf(builder.excludedMembershipGroups);
this.schemas = List.copyOf(builder.schemas);
this.membershipAttributes = List.copyOf(builder.membershipAttributes);
}
@Override
public int hashCode()
{
return Objects.hash(allowedCorsHeaders, allowedCorsOrigins, membershipGroups, excludedMembershipGroups,
rootGroup, restAdminGroup, schemas, membershipAttributes);
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SCIMEndpointConfiguration other = (SCIMEndpointConfiguration) obj;
return Objects.equals(allowedCorsHeaders, other.allowedCorsHeaders)
&& Objects.equals(allowedCorsOrigins, other.allowedCorsOrigins)
&& Objects.equals(membershipGroups, other.membershipGroups)
&& Objects.equals(excludedMembershipGroups, other.excludedMembershipGroups)
&& Objects.equals(membershipAttributes, other.membershipAttributes)
&& Objects.equals(rootGroup, other.rootGroup) && Objects.equals(restAdminGroup, other.restAdminGroup)
&& Objects.equals(schemas, other.schemas);
}
public static Builder builder()
{
return new Builder();
}
public static Builder builder(SCIMEndpointConfiguration oldConfig)
{
return new Builder(oldConfig);
}
public static final class Builder
{
private List allowedCORSheaders = Collections.emptyList();
private List allowedCORSorigins = Collections.emptyList();
private String rootGroup;
private String restAdminGroup;
private List membershipGroups = Collections.emptyList();
private List excludedMembershipGroups = Collections.emptyList();
private List membershipAttributes = Collections.emptyList();
private List schemas;
private Builder()
{
}
private Builder(SCIMEndpointConfiguration oldConfig)
{
this.allowedCORSheaders = List.copyOf(oldConfig.allowedCorsHeaders);
this.allowedCORSorigins = List.copyOf(oldConfig.allowedCorsOrigins);
this.rootGroup = oldConfig.rootGroup;
this.restAdminGroup = oldConfig.restAdminGroup;
this.membershipGroups = List.copyOf(oldConfig.membershipGroups);
this.excludedMembershipGroups = List.copyOf(oldConfig.excludedMembershipGroups);
this.membershipAttributes = List.copyOf(oldConfig.membershipAttributes);
this.schemas = List.copyOf(oldConfig.schemas);
}
public Builder withAllowedCorsHeaders(List allowedCorsHeaders)
{
this.allowedCORSheaders = allowedCorsHeaders;
return this;
}
public Builder withAllowedCorsOrigins(List allowedCorsOrigins)
{
this.allowedCORSorigins = allowedCorsOrigins;
return this;
}
public Builder withRootGroup(String rootGroup)
{
this.rootGroup = rootGroup;
return this;
}
public Builder withRestAdminGroup(String adminGroup)
{
this.restAdminGroup = adminGroup;
return this;
}
public Builder withMembershipAttributes(List membershipAttributes)
{
this.membershipAttributes = membershipAttributes;
return this;
}
public Builder withMembershipGroups(List membershipGroups)
{
this.membershipGroups = membershipGroups;
return this;
}
public Builder withExcludedMembershipGroups(List excludedMembershipGroups)
{
this.excludedMembershipGroups = excludedMembershipGroups;
return this;
}
public Builder withSchemas(List schemas)
{
this.schemas = schemas;
return this;
}
public SCIMEndpointConfiguration build()
{
return new SCIMEndpointConfiguration(this);
}
}
}