Giter VIP home page Giter VIP logo

Comments (1)

gioargyr avatar gioargyr commented on May 23, 2024

I just managed to solve my problem.
The solution is in defining the right way api_base_url. From my initial definition openid-connect was missing from the url.
While digging deep in Flask-AppBuilder, I managed to find documentation about it. The only one who was mentioning it the right way: https://github.com/dpgaspar/Flask-AppBuilder/blob/master/docs/security.rst

As for the Helm values I override for Keycloak on Superset, is the following:
fyi: I only include here whatever is related to having Keycloak on Superset, no my whole values.yaml file
Also, I have no configuration about roles and users yet.

supersetNode:
    replicaCount: 1
    # Install libraries for supporting authorization through Keycloak
    command:
      - /bin/sh
      - -c
      - |
        pip install Flask-OAuthlib Authlib google-api-python-client
        . {{ .Values.configMountPath }}/superset_bootstrap.sh; /usr/bin/run-server.sh

supersetWorker:
    replicaCount: 1
    # Install libraries for supporting authorization through Keycloak
    command:
      - /bin/sh
      - -c
      - |
        pip install Flask-OAuthlib Authlib
        . {{ .Values.configMountPath }}/superset_bootstrap.sh; celery --app=superset.tasks.celery_app:app worker

configOverrides:

  enable-https: |
    ENABLE_PROXY_FIX = True
  enable_oauth: |
      from flask_appbuilder.security.manager import (AUTH_DB, AUTH_OAUTH)
      AUTH_TYPE = AUTH_OAUTH
      OAUTH_PROVIDERS = [
          {
              "name": "keycloak",
              "icon": "fa-google",
              "token_key": "access_token",
              "remote_app": {
                  "client_id": "<keycloak_client_name>",                                                       
                  "client_secret": "<keycloak_client_secret>",
                  "client_kwargs": {"scope": "openid email profile"},
                  "api_base_url": "https://<my_domain>/realms/<realm_name>/protocol/openid-connect",
              
                  "authorize_url": "https://<my_domain>/realms/<realm_name>/protocol/openid-connect/auth",
                  "access_token_url": "https://<my_domain>/realms/<realm_name>/protocol/openid-connect/token",

                  'jwks_uri': "https://<my_domain>/realms/<realm_name>/protocol/openid-connect/certs",

                  "request_token_url": None,
              }
          }
      ]
      # Will allow user self registration, allowing to create Flask users from Authorized User
      AUTH_USER_REGISTRATION = True
      # The default user self registration role
      AUTH_USER_REGISTRATION_ROLE = "Public"


init:

  initscript: |-
    #!/bin/sh
    set -eu
    echo "Install libs for supporting Keycloak"
    pip install Flask-OAuthlib Authlib
    echo "Upgrading DB schema..."
    superset db upgrade
    echo "Initializing roles..."
    superset init
    {{ if .Values.init.createAdmin }}
    echo "Creating admin user..."
    superset fab create-admin \
                    --username {{ .Values.init.adminUser.username }} \
                    --firstname {{ .Values.init.adminUser.firstname }} \
                    --lastname {{ .Values.init.adminUser.lastname }} \
                    --email {{ .Values.init.adminUser.email }} \
                    --password {{ .Values.init.adminUser.password }} \
                    || true
    {{- end }}
    {{ if .Values.init.loadExamples }}
    echo "Loading examples..."
    superset load_examples
    {{- end }}
    if [ -f "{{ .Values.extraConfigMountPath }}/import_datasources.yaml" ]; then
      echo "Importing database connections.... "
      superset import_datasources -p {{ .Values.extraConfigMountPath }}/import_datasources.yaml
    fi

from superset.

Related Issues (20)

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.