/// <summary> /// Add custom attributes if not yet setup /// </summary> private async Task InitializeCustomAttributes() { var userPoolRequest = new DescribeUserPoolRequest { UserPoolId = CognitoUserPoolId }; DescribeUserPoolResponse userPoolInfo = await Cognito.DescribeUserPoolAsync(userPoolRequest); var customAttributes = new List <SchemaAttributeType>(); var companyAttr = new SchemaAttributeType { AttributeDataType = AttributeDataType.String, Name = CompanyNameAttribute }; List <SchemaAttributeType> userPoolSchemaAttributes = userPoolInfo.UserPool.SchemaAttributes; if (userPoolSchemaAttributes.All(a => a.Name != companyAttr.Name)) { customAttributes.Add(companyAttr); } if (customAttributes.Count > 0) { _logger.LogInformation($"Adding custom Cognito Attributes {CompanyNameAttribute}"); await Cognito.AddCustomAttributesAsync( new AddCustomAttributesRequest { CustomAttributes = customAttributes, UserPoolId = CognitoUserPoolId }); } }
/// <summary> /// Add custom attributes if not yet setup /// </summary> private async Task InitializeCustomAttributes() { var userPoolRequest = new DescribeUserPoolRequest() { UserPoolId = CognitoUserPoolId }; var userPoolInfo = await Cognito.DescribeUserPoolAsync(userPoolRequest); List <SchemaAttributeType> customAttributes = new List <SchemaAttributeType>(); var companyAttr = new SchemaAttributeType() { AttributeDataType = AttributeDataType.String, Name = CompanyNameAttribute }; List <SchemaAttributeType> userPoolSchemaAttributes = userPoolInfo.UserPool.SchemaAttributes; if (userPoolSchemaAttributes.All(a => a.Name != companyAttr.Name)) { customAttributes.Add(companyAttr); } if (customAttributes.Count > 0) { await Cognito.AddCustomAttributesAsync( new AddCustomAttributesRequest() { CustomAttributes = customAttributes, UserPoolId = CognitoUserPoolId }); } }
public void DescribeUserPoolAsync(DescribeUserPoolRequest request, AmazonServiceCallback <DescribeUserPoolRequest, DescribeUserPoolResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }