How does one access user/authentication/principal context during the ApplyTokenResponseContext event, e.g. for adding a patient property to the outgoing json (https://hl7.org/fhir/smart-app-launch/app-launch.html#response-5)
options.AddEventHandler<ApplyTokenResponseContext>( builder =>
{
builder.UseInlineHandler( context =>
{
//how to get some context about the principal?
context.Response.AddParameter( "patient", "16366164565" );
return default;
} );
} );
It turns out that using an event for this is not even needed. In the token endpoint, instead of doing this:
Create an authentication property to hold the custom value and pass the properties object to the
SignInmethod:The extra property is returned in the token response along with the usual token response, e.g.