stavroskasidis / blazorwithidentity Goto Github PK
View Code? Open in Web Editor NEWA project template for a blazor hosted app using cookie based authentication with ef core identity.
License: MIT License
A project template for a blazor hosted app using cookie based authentication with ef core identity.
License: MIT License
Is that possible to update this example to the latest version of Blazor?
I have a Blazor WASM with a very similar sign in process. But all of a sudden on my local computer User.Identity.IsAuthenticated
returns false even right after the signIn returned Succeeded
. So I checked with your project and I have the same result here. Do you have any idea what causes that?
When I move models folder from server to shared project with proper references, I am not able to compile solution. Is this possible use shared project classes for Identity User and other entities.
An issue with this library (good as it is!) is that the Username
is only populated if the user logs in or registers using the API. The username isn't re-populated if the user is already logged in on returning.
However his royal Blazorness Steve Sanderson says that ClaimsPrincipal
will be made available in a later version (see dotnet/aspnetcore#4048)
After the call to SignInAsync
, you return Ok(BuildUserInfo())
which in turn uses the inhertied User
property from the ControllerBase
which is not updated to reflect the new user but still holds an unauthenticated user.
Luckily, IdentityAuthenticationStateProvider.GetAuthenticationStateAsync
retrieves an updated UserInfo
if the cached user info is unauthenticated but you end up with an extra trip to the back-end.
Great template! I set up Identity in no time.
What are the future plans for the project?
I could easily see this incorporating all the Identity scaffolding including 2FA.
First of all, thank you very much for the nice template. How could I extend the template to support role-based authentication? Could you provide an example or direct me?
Thank you
I was looking at your project and one test was seeing what devices were supported. I know that Blazor supports iOS devices but in my testing, iPod Touch, iPhone, iPad and iPad Air, none of them would load your site. I've tested other Blazor sites on iOS devices without issues. Is this a known issue that you've looked into?
Thank you for your time!
Bryan
I try to change the sqlite to sql server, but got error 500
Step i done :
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite("Filename=data.db"));
to services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(connString));
When i register, the input username & password is inserted to database, but it say error 500
I cant login
What's the best practice for adding simple CRUD to this? Is the dbContext reusable for storing data other than the auth related stuff, or should it be done entirely separately?
Does this approach work with Blazor Server? There are implementation differences.
One thing I don't understand... where is the login token actually being stored?
Do you feel this template does a good job protecting against XSS and CSRF?
Thanks for this nice sample!
I've noticed that the cookie inspection logic (Authorization_LoginCookieExists
) also reports true if the user is logged in at any other ASP.NET Core Identity site that uses cookie authentication because that other site would also set a cookie.
Would it be possible to instead simply try and get the user info right away as it's going to be needed anyway (and as suggested by #3)? Then, the IsLoggedIn
method becomes a simple this.userInfo != null
check and there would be no JS interopping. Would that make sense?
I tried this yesterday on Preview 3 and it worked when I registered a user.
Upgraded to the Preview 4 version today, and it isn't working. When I log in, the request is validated by the API. I can see the cookie returned in the API call response.
However, when the redirect to the root page takes place, the cookie isn't present, so the it does not appear to be logged in?
Will there be a similar implementation of authentication by Identity Server?
For completeness it would nice to add a password reset feature in the demo code
A Problem. Blazor Client Can't login. after I Create a account. in Chrome.
But OK in Microsoft Edge.
I really want to use this template but am curious how you deployed this to Azure. Do you have anything detailing how you deployed both web applications to work together? Did you have it use SQLlite in Azure?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.