Giter Club home page Giter Club logo

fastapi-keycloak-angular's Introduction

FastAPI-Keycloak-Angular

(this project is not really being used any more, but check out this project instead https://github.com/andreaskring/bootstrap-keycloak-fastapi-postgres)

A small sandbox application that demonstrates Keycloak authentication for a backend written in Python using FastAPI and a frontend in Angular. This application uses this project https://github.com/mauriciovigolo/keycloak-angular to handle the Angular part of the Keycloak communication.

Prerequisites

  • Docker and Docker Compose
  • ... and Python and Angular CLI to develop stuff further.

Running the app

Keycloak likes to speak SSL, so this sandbox application uses self-signed SSL certificates signed for the domain proxy. Unfortunately, we have to use a name different from localhost due to the Docker setup, since localhost within a Docker container refers to the container itself. So in order to have the different Docker containers communicate properly, we have to use something other than localhost.

To run the stack (Keycloak with a preconfigured realm, FastAPI and Angular), do the following:

  1. Add the hostname proxy to your /etc/hosts file, i.e. ensure that this file has a line similar to e.g.
    127.0.0.1    localhost proxy
    
  2. Start the application from the root folder of this project with
    $ docker-compose up -d --build
    
    and give the stack a few moments to fire up. You can follow the logs with
    $ docker-compose -f logs
    
  3. Open a browser and navigate to https://proxy/something-cool. The browser will throw some warnings due to the self-signed certificate, but you can safely accept these.

Disclaimer

This app is not production ready in its current state (e.g. certificate verification has been disabled in the Python backend, users with trivial passwords have been pre-configured, there is no test suite, allowed origins are set way too broad,...).

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.