bruno-garcia / Bazinga.AspNetCore.Authentication.Basic

Basic Authentication for Microsoft ASP.NET Core Authentication
MIT License
48 stars 13 forks source link

How can I add my own claim types? #5

Closed lira92 closed 6 years ago

lira92 commented 6 years ago

I need to add some claim types in identity after the user has been authenticated. Can I do this?

bruno-garcia commented 6 years ago

The library calls into Events with the newly created ClaimsPrincipal.

That's the hook for the application to modify it or even reject the user by calling AuthenticationSucceededContext.Fail during CredentialsValidated.

You can modify the Principal property with a new instance if needed.

lira92 commented 6 years ago

thanks for your help @bruno-garcia, it worked to me. Do you think that is interesting to include an example to implement this in your readme? I can provide a PR for this.

bruno-garcia commented 6 years ago

Sure! That'd be great, thank you.

bruno-garcia commented 6 years ago

Done #6