Встроенный входящий поток пользователей возвращает «Ваш пароль неверный». Работают ли встроенные политики с пользовательскими политиками регистрации? - PullRequest
0 голосов
/ 24 февраля 2020

Я установил Azure AD B2 C приложение и создал необходимые приложения IdentityFramworks, которые перечислены здесь При входе в систему с использованием встроенного пользовательского потока я получаю сообщение «Ваш пароль неверный» но это 100% правильный пароль. Я создал пользовательскую политику регистрации с использованием стартового пакета. Шаг 1:

<TechnicalProfile Id="LocalAccountSignUpWithLogonName">
<DisplayName>User ID signup</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
    <Item Key="UserMessageIfClaimsTransformationStringsAreNotEqual">That Username is already taken, please chose another one.</Item>
    <Item Key="UserMessageIfClaimsTransformationBooleanValueIsNotEqual">The Access Number or Email are incorrect.</Item>
    <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
    <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
    <Item Key="LocalAccountType">Username</Item>
    <Item Key="LocalAccountProfile">true</Item>
    <Item Key="language.button_continue">Continue</Item>
</Metadata>
<CryptographicKeys>
    <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
</CryptographicKeys>
<InputClaims>
    <InputClaim ClaimTypeReferenceId="signInName" />

</InputClaims>
<OutputClaims>
    <OutputClaim ClaimTypeReferenceId="extension_accessNumber" Required="true" />
    <OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
    <OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
    <OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
    <OutputClaim ClaimTypeReferenceId="email" Required="true" />
    <OutputClaim ClaimTypeReferenceId="givenName" Required="true" />
    <OutputClaim ClaimTypeReferenceId="surname" Required="true" />
    <OutputClaim ClaimTypeReferenceId="extension_gender" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_dateOfBirth" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_error" PartnerClaimType="extension_error" />
    <OutputClaim ClaimTypeReferenceId="extension_message"  PartnerClaimType="extension_message"/>

    <OutputClaim ClaimTypeReferenceId="objectId" Required="true" />
    <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
    <OutputClaim ClaimTypeReferenceId="newUser" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />

</OutputClaims>
<ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="UsernameCheck"/>
    <ValidationTechnicalProfile ReferenceId="API-VerifyStep1"/>
</ValidationTechnicalProfiles>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />

Шаг 2:

<TechnicalProfile Id="LocalAccountSignUpWithLogonNameStep2">
<DisplayName>User ID signup</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
    <Item Key="IpAddressClaimReferenceId">IpAddress</Item>
    <Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
    <Item Key="LocalAccountType">Username</Item>
    <Item Key="LocalAccountProfile">true</Item>
    <Item Key="language.button_continue">Create</Item>
</Metadata>
<CryptographicKeys>
    <Key Id="issuer_secret" StorageReferenceId="B2C_1A_TokenSigningKeyContainer" />
</CryptographicKeys>
<InputClaims>
    <InputClaim ClaimTypeReferenceId="signInName" />

</InputClaims>
<OutputClaims>

    <OutputClaim ClaimTypeReferenceId="extension_city" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_address" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_province" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_postalCode" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_psc" Required="false"/>
    <OutputClaim ClaimTypeReferenceId="extension_rsc" Required="false"/>
    <OutputClaim ClaimTypeReferenceId="extension_altContact" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_altRelation" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_altConPhone" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_sciLevel" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_dateOfOnset" Required="true"/>
    <OutputClaim ClaimTypeReferenceId="extension_termsOfUse" Required="true"/>


    <OutputClaim ClaimTypeReferenceId="objectId" Required="true" />
    <OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
    <OutputClaim ClaimTypeReferenceId="newUser" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />

</OutputClaims>
<ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="signup-NonInteractive" />
    <ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonName" />
</ValidationTechnicalProfiles>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />

Кажется, что учетная запись найдена, но пароль неверный, и я не уверен почему? Являются ли встроенные политики несовместимыми, если у вас есть настраиваемые политики?

