Code Monkey home page Code Monkey logo

oidc-python-flask's Introduction

oidc-python-flask

OpenID Connect Client implementation using Python and Flask

This project is meant to provide a starting point for building a website using python and flask that is secured using OpenID Connect. Functionality is initially limited to a home page that displays login, logout, and profile links. The profile page will display the currently authenticated user's userinfo extracted from their id_token.

Requirements

Depending on your Operating System and envirinment you may need to install these tools yourself. Google is your friend.

Note: For Windows WSL see this article

Dependencies

Note: Most of the OIDC functionality in this project is provided by AuthLib.

Getting Started

If you are using vscode and have the python extension you should see a Create Environment... button if you click on the requirements.txt file. See Creating Environments for additional help. This method requires venv.

If you are using a different editor or prefer to do things in a shell you can use the following resources:

Configuration

All configuration for this project is done using a .env file. You can start by renaming the file .example.env to .env and then providing the missing values described below. The values that start with OIDC_ must be acquired from your OpenID Connect provider.

Variable Description
SECRET_KEY Signing key for authenticating session cookie. Set to a strong random value.
OIDC_SERVER_METADATA_URL The OpenID Connect Discovery url for your OIDC Provider.
OIDC_CLIENT_ID The Oauth2 Client ID from your client.
OIDC_CLIENT_SECRET The Oauth2 Client Secret from your client.
OIDC_API_BASE_URL This is set to http://localhost:3000 by default, but it MUST match the value defined for your client in your OIDC Provider settings.
OIDC_CLIENT_KWARGS The defaults should work as is for most OIDC Providers. If not you will have to work through the issue with your provider.

Other configuration values may be needed depending on your OpenID Provider. See the AuthLib documentation for help with other options.

Development

Once you have finished updating your configuration you can run your website locally by executing flask run in your terminal shell.

oidc-python-flask's People

Contributors

heathprovost avatar

Watchers

 avatar  avatar

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.