"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.UserPoolIdentityProviderOidc=exports.OidcAttributeRequestMethod=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var user_pool_idp_base_1=()=>{var tmp=require("./private/user-pool-idp-base");return user_pool_idp_base_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},cognito_generated_1=()=>{var tmp=require("../cognito.generated");return cognito_generated_1=()=>tmp,tmp},OidcAttributeRequestMethod;(function(OidcAttributeRequestMethod2){OidcAttributeRequestMethod2.GET="GET",OidcAttributeRequestMethod2.POST="POST"})(OidcAttributeRequestMethod||(exports.OidcAttributeRequestMethod=OidcAttributeRequestMethod={}));class UserPoolIdentityProviderOidc extends user_pool_idp_base_1().UserPoolIdentityProviderBase{constructor(scope,id,props){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_cognito_UserPoolIdentityProviderOidcProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,UserPoolIdentityProviderOidc),error}const scopes=props.scopes??["openid"],resource=new(cognito_generated_1()).CfnUserPoolIdentityProvider(this,"Resource",{userPoolId:props.userPool.userPoolId,providerName:this.getProviderName(props.name),providerType:"OIDC",providerDetails:{client_id:props.clientId,client_secret:props.clientSecret,authorize_scopes:scopes.join(" "),attributes_request_method:props.attributeRequestMethod??OidcAttributeRequestMethod.GET,oidc_issuer:props.issuerUrl,authorize_url:props.endpoints?.authorization,token_url:props.endpoints?.token,attributes_url:props.endpoints?.userInfo,jwks_uri:props.endpoints?.jwksUri},idpIdentifiers:props.identifiers,attributeMapping:super.configureAttributeMapping()});this.providerName=super.getResourceNameAttribute(resource.ref)}getProviderName(name){if(name){if(!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)`);if(!name.match(/^[^_\p{Z}][\p{L}\p{M}\p{S}\p{N}\p{P}][^_\p{Z}]+$/u))throw new Error(`Expected provider name must match [^_p{Z}][p{L}p{M}p{S}p{N}p{P}][^_p{Z}]+, received ${name}`);return name}const uniqueId=core_1().Names.uniqueId(this);return uniqueId.length<3?`${uniqueId}oidc`:uniqueId.length>32?uniqueId.substring(0,16)+uniqueId.substring(uniqueId.length-16):uniqueId}}exports.UserPoolIdentityProviderOidc=UserPoolIdentityProviderOidc,_a=JSII_RTTI_SYMBOL_1,UserPoolIdentityProviderOidc[_a]={fqn:"aws-cdk-lib.aws_cognito.UserPoolIdentityProviderOidc",version:"2.159.0"};
