Does StringCollectionContainsClaim throws an exception if collection is empty?

Dervanil Junior 71 Reputation points
2020-12-01T16:35:54.687+00:00

I'm trying to check if the e-mail provided by the user is in the otherEmails claim, but if the user has no e-mail in the list, an error message appears and i can't find a way to translate it.

Transformation:

            <ClaimsTransformation Id="AssertEmailIsInOtherEmails" TransformationMethod="StringCollectionContainsClaim">
                <InputClaims>
                    <InputClaim ClaimTypeReferenceId="otherMails" TransformationClaimType="collection" />
                    <InputClaim ClaimTypeReferenceId="email" TransformationClaimType="item" />
                </InputClaims>
                <InputParameters>
                    <InputParameter Id="ignoreCase" DataType="string" Value="true"/>
                </InputParameters>
                <OutputClaims>
                    <OutputClaim ClaimTypeReferenceId="passwordResetEmailIsInOtherEmails" TransformationClaimType="outputClaim"/>
                </OutputClaims>
            </ClaimsTransformation>

This is the message: "Unable to validate the information provided."

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,656 questions
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,311 Reputation points
    2020-12-02T14:18:23.34+00:00

    Hi @DervanilJunior-4636 · Welcome to Q&A platform and thanks for your query.

    The problem with empty string collection is, we cannot infer an empty list to be of type string collection. It could be of some other type as well. There is a bug already open with product team for this issue. However, there is no ETA for a fix as of now.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


1 additional answer

Sort by: Most helpful
  1. Dervanil Junior 71 Reputation points
    2020-12-03T10:59:35.36+00:00

    Hi, it works this way, using this two policies the correct message is shown.

                <ClaimsTransformation Id="CheckIfOtherMailsPresent" TransformationMethod="DoesClaimExist">
                    <InputClaims>
                        <InputClaim ClaimTypeReferenceId="otherMails" TransformationClaimType="inputClaim" />
                    </InputClaims>
                    <OutputClaims>
                        <OutputClaim ClaimTypeReferenceId="isOtherMailsPresent" TransformationClaimType="outputClaim" />
                    </OutputClaims>
                </ClaimsTransformation>
    
                <ClaimsTransformation Id="AssertIsOtherMailsPresentIsTrue" TransformationMethod="AssertBooleanClaimIsEqualToValue">
                    <InputClaims>
                        <InputClaim ClaimTypeReferenceId="isOtherMailsPresent" TransformationClaimType="inputClaim" />
                    </InputClaims>
                    <InputParameters>
                        <InputParameter Id="valueToCompareTo" DataType="boolean" Value="true" />
                    </InputParameters>
                </ClaimsTransformation>
    

    Thank you.

    1 person found this answer helpful.
    0 comments No comments