Coder Social home page Coder Social logo

seidakhmet / fastapi-keycloak-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kumaf/fastapi-keycloak-boilerplate

0.0 0.0 0.0 20 KB

Fastapi boilerplate for API with user management and authentication using Keycloak

Dockerfile 1.39% Python 98.48% Shell 0.13%

fastapi-keycloak-boilerplate's Introduction

Fastapi Keycloak Boilerplate

Dependencies

  • Keycloak
  • MongoDB

Fixes in keycloak

In Admin console

  1. Realm -> Client Scopes -> "roles" -> edit

  2. Mappers -> Create

  3. Add client_id to Audience

    Add to ID Token: on
    Add to access token: on
    Add to userinfo: off
    

Test in development environment

  • Setup a virtual environment and install dependencies

    sudo apt install python3.8
    
    python3 -m pip install --user virtualenv
    
    virtualenv venv -p python3.8
    
    source venv/bin/activate
    
    pip install -r requirements.txt
    
  • Dependencies

    • Keycloak

      docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=password -d quay.io/keycloak/keycloak:11.0.3
      
    • MongoDB

      docker run --name mongo -d -p 27017:27017 -v $HOME/mongodb/data:/data/db mongo
      
  • Start the server

    uvicorn app.main:app --reload
    

Deploy into production

  • Make sure keycloak is connected to a mysql db
  • Refer to the given k8 configs to get to know how to deploy MySQL & Mongo persistant volumes with persistant volume claims

fastapi-keycloak-boilerplate's People

Contributors

kumaf 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.