Hi.
For securing requests from b2c policies to AF the "Secure code approach" is used.
(https://{AF endpoint}?code={secure code})
In this case AF has open API but could not be accessed without knowing this code.
I am trying to find similar approach for REST API:
<TechnicalProfile Id="REST-API">
<DisplayName>REST-API</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">Url</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="AuthenticationType">ApiKeyHeader</Item>
</Metadata>
<CryptographicKeys>
<Key Id="x-functions-key" StorageReferenceId="B2C_1A_RestApiKey" /> (or x-api-key header)
</CryptographicKeys>
Is it possible to:
- Get x-functions-key or x-api-key from headers on Back-End side and get the code configured in Policy Keys using smth like:
if (!Request.Headers.TryGetValue("x-functions-key", out var extractedApiKey))
{
...
}
- Sending custom claims in body but B2C_1A_RestApiKey in header?
- If it doesn't work is this any working approach to send custom code from policy and read it on the Back-End side?
Thanks.