我有一个技术资料,可以从AD令牌端点检索客户端证书流访问令牌。
我能够将响应access_token分配给Claim并通过输出Claim传递到UI(一旦加载,我将隐藏该元素并将tpe元素更改为hidden),JS会使用它来在注册时进行某些api调用页。
一切正常。在其余api的技术资料中,我直接在Claim的默认值中使用了客户端ID和客户端密码。
是否可以从密钥存储(即加密密钥)中获取机密并分配所有权?
以下是rest api的技术资料,
<TechnicalProfile Id="TokenAPI">
<DisplayName>Rest API call</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">https://login.microsoftonline.com/tenant.onmicrosoft.com/oauth2/v2.0/token</Item>
<Item Key="AuthenticationType">None</Item>
<Item Key="SendClaimsIn">Form</Item>
<Item Key="HttpBinding">POST</Item>
<Item Key="AllowInsecureAuthInProduction">true</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="client_id" PartnerClaimType="client_id" DefaultValue="abd2c507-xxxx-xxxx-xxxx-xxxx"/>
<InputClaim ClaimTypeReferenceId="client_secret" PartnerClaimType="client_secret" DefaultValue="LXz2L5xxxxxxxxxxxxxxxxxxxxxxxx"/>
<InputClaim ClaimTypeReferenceId="grant_type" PartnerClaimType="grant_type" DefaultValue="client_credentials"/>
<InputClaim ClaimTypeReferenceId="scope" PartnerClaimType="scope" DefaultValue="https://TitanB2CTest.onmicrosoft.com/507-xxxx-xxxx-xxxx-xxxx/.default"/>
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="access_token" PartnerClaimType="access_token"/>
</OutputClaims>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
</TechnicalProfile>
答案 0 :(得分:1)
对于 TokenAPI 技术资料,您可以将 AuthenticationType 设置为Basic
,然后添加the <CryptographicKeys />
element,以使客户端标识符和密码为在Authorization: Basic xxx
标头中发送到令牌端点:
<TechnicalProfile Id="TokenAPI">
<DisplayName>Rest API call</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">https://login.microsoftonline.com/tenant.onmicrosoft.com/oauth2/v2.0/token</Item>
<Item Key="AuthenticationType">Basic</Item>
<Item Key="SendClaimsIn">Form</Item>
</Metadata>
<CryptographicKeys>
<Key Id="BasicAuthenticationUsername" StorageReferenceId="B2C_1A_MyClientId" />
<Key Id="BasicAuthenticationPassword" StorageReferenceId="B2C_1A_MyClientSecret" />
</CryptographicKeys>
...
</TechnicalProfile>