TrilonIO / aspnetcore-Vue-starter

*NEW* Asp.net Core & Vue.js (ES6) SPA Starter kit - Vuex, webpack, Web API, Docker, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.22k stars 266 forks source link

Proposal: JwtBearerAuthentication #52

Open elucidsoft opened 7 years ago

elucidsoft commented 7 years ago

I added this to my application using your template as a starter, it was very easy following the guidance at: https://fullstackmark.com/post/10/user-authentication-with-angular-and-asp-net-core

I think the template should include this, as everyone is going to need to some sort of client/server authentication in their app. Well nearly everyone...

MarkPieszak commented 7 years ago

Definitely it's on the agenda to have JWT default in both this and the angular repo. Glad you got it working! If it's easy enough to get a PR in for it it would be great for others using the template too! If you have the time. 🙏👍

keithn commented 7 years ago

this kind of seems like it needs something like a generator program like vue-cli, where you can opt in for things like authentication, unit testing, nightwatch, lint rules, css framework (like bulma / bs4 ) etc.

elucidsoft commented 7 years ago

We should perform this work on another branch, I have already started the work on this on a clone but it's going to be a rather large effort.

RIDusten commented 6 years ago

Is this something you have actively started work on? I am really looking for a quick spin up Vue solution template that includes authentication - not a one in sight except a built from the literal bottom up Vscode solution I found here: https://github.com/mrellipse/toucan

elucidsoft commented 6 years ago

I was but got side tracked on other open source projects. I also found out that Microsoft is working on adding a JwtBearer provider OOB to ASP.NET Core in the near future you should see that coming. In the meantime I have a working solution using Auth0 that I am using. The Auth0 implementation is quite easy and will take you only seconds. My plan is to use Auth0 until Microsoft ships the JwtBearer support OOB that way I am using something native.

Nordes commented 6 years ago

I used IdentityServer 4 and it took only a few minute to setup the authentication/etc. (Adding the package, setting up the configuration and then add the [authorize] tag where needed).

After I think that adding the full identity scaffolding within this template is maybe not necessary. Maybe if there were a few templates I wouldn't say no. Example of 3 templates: Light, With identity provider, With identity server.

Nordes commented 6 years ago

I have made a full example using OpenId. I guess with the JWT it would be pretty much the same code.

I use IdentityServer4 + Ldap authentication (custom module I made) + MvcVueClient using this demo + ui. I've added some security within it. Maybe it's not perfect but it works pretty well.

Github solution: https://github.com/Nordes/IdentityServer4.LdapExtension Project name within the solution: MvcVueClient

Info: If you type localhost:5006/profile it will redirect you to the OpenId service to login. However if you hit an API (/api) it will send you a 401 not authorized instead of trying to redirect you.

ty-fleming commented 6 years ago

I would love to see this template with Authorization and Authentication. This template hits all the check marks besides Authorization and Authentication

xShivan commented 5 years ago

How about using OpenIDDict? I used it in a few projects already and it works flawlessly. I think it would be a great addition to kick start any project using this template.