Я также создал настраиваемую политику входа, но это приводит к ужасному форматированию при загрузке страницы и регистрирует поле имени пользователя как тип ввода = " text "id =" password "name =" Password "placeholder =" Имя пользователя "value =" "tabindex =" 1 "Это очень запутанно.

Это политика входа в систему

<TechnicalProfile Id="SelfAsserted-LocalAccountSignin-Username">
<DisplayName>Local Account Signin</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
    <Item Key="SignUpTarget">SignUpWithLogonUsernameExchange</Item>
    <Item Key="setting.operatingMode">Username</Item>
    <Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
    <Item Key="setting.showSignupLink">False</Item>
</Metadata>
<IncludeInSso>false</IncludeInSso>
<InputClaims>
    <InputClaim ClaimTypeReferenceId="signInName" />
</InputClaims>
<OutputClaims>

    <OutputClaim ClaimTypeReferenceId="signInName" Required="true" />
    <OutputClaim ClaimTypeReferenceId="password" Required="true" />
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" />
</OutputClaims>
<ValidationTechnicalProfiles>
    <ValidationTechnicalProfile ReferenceId="login-NonInteractive" />
</ValidationTechnicalProfiles>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />

А вот логин - неинтерактивный профиль

<TechnicalProfile Id="login-NonInteractive">
      <DisplayName>Local Account SignIn</DisplayName>
      <Protocol Name="OpenIdConnect" />
      <Metadata>
      <Item Key="client_id">530a3472-...</Item>
        <Item Key="IdTokenAudience">f134083a-...</Item>
        <Item Key="UserMessageIfClaimsPrincipalDoesNotExist">We can't seem to find your account</Item>
        <Item Key="UserMessageIfInvalidPassword">Your password is incorrect</Item>
        <Item Key="UserMessageIfOldPasswordUsed">Looks like you used an old password</Item>

        <Item Key="ProviderName">https://sts.windows.net/</Item>
        <Item Key="METADATA">https://login.microsoftonline.com/{tenant}/.well-known/openid-configuration</Item>
        <Item Key="authorization_endpoint">https://login.microsoftonline.com/{tenant}/oauth2/token</Item>
        <Item Key="response_types">id_token</Item>
        <Item Key="response_mode">query</Item>
        <Item Key="scope">username openid</Item>

        <!-- Policy Engine Clients -->
        <Item Key="UsePolicyInRedirectUri">false</Item>
        <Item Key="HttpBinding">POST</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="client_id" DefaultValue="530a3472-..." />
        <InputClaim ClaimTypeReferenceId="resource_id" PartnerClaimType="resource" DefaultValue="f134083a-..." />
        <InputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="username" Required="true" DefaultValue="{OIDC:Username}" />
        <InputClaim ClaimTypeReferenceId="password" Required="true" DefaultValue="{OIDC:Password}"/>
        <InputClaim ClaimTypeReferenceId="grant_type" DefaultValue="password" />
        <InputClaim ClaimTypeReferenceId="scope" DefaultValue="openid" />
        <InputClaim ClaimTypeReferenceId="nca" PartnerClaimType="nca" DefaultValue="1" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="signInName" PartnerClaimType="username" Required="true" />
        <OutputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="oid" />
        <OutputClaim ClaimTypeReferenceId="tenantId" PartnerClaimType="tid" />
        <OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="given_name" />
        <OutputClaim ClaimTypeReferenceId="surName" PartnerClaimType="family_name" />
        <OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
        <OutputClaim ClaimTypeReferenceId="userPrincipalName" PartnerClaimType="upn" />
        <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
      </OutputClaims>
    </TechnicalProfile>

Я знаю, что это сообщение длинное, и я благодарен за любой вклад или помощь. Заранее спасибо

1 Ответ

0 голосов
/ 24 февраля 2020

Если посмотреть на вашу пользовательскую политику, регистрация, где вы собираете пароль на шаге, отличном от написания пользователя, приведет к отключению учетной записи. И затем вызывает ошибку, которую вы видите при входе в систему.

...