Active Directory SecurityClaims

Hi folks,

I have recently started looking into Radzen and within the trial period I've been creating an Application that uses Active Directory for login quite quickly. Good Job on this!

However, I have also extended the application on my own following the AuditTrail example on https://github.com/akorchev/radzen/tree/master/AuditTrail
First of all, due to the Active Directory setup, it looks like I am not able to manually add SecurityClaims to the users? At least I haven't found an example on how to do so with AD login. Preferably, I would like to rewrite the LoginComponent to no require the weird Email format.

More Concerning for me is that I am not able to access the SecurityClaims (more precisely the httpContextAccessor is null) when running through a Release package on IIS. I would assume this to be a bug as it works perfectly fine when running from Radzen on my local machine.
Is this already known or am I doing something wrong?

Thanks for your support

it looks like I am not able to manually add SecurityClaims to the users?

We are not 100% sure how this can be done. I found this article online which may be of help: Adding extra claims in ASP.NET Core web applications | by Sergiy Korzh | Level Up Coding

You can extend Startup.cs like this.

more precisely the httpContextAccessor is null

We have found that relying on HttpContextAccessor in a Blazor application isn't reliable. This is why we use the Blazor specific AuthenticationStateProvider

Thank you for the very fast response.
Can you tell me how to access the AuthenticationStateProvider and also the User through extending Startup.cs?

And also: do you have an idea why accessing httpcontext in Radzen debug works fine while not through IIS? Could this also be related to how the Release config is build?

AuthenticationStateProvider is a Blazor service. You inject it your classes as anything else.

Unfortunately I don't know why httpcontext isn't always available in Blazor (this isn't specific to Radzen).