
software.amazon.awssdk.services.verifiedpermissions.model.OpenIdConnectConfigurationItem Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.verifiedpermissions.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Contains configuration details of an OpenID Connect (OIDC) identity provider, or identity source, that Verified
* Permissions can use to generate entities from authenticated identities. It specifies the issuer URL, token type that
* you want to use, and policy store entity details.
*
*
* This data type is part of a ConfigurationItem structure, which is a parameter to ListIdentitySources.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OpenIdConnectConfigurationItem implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ISSUER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("issuer")
.getter(getter(OpenIdConnectConfigurationItem::issuer)).setter(setter(Builder::issuer))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("issuer").build()).build();
private static final SdkField ENTITY_ID_PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("entityIdPrefix").getter(getter(OpenIdConnectConfigurationItem::entityIdPrefix))
.setter(setter(Builder::entityIdPrefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("entityIdPrefix").build()).build();
private static final SdkField GROUP_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("groupConfiguration")
.getter(getter(OpenIdConnectConfigurationItem::groupConfiguration)).setter(setter(Builder::groupConfiguration))
.constructor(OpenIdConnectGroupConfigurationItem::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("groupConfiguration").build())
.build();
private static final SdkField TOKEN_SELECTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("tokenSelection")
.getter(getter(OpenIdConnectConfigurationItem::tokenSelection)).setter(setter(Builder::tokenSelection))
.constructor(OpenIdConnectTokenSelectionItem::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tokenSelection").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ISSUER_FIELD,
ENTITY_ID_PREFIX_FIELD, GROUP_CONFIGURATION_FIELD, TOKEN_SELECTION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String issuer;
private final String entityIdPrefix;
private final OpenIdConnectGroupConfigurationItem groupConfiguration;
private final OpenIdConnectTokenSelectionItem tokenSelection;
private OpenIdConnectConfigurationItem(BuilderImpl builder) {
this.issuer = builder.issuer;
this.entityIdPrefix = builder.entityIdPrefix;
this.groupConfiguration = builder.groupConfiguration;
this.tokenSelection = builder.tokenSelection;
}
/**
*
* The issuer URL of an OIDC identity provider. This URL must have an OIDC discovery endpoint at the path
* .well-known/openid-configuration
.
*
*
* @return The issuer URL of an OIDC identity provider. This URL must have an OIDC discovery endpoint at the path
* .well-known/openid-configuration
.
*/
public final String issuer() {
return issuer;
}
/**
*
* A descriptive string that you want to prefix to user entities from your OIDC identity provider. For example, if
* you set an entityIdPrefix
of MyOIDCProvider
, you can reference principals in your
* policies in the format MyCorp::User::MyOIDCProvider|Carlos
.
*
*
* @return A descriptive string that you want to prefix to user entities from your OIDC identity provider. For
* example, if you set an entityIdPrefix
of MyOIDCProvider
, you can reference
* principals in your policies in the format MyCorp::User::MyOIDCProvider|Carlos
.
*/
public final String entityIdPrefix() {
return entityIdPrefix;
}
/**
*
* The claim in OIDC identity provider tokens that indicates a user's group membership, and the entity type that you
* want to map it to. For example, this object can map the contents of a groups
claim to
* MyCorp::UserGroup
.
*
*
* @return The claim in OIDC identity provider tokens that indicates a user's group membership, and the entity type
* that you want to map it to. For example, this object can map the contents of a groups
claim
* to MyCorp::UserGroup
.
*/
public final OpenIdConnectGroupConfigurationItem groupConfiguration() {
return groupConfiguration;
}
/**
*
* The token type that you want to process from your OIDC identity provider. Your policy store can process either
* identity (ID) or access tokens from a given OIDC identity source.
*
*
* @return The token type that you want to process from your OIDC identity provider. Your policy store can process
* either identity (ID) or access tokens from a given OIDC identity source.
*/
public final OpenIdConnectTokenSelectionItem tokenSelection() {
return tokenSelection;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(issuer());
hashCode = 31 * hashCode + Objects.hashCode(entityIdPrefix());
hashCode = 31 * hashCode + Objects.hashCode(groupConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(tokenSelection());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof OpenIdConnectConfigurationItem)) {
return false;
}
OpenIdConnectConfigurationItem other = (OpenIdConnectConfigurationItem) obj;
return Objects.equals(issuer(), other.issuer()) && Objects.equals(entityIdPrefix(), other.entityIdPrefix())
&& Objects.equals(groupConfiguration(), other.groupConfiguration())
&& Objects.equals(tokenSelection(), other.tokenSelection());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("OpenIdConnectConfigurationItem").add("Issuer", issuer())
.add("EntityIdPrefix", entityIdPrefix() == null ? null : "*** Sensitive Data Redacted ***")
.add("GroupConfiguration", groupConfiguration()).add("TokenSelection", tokenSelection()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "issuer":
return Optional.ofNullable(clazz.cast(issuer()));
case "entityIdPrefix":
return Optional.ofNullable(clazz.cast(entityIdPrefix()));
case "groupConfiguration":
return Optional.ofNullable(clazz.cast(groupConfiguration()));
case "tokenSelection":
return Optional.ofNullable(clazz.cast(tokenSelection()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("issuer", ISSUER_FIELD);
map.put("entityIdPrefix", ENTITY_ID_PREFIX_FIELD);
map.put("groupConfiguration", GROUP_CONFIGURATION_FIELD);
map.put("tokenSelection", TOKEN_SELECTION_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function