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 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.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, 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(schemas, other.schemas);
}
public static Builder builder()
{
return new Builder();
}
public static final class Builder
{
private List allowedCORSheaders = Collections.emptyList();
private List allowedCORSorigins = Collections.emptyList();
private String rootGroup;
private List membershipGroups = Collections.emptyList();
private List excludedMembershipGroups = Collections.emptyList();
private List membershipAttributes = Collections.emptyList();
private List schemas;
private Builder()
{
}
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 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);
}
}
}