Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rolling out a web authentication system

I'm building a site that requires user authentication and authorization. My initial idea was to write the application using the Flask framework. However, I learned that Flask doesn't have a built in authentication system. It does have an extension flask-login, but I haven't gotten any confirmation as to whether this extension is well-written. I've read that it's very easy to get authentication wrong.

  1. Might it be a good idea to switch to something like Django or web2py, which do have built in authentication systems?

  2. Do good web programmers typically choose to use tried and true authentication systems as opposed to trying to roll out their own?

  3. Is there a good guide that demonstrates best practices with respect building an authentication/authorization system?

Thanks guys!

like image 742
Michael Avatar asked Apr 10 '12 20:04

Michael


People also ask

Should I roll my own authentication?

Identity-as-a-Service The good news is that you don't need to roll your own user management and authentication logic. It's 2020, and we have plenty of valid Identity-as-a-Service solutions that make it extremely easy to add identities to your application, safely.

What are the three 3 main types of authentication techniques?

There are three basic types of authentication. The first is knowledge-based — something like a password or PIN code that only the identified user would know. The second is property-based, meaning the user possesses an access card, key, key fob or authorized device unique to them. The third is biologically based.


1 Answers

If you want to add user login capability to your website (that is, authentication and authorization) use an existing framework. Unless you're an expert in security, the probability of writing secure a system is close to 0. This applies regardless of the language you program in and regardless of the framework you are using.

Unfortunately, I have seen people answer this question as follows: "This is not that hard, and fun to code, as a beginner. You need a place to store your data (let's say a mysql database). You should store ENCRYPTED versions of the passwords, etc. etc." This answer is COMPLETELY INCORRECT.

There are free authentication frameworks available, USE THEM. For example, Django and web2py have built-in authentication systems. Many frameworks do not come with built-in authentication (e.g. Flask, webpy); this does not mean you should roll out your own framework. It just means you should find 3rd party authentication software. For Flask, there is Flask-login.

So, the answer to my original questions are:

1.) Yes, or integrate a verified 3rd-party software system.

2.) Yes, the best practices says DO NOT WRITE YOUR OWN AUTHENTICATION SYSTEM. Use one that's already been built.

3.) You shouldn't need a guide to building an authentication system, because you shouldn't be building one. However, OWASP is a great security resource.

Here's a brief summary: Do not write your own authentication system. Use a pre-built authentication system that is trusted. If anyone has any recommendations for authentication systems that can be used with Python, feel free to post them.

like image 79
Michael Avatar answered Sep 20 '22 17:09

Michael