azure - 为 KeyCloak 配置 Azure 自定义策略

标签 azure keycloak azure-ad-b2c idp

我正在尝试使用 KeyCloak SSO 为 SignUp-SignIn 配置 Azure B2C 自定义策略

<ClaimsProvider>
  <Domain>mydomain.com</Domain>
  <DisplayName>SSO</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="SSO-KK-OpenID">
      <DisplayName>My SSO</DisplayName>
      <Protocol Name="OpenIdConnect" />
      <Metadata>
        <Item Key="ProviderName">https://mydomainurl.com</Item>
        <Item Key="METADATA">https://mydomainurl.com/auth/realms/myrealm/.well-known/openid-configuration</Item>
        <Item Key="response_types">code</Item>
        <Item Key="response_mode">form_post</Item>
        <Item Key="scope">openid</Item>
        <Item Key="HttpBinding">POST</Item>
        <Item Key="UsePolicyInRedirectUri">false</Item>
        <Item Key="client_id">myclientIdOnKeyCloak</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="domain_hint" DefaultValue="pippo" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="https://mydomainurl.com" />
        <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="socialIdpAuthentication" />
        <OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="email" />
        <OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="given_name" />
        <OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="family_name" />
        <OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
        <OutputClaim ClaimTypeReferenceId="email" PartnerClaimType="email" />
      </OutputClaims>
      <CryptographicKeys>
        <Key Id="client_secret" StorageReferenceId="B2C_1A_MYKKSecret" />
      </CryptographicKeys>
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>

我已将我的 secret 存储在策略 key 中,并将 key 用法作为签名。但是当我上传文件时出现此错误:

Validation failed: 1 validation error(s) found in policy "B2C_1A_TRUSTFRAMEWORKBASE" of tenant "mytenant.onmicrosoft.com".Schema validation error found at line 440 col 12 in policy "B2C_1A_TRUSTFRAMEWORKBASE" of tenant "mytenant.onmicrosoft.com": The element 'TechnicalProfile' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06' has invalid child element 'CryptographicKeys' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06'. List of possible elements expected: 'OutputClaimsTransformations, ValidationTechnicalProfiles, SubjectNamingInfo, Extensions, IncludeClaimsFromTechnicalProfile, IncludeTechnicalProfile, UseTechnicalProfileForSessionManagement, ErrorHandlers, EnabledForUserJourneys' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06'.Schema validation error found at line 440 col 12 in policy "B2C_1A_TRUSTFRAMEWORKBASE" of tenant "mytenant.onmicrosoft.com": The element 'TechnicalProfile' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06' has invalid child element 'CryptographicKeys' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06'. List of possible elements expected: 'OutputClaimsTransformations, ValidationTechnicalProfiles, SubjectNamingInfo, Extensions, IncludeClaimsFromTechnicalProfile, IncludeTechnicalProfile, UseTechnicalProfileForSessionManagement, ErrorHandlers, EnabledForUserJourneys' in namespace 'http://schemas.microsoft.com/online/cpim/schemas/2013/06'.

我按照 Ms Documentation 中的说明进行操作并复制Facebook的Cla​​imsProvider供引用

最佳答案

该错误表明节点的顺序是意外的。

在元数据和 inputclaims 节点之间移动加密 key 。

示例 https://learn.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-google?pivots=b2c-custom-policy#configure-google-as-an-identity-provider-1

关于azure - 为 KeyCloak 配置 Azure 自定义策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70202135/

相关文章:

Azure DevOps : how configure my pipeline script to trigger another pipeline with different repo?

azure - 无法访问 AKS 入口的公共(public) IP

spring-boot - 如何在管理控制台中阻止特定客户端的访问并撤销其颁发的 token

keycloak - 如何在 Keycloak 资源中添加 HTTP 方法以进行授权(无适配器)

azure-ad-b2c - 无法获取段落 InputType 以在 Azure B2C IEF 中显示任何文本

azure - 为什么 B2C 很奇怪并且位于单独的 Azure 目录/租户中?

ios - devops Pipelines 中的私有(private) Cocoapods 存储库

azure - 在 Azure 存储帐户表中存储 API key /密码

devops - Keycloak Realm VS Keycloak 客户端

azure - 如何配置 JwtBearerOptions 以在众所周知的 openid 配置 URL 中包含策略名称?