Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure ad b2c Azure AD B2C OpenID Connect和SAML 2.0读取角色声明_Azure Ad B2c_Saml 2.0_Itfoxtec Identity Saml2 - Fatal编程技术网

Azure ad b2c Azure AD B2C OpenID Connect和SAML 2.0读取角色声明

Azure ad b2c Azure AD B2C OpenID Connect和SAML 2.0读取角色声明,azure-ad-b2c,saml-2.0,itfoxtec-identity-saml2,Azure Ad B2c,Saml 2.0,Itfoxtec Identity Saml2,使用SAML2.0在Azure AD B2C上使用自定义策略将AD FS配置为索赔提供程序。Azure AD B2C的依赖方正在使用OpenID Connect AD FS发出一个SAML2.0断言,包括角色声明。如果角色在两个单独的属性元素中返回: <saml:Attribute Name="http://test.com/claims/role"> <saml:AttributeValue>role1</saml:AttributeValue> <

使用SAML2.0在Azure AD B2C上使用自定义策略将AD FS配置为索赔提供程序。Azure AD B2C的依赖方正在使用OpenID Connect

AD FS发出一个SAML2.0断言,包括角色声明。如果角色在两个单独的属性元素中返回:

<saml:Attribute Name="http://test.com/claims/role">
  <saml:AttributeValue>role1</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="http://test.com/claims/role">
  <saml:AttributeValue>role2</saml:AttributeValue>
</saml:Attribute>

角色1
角色2
Azure AD B2C仅读取最后一个声明

否则,如果角色作为一个属性元素中的AttributeValue元素返回:

<saml:Attribute Name="http://test.com/claims/roles">
  <saml:AttributeValue>role1</saml:AttributeValue>
  <saml:AttributeValue>role2</saml:AttributeValue>
</saml:Attribute>

角色1
角色2
读取所有角色值

使用的Azure AD B2C角色索赔类型为:

<ClaimType Id="role">
  <DisplayName>Role</DisplayName>
  <DataType>string</DataType>
  <DefaultPartnerClaimTypes>
    <Protocol Name="OAuth2" PartnerClaimType="role" />
    <Protocol Name="OpenIdConnect" PartnerClaimType="role" />
    <Protocol Name="SAML2" PartnerClaimType="http://test.com/claims/role" />
  </DefaultPartnerClaimTypes>
  <UserHelpText/>
</ClaimType> 

<ClaimType Id="roles">
  <DisplayName>Roles</DisplayName>
  <DataType>stringCollection</DataType>
  <DefaultPartnerClaimTypes>
    <Protocol Name="OAuth2" PartnerClaimType="roles" />
    <Protocol Name="OpenIdConnect" PartnerClaimType="roles" />
    <Protocol Name="SAML2" PartnerClaimType="http://test.com/claims/roles" />
  </DefaultPartnerClaimTypes>
  <UserHelpText/>
</ClaimType> 

角色
一串
角色
stringCollection
SAML2.0既支持发送具有相同名称的多个属性,也支持发送具有AttributeValue列表的一个属性。
Azure AD B2C是否有办法读取具有相同名称的多个属性,而不仅仅是最后一个属性?

我通过在AD FS和Azure AD B2C之间添加自定义SAML 2.0代理解决了这个问题。SAML2.0代理是AD FS的依赖方(RP)和Azure AD B2C的身份提供商(IdP)。通过这种方式,可以转换声明,并使用Azure AD B2C支持的声明结构器发布nye SAML 2.0令牌

SAML2.0代理的RP和IdP部分都可以通过包实现