All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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 getter(Function g) { return obj -> g.apply((OpenIdConnectConfigurationItem) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The issuer URL of an OIDC identity provider. This URL must have an OIDC discovery endpoint at the path * .well-known/openid-configuration. *

* * @param issuer * The issuer URL of an OIDC identity provider. This URL must have an OIDC discovery endpoint at the path * .well-known/openid-configuration. * @return Returns a reference to this object so that method calls can be chained together. */ Builder issuer(String 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. *

* * @param entityIdPrefix * 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 Returns a reference to this object so that method calls can be chained together. */ Builder entityIdPrefix(String 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. *

* * @param groupConfiguration * 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 Returns a reference to this object so that method calls can be chained together. */ Builder groupConfiguration(OpenIdConnectGroupConfigurationItem groupConfiguration); /** *

* 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. *

* This is a convenience method that creates an instance of the * {@link OpenIdConnectGroupConfigurationItem.Builder} avoiding the need to create one manually via * {@link OpenIdConnectGroupConfigurationItem#builder()}. * *

* When the {@link Consumer} completes, {@link OpenIdConnectGroupConfigurationItem.Builder#build()} is called * immediately and its result is passed to {@link #groupConfiguration(OpenIdConnectGroupConfigurationItem)}. * * @param groupConfiguration * a consumer that will call methods on {@link OpenIdConnectGroupConfigurationItem.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #groupConfiguration(OpenIdConnectGroupConfigurationItem) */ default Builder groupConfiguration(Consumer groupConfiguration) { return groupConfiguration(OpenIdConnectGroupConfigurationItem.builder().applyMutation(groupConfiguration).build()); } /** *

* 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. *

* * @param tokenSelection * 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 Returns a reference to this object so that method calls can be chained together. */ Builder tokenSelection(OpenIdConnectTokenSelectionItem tokenSelection); /** *

* 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. *

* This is a convenience method that creates an instance of the {@link OpenIdConnectTokenSelectionItem.Builder} * avoiding the need to create one manually via {@link OpenIdConnectTokenSelectionItem#builder()}. * *

* When the {@link Consumer} completes, {@link OpenIdConnectTokenSelectionItem.Builder#build()} is called * immediately and its result is passed to {@link #tokenSelection(OpenIdConnectTokenSelectionItem)}. * * @param tokenSelection * a consumer that will call methods on {@link OpenIdConnectTokenSelectionItem.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tokenSelection(OpenIdConnectTokenSelectionItem) */ default Builder tokenSelection(Consumer tokenSelection) { return tokenSelection(OpenIdConnectTokenSelectionItem.builder().applyMutation(tokenSelection).build()); } } static final class BuilderImpl implements Builder { private String issuer; private String entityIdPrefix; private OpenIdConnectGroupConfigurationItem groupConfiguration; private OpenIdConnectTokenSelectionItem tokenSelection; private BuilderImpl() { } private BuilderImpl(OpenIdConnectConfigurationItem model) { issuer(model.issuer); entityIdPrefix(model.entityIdPrefix); groupConfiguration(model.groupConfiguration); tokenSelection(model.tokenSelection); } public final String getIssuer() { return issuer; } public final void setIssuer(String issuer) { this.issuer = issuer; } @Override public final Builder issuer(String issuer) { this.issuer = issuer; return this; } public final String getEntityIdPrefix() { return entityIdPrefix; } public final void setEntityIdPrefix(String entityIdPrefix) { this.entityIdPrefix = entityIdPrefix; } @Override public final Builder entityIdPrefix(String entityIdPrefix) { this.entityIdPrefix = entityIdPrefix; return this; } public final OpenIdConnectGroupConfigurationItem.Builder getGroupConfiguration() { return groupConfiguration != null ? groupConfiguration.toBuilder() : null; } public final void setGroupConfiguration(OpenIdConnectGroupConfigurationItem.BuilderImpl groupConfiguration) { this.groupConfiguration = groupConfiguration != null ? groupConfiguration.build() : null; } @Override public final Builder groupConfiguration(OpenIdConnectGroupConfigurationItem groupConfiguration) { this.groupConfiguration = groupConfiguration; return this; } public final OpenIdConnectTokenSelectionItem.Builder getTokenSelection() { return tokenSelection != null ? tokenSelection.toBuilder() : null; } public final void setTokenSelection(OpenIdConnectTokenSelectionItem.BuilderImpl tokenSelection) { this.tokenSelection = tokenSelection != null ? tokenSelection.build() : null; } @Override public final Builder tokenSelection(OpenIdConnectTokenSelectionItem tokenSelection) { this.tokenSelection = tokenSelection; return this; } @Override public OpenIdConnectConfigurationItem build() { return new OpenIdConnectConfigurationItem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy