"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserPoolIdentityProviderSaml=exports.UserPoolIdentityProviderSamlMetadata=exports.UserPoolIdentityProviderSamlMetadataType=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),core_1=require("../../../core"),cognito_generated_1=require("../cognito.generated"),user_pool_idp_base_1=require("./private/user-pool-idp-base");var UserPoolIdentityProviderSamlMetadataType;(function(UserPoolIdentityProviderSamlMetadataType2){UserPoolIdentityProviderSamlMetadataType2.URL="url",UserPoolIdentityProviderSamlMetadataType2.FILE="file"})(UserPoolIdentityProviderSamlMetadataType=exports.UserPoolIdentityProviderSamlMetadataType||(exports.UserPoolIdentityProviderSamlMetadataType={}));class UserPoolIdentityProviderSamlMetadata{constructor(metadataContent,metadataType){this.metadataContent=metadataContent,this.metadataType=metadataType}static url(url){return new UserPoolIdentityProviderSamlMetadata(url,UserPoolIdentityProviderSamlMetadataType.URL)}static file(fileContent){return new UserPoolIdentityProviderSamlMetadata(fileContent,UserPoolIdentityProviderSamlMetadataType.FILE)}}exports.UserPoolIdentityProviderSamlMetadata=UserPoolIdentityProviderSamlMetadata,_a=JSII_RTTI_SYMBOL_1,UserPoolIdentityProviderSamlMetadata[_a]={fqn:"aws-cdk-lib.aws_cognito.UserPoolIdentityProviderSamlMetadata",version:"2.46.0"};class UserPoolIdentityProviderSaml extends user_pool_idp_base_1.UserPoolIdentityProviderBase{constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings.aws_cdk_lib_aws_cognito_UserPoolIdentityProviderSamlProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,UserPoolIdentityProviderSaml),error}this.validateName(props.name);const{metadataType,metadataContent}=props.metadata,resource=new cognito_generated_1.CfnUserPoolIdentityProvider(this,"Resource",{userPoolId:props.userPool.userPoolId,providerName:this.getProviderName(props.name),providerType:"SAML",providerDetails:{IDPSignout:props.idpSignout??!1,MetadataURL:metadataType===UserPoolIdentityProviderSamlMetadataType.URL?metadataContent:void 0,MetadataFile:metadataType===UserPoolIdentityProviderSamlMetadataType.FILE?metadataContent:void 0},idpIdentifiers:props.identifiers,attributeMapping:super.configureAttributeMapping()});this.providerName=super.getResourceNameAttribute(resource.ref)}getProviderName(name){if(name)return this.validateName(name),name;const uniqueName=core_1.Names.uniqueResourceName(this,{maxLength:32});return uniqueName.length<3?`${uniqueName}saml`:uniqueName}validateName(name){if(name&&!core_1.Token.isUnresolved(name)&&(name.length<3||name.length>32))throw new Error(`Expected provider name to be between 3 and 32 characters, received ${name} (${name.length} characters)`)}}exports.UserPoolIdentityProviderSaml=UserPoolIdentityProviderSaml,_b=JSII_RTTI_SYMBOL_1,UserPoolIdentityProviderSaml[_b]={fqn:"aws-cdk-lib.aws_cognito.UserPoolIdentityProviderSaml",version:"2.46.0"};
//# sourceMappingURL=saml.js.map
