如何在ADB2C中使用用户名读取用户?

huangapple go评论60阅读模式
英文:

How to read users using username in ADB2C?

问题

我如何使用用户名定义具有操作“读取”的技术配置文件?我尝试将输入类型设置为“signInNames.userName”、“signInNames.username”,但ADB2C页面直接抛出异常错误,没有ADB2C代码。

这是我定义的signInNames.userName声明类型。这应该受到责备吗?

<ClaimType Id="signInNames.userName">
    <DisplayName>登录名</DisplayName>
    <DataType>string</DataType>
    <UserHelpText/>
    <UserInputType>TextBox</UserInputType>
</ClaimType>

<TechnicalProfile Id="AAD-UserReadUsingUsername">
    <Metadata>
        <Item Key="Operation">Read</Item>
        <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
    </Metadata>
    <IncludeInSso>false</IncludeInSso>
    <InputClaims>
        <InputClaim ClaimTypeReferenceId="signInNames.userName" Required="true" />
    </InputClaims>
    <OutputClaims>
        <!-- 可选声明 -->
        <!-- <OutputClaim ClaimTypeReferenceId="signInNames.userName" /> -->
        <OutputClaim ClaimTypeReferenceId="objectId" />
        <OutputClaim ClaimTypeReferenceId="displayName" />
        <OutputClaim ClaimTypeReferenceId="otherMails" />
        <OutputClaim ClaimTypeReferenceId="givenName" />
        <OutputClaim ClaimTypeReferenceId="surname" />
    </OutputClaims>
    <IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>
英文:

How do I define a technical profile with operation "read" using username? I tried input type as "signInNames.userName", "signInNames.username" - but the adb2c page directly throwns an exception error without a ADB2C code.

This is how I defined the signInNames.userName claimtype. Is this to be blamed?

       &lt;ClaimType Id=&quot;signInNames.userName&quot;&gt;
        &lt;DisplayName&gt;Sign in name&lt;/DisplayName&gt;
        &lt;DataType&gt;string&lt;/DataType&gt;
        &lt;UserHelpText/&gt;
        &lt;UserInputType&gt;TextBox&lt;/UserInputType&gt;
      &lt;/ClaimType&gt;
        &lt;TechnicalProfile Id=&quot;AAD-UserReadUsingUsername&quot;&gt;
          &lt;Metadata&gt;
            &lt;Item Key=&quot;Operation&quot;&gt;Read&lt;/Item&gt;
            &lt;Item Key=&quot;RaiseErrorIfClaimsPrincipalDoesNotExist&quot;&gt;true&lt;/Item&gt;
          &lt;/Metadata&gt;
          &lt;IncludeInSso&gt;false&lt;/IncludeInSso&gt;
          &lt;InputClaims&gt;
            &lt;InputClaim ClaimTypeReferenceId=&quot;signInNames.userName&quot; Required=&quot;true&quot; /&gt;
          &lt;/InputClaims&gt;
          &lt;OutputClaims&gt;

            &lt;!-- Optional claims --&gt;
            &lt;!-- &lt;OutputClaim ClaimTypeReferenceId=&quot;signInNames.userName&quot; /&gt; --&gt;
            &lt;OutputClaim ClaimTypeReferenceId=&quot;objectId&quot; /&gt;
            &lt;OutputClaim ClaimTypeReferenceId=&quot;displayName&quot; /&gt;
            &lt;OutputClaim ClaimTypeReferenceId=&quot;otherMails&quot; /&gt;
            &lt;OutputClaim ClaimTypeReferenceId=&quot;givenName&quot; /&gt;
            &lt;OutputClaim ClaimTypeReferenceId=&quot;surname&quot; /&gt;
          &lt;/OutputClaims&gt;
          &lt;IncludeTechnicalProfile ReferenceId=&quot;AAD-Common&quot; /&gt;
        &lt;/TechnicalProfile&gt;

答案1

得分: 0

请看这个示例

收藏中还有其他与用户名相关的内容。

英文:

Have a look at this sample.

There are also others in the collection to do with username.

huangapple
  • 本文由 发表于 2023年5月22日 23:06:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76307547.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定