GithubHelp home page GithubHelp logo

cornflourblue / aspnet-core-3-registration-login-api Goto Github PK

View Code? Open in Web Editor NEW
237.0 15.0 119.0 19 KB

ASP.NET Core 3.1 API for User Management, Authentication and Registration

Home Page: https://jasonwatmore.com/post/2019/10/14/aspnet-core-3-simple-api-for-authentication-registration-and-user-management

License: MIT License

C# 100.00%
aspnetcore dotnetcore aspnetcore3

aspnet-core-3-registration-login-api's Introduction

aspnet-core-3-registration-login-api's People

Contributors

cornflourblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aspnet-core-3-registration-login-api's Issues

A question about a better place for storing the salt?

Hi, I've been reading your blogs about asp API + SPA client for quite sometime since I needed a simple solution for having local accounts with a combination of an api. I don't want to use IdentityServer, no matter whether it is AzureADB2C, self hosted identity server that comes along with asp core or something like Auth. So I was just going through your git repos and I saw you updated thing for 2.2 and 3.0 and I started looking at the code(might be a work in progess, since you don't yet have a post about this one) and I couldn't figure something out. I'm a bit inexperienced in the field of Cryptography but I have a 5 years of experience as a web dev with asp(before core).

  1. I saw that you definitely need some kind of a app secret for signing the JWT token.
  2. I see that when it comes to generating the password hash as a salt you are using a randomly generated key by hmac (which later you need for a password verification).

using (var hmac = new System.Security.Cryptography.HMACSHA512())
{
passwordSalt = hmac.Key;
passwordHash = hmac.ComputeHash(System.Text.Encoding.UTF8.GetBytes(password));
}

Okay so the ideas are:

  1. Don't keep plain text pass
  2. You also need the salt to verify the pass hash. Every user has unique password salt generated on his registration.
  3. Now here's where I am having a big question mark over my head. Isn't it better to generate a new secret to use as salt for all users and keeping it away at AzureKeyVault for example(as I am doing now with my secrets). So in case you have a db breach of some kind and your data is exposed in the current scenario if they know which hashing algorithm you are using + the salt saved in the db and there you have the users passwords as plain text. As opposed to my idea where you need to get the secret also, which is much harder this way.

I totally might be missing something fundamental or you might still be working on this of course, I would just like to understand what I am doing exactly since it's my first time doing a new project literally from scratch and I don't want to do stupid mistakes that might become a big pain in the ass for everyone :D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.