GithubHelp home page GithubHelp logo

erik1000 / dashboard Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 252 KB

An example app implementing the webauthn passwordless authentication flow. See https://webauthn.guide/

License: GNU General Public License v3.0

Python 58.61% Mako 0.98% HTML 16.24% JavaScript 24.18%
fido2 webauthn python passwordless login fastapi yubico yubikey hardware-authenticator

dashboard's Introduction

Webauhn example app

Hi!

This is an example app which implements webauthn passwordless login using the python-fido2 library by Yubico. It does only implement the authentication pages and two example pages for (not) authenticated users.

The name dashboard is just some simple name. It does not implement any dashboard like things.

Setup

The fido2 library does only accept "secure" connections from https. For local deployment you therefore need to create a self signed certificate. If openssl is installed, you can simply run the following command in the project root:

openssl req -x509 -out localhost.crt -keyout localhost.key \
 -newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

To install the project you need to have pipenv installed. If you have it installed, simply run pipenv install.

To run the server with the self signed certificates (make sure they are named localhost.key and localhost.crt), type pipenv run web_secure.

Note: Firefox somehow has a bug when a PIN is required for the security key. Firefox will not ask for the PIN and nothing will happen if you touch you key. You are welcome to open a bug report about this at the firefox bugtracker. This example is tested on Chrome (probably every chromium based browser) and Safari.

Don't forget to setup your .env file. Simply copy the env.example and put in your own data.

After that run pipenv run migrations to setup the tables etc.

Note

This "project" is for learning purposes. Developing with the fido2 library by Yubico is kind of hard, because they don't have docs (except a bit in the code). The fido2 library has some own example here (using flask instead of fastapi).

Contribute

If you found errors or flaws or anything else, open an issue or a pull request. I would be happy :)

To prepare you environment, run pipenv install --dev and pipenv run precommit. If you want to lint manually, run pipenv run lint.

dashboard's People

Contributors

dependabot[bot] avatar erik1000 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

sorokinvld

dashboard's Issues

User gesture required

Some browsers (like Safari) only allow calling navigator.credentials if it is triggered by a user gesture (like a click on a button).
Otherwise it will fail.

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.