dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.55k stars 25.3k forks source link

Container issue: Authentication and authorization for SPAs #16406

Open Rick-Anderson opened 4 years ago

Rick-Anderson commented 4 years ago

23K PV

This is the Container issue for this doc. Reopen each issue you are working on so the owner is notified.

PU issue

Not PU:

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pyrobolser commented 4 years ago

About the deployment to Linux App Services. Right now the following workaround seems to be working for me:

Please note that this is just a workaround but it is not a recommended solution. Your certificate shouldn't be hanging out with your files like this for security reasons, don't forget to exclude your certificate from source control.

baselbj commented 4 years ago

For the point " Alternatives for non-SPA login/signup pages"

In identity server documentation talking about those template,and I quote: "You are expected to know how ASP.NET Identity works sufficiently well to add those features to your project"

So,

"you can create a new project based on the Visual Studio ASP.NET Identity template and add the IdentityServer features you have learned about in these quickstarts to that project"

http://docs.identityserver.io/en/latest/quickstarts/6_aspnet_identity.html#what-s-missing

I think this documentation should show the 2 ways, SPA with ASP.NET Identity and SPA security without ASP.NET Identity.

inlokesh commented 4 years ago

@Rick-Anderson how can I use the code generated here in the react-redux project template

vietman00 commented 4 years ago

I started with the Asp.net Core 3.1 with Angular and Individual User Accounts Template in VS 2019.. [Authorize] currently works but not [Authorize(Roles="Admin")] even though I gave my user that role.. When I inspect the User.Identity on a webapi controller method with just [Authorize] I do not see the email address, username or any roles.. I can only see that they are authenticated.. Please help! I just want to be able to specify Roles and have them respected in the Authorize attribute of controllers and their methods..

gilmishal commented 4 years ago

I have created an app with IdentityServer4 before, and although it is a bit more burdensome than AddApiAuthorization it is much better documented and I feel that it creates an abstraction that is very hard to figure out.

Configuring clients with appsettings.json uses a totally different syntax than the official IdentityServer docs - and the existing syntax isn't well documented. I understand that there are different profiles (why?), but I have no idea what client secret to use, I am not sure how to configure one and I have to dig deep into the code to figure it out. I might as well just give up and configure IdentityServer the regular way - which isn't necessarily better or easier, just a lot more predictable since it is better documented.

I would suggest either documenting this entire library (Microsoft.AspNetCore.ApiAuthorization.IdentityServer) better or making it's configuration more similar to the IdentityServer4 official configuration.

dathoang commented 4 years ago

Need more specific documents about Identity Server config: