You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/04 22:05:12 UTC
[GitHub] [airflow] NicolasAndresCalvo opened a new issue, #24833: Github SSO OAuth in Airflow 2.3.2 Issue
NicolasAndresCalvo opened a new issue, #24833:
URL: https://github.com/apache/airflow/issues/24833
### Apache Airflow version
2.3.2 (latest released)
### What happened
Hi team, i was trying to enable Github SSO auth in my Airflow but i got 404 page as a result. I follow this doc:
https://airflow.apache.org/docs/apache-airflow/2.3.2/security/webserver.html#other-methods
### webserver_config.py
```
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""Default configuration for the Airflow webserver"""
import os
from flask_appbuilder.security.manager import AUTH_OAUTH
# from airflow.www.fab_security.manager import AUTH_DB
# from airflow.www.fab_security.manager import AUTH_LDAP
# from airflow.www.fab_security.manager import AUTH_OAUTH
# from airflow.www.fab_security.manager import AUTH_OID
# from airflow.www.fab_security.manager import AUTH_REMOTE_USER
basedir = os.path.abspath(os.path.dirname(__file__))
# Flask-WTF flag for CSRF
WTF_CSRF_ENABLED = True
# ----------------------------------------------------
# AUTHENTICATION CONFIG
# ----------------------------------------------------
# For details on how to set up each of the following authentication, see
# http://flask-appbuilder.readthedocs.io/en/latest/security.html# authentication-methods
# for details.
# The authentication type
# AUTH_OID : Is for OpenID
# AUTH_DB : Is for database
# AUTH_LDAP : Is for LDAP
# AUTH_REMOTE_USER : Is for using REMOTE_USER from web server
# AUTH_OAUTH : Is for OAuth
AUTH_TYPE = AUTH_OAUTH
AUTH_ROLES_SYNC_AT_LOGIN = True # Checks roles on every login
AUTH_USER_REGISTRATION = (
True # allow users who are not already in the FAB DB to register
)
# AUTH_TYPE = AUTH_DB
# Uncomment to setup Full admin role name
# AUTH_ROLE_ADMIN = 'Admin'
# Uncomment and set to desired role to enable access without authentication
# AUTH_ROLE_PUBLIC = 'Viewer'
# Will allow user self registration
# AUTH_USER_REGISTRATION = True
# The recaptcha it's automatically enabled for user self registration is active and the keys are necessary
# RECAPTCHA_PRIVATE_KEY = PRIVATE_KEY
# RECAPTCHA_PUBLIC_KEY = PUBLIC_KEY
# Config for Flask-Mail necessary for user self registration
# MAIL_SERVER = 'smtp.gmail.com'
# MAIL_USE_TLS = True
# MAIL_USERNAME = 'yourappemail@gmail.com'
# MAIL_PASSWORD = 'passwordformail'
# MAIL_DEFAULT_SENDER = 'sender@gmail.com'
# The default user self registration role
# AUTH_USER_REGISTRATION_ROLE = "Public"
# If you wish, you can add multiple OAuth providers.
OAUTH_PROVIDERS = [
{
"name": "github",
"icon": "fa-github",
"token_key": "access_token",
"remote_app": {
"client_id": os.getenv("OAUTH_APP_ID"),
"client_secret": os.getenv("OAUTH_APP_SECRET"),
"api_base_url": "https://api.github.com",
"client_kwargs": {"scope": "read:user, read:org"},
"access_token_url": "https://github.com/login/oauth/access_token",
"authorize_url": "https://github.com/login/oauth/authorize",
"request_token_url": None,
},
},
]
# When using OAuth Auth, uncomment to setup provider(s) info
# Google OAuth example:
# OAUTH_PROVIDERS = [{
# 'name':'google',
# 'token_key':'access_token',
# 'icon':'fa-google',
# 'remote_app': {
# 'api_base_url':'https://www.googleapis.com/oauth2/v2/',
# 'client_kwargs':{
# 'scope': 'email profile'
# },
# 'access_token_url':'https://accounts.google.com/o/oauth2/token',
# 'authorize_url':'https://accounts.google.com/o/oauth2/auth',
# 'request_token_url': None,
# 'client_id': GOOGLE_KEY,
# 'client_secret': GOOGLE_SECRET_KEY,
# }
# }]
# When using LDAP Auth, setup the ldap server
# AUTH_LDAP_SERVER = "ldap://ldapserver.new"
# When using OpenID Auth, uncomment to setup OpenID providers.
# example for OpenID authentication
# OPENID_PROVIDERS = [
# { 'name': 'Yahoo', 'url': 'https://me.yahoo.com' },
# { 'name': 'AOL', 'url': 'http://openid.aol.com/<username>' },
# { 'name': 'Flickr', 'url': 'http://www.flickr.com/<username>' },
# { 'name': 'MyOpenID', 'url': 'https://www.myopenid.com' }]
# ----------------------------------------------------
# Theme CONFIG
# ----------------------------------------------------
# Flask App Builder comes up with a number of predefined themes
# that you can use for Apache Airflow.
# http://flask-appbuilder.readthedocs.io/en/latest/customizing.html#changing-themes
# Please make sure to remove "navbar_color" configuration from airflow.cfg
# in order to fully utilize the theme. (or use that property in conjunction with theme)
# APP_THEME = "bootstrap-theme.css" # default bootstrap
# APP_THEME = "amelia.css"
# APP_THEME = "cerulean.css"
# APP_THEME = "cosmo.css"
# APP_THEME = "cyborg.css"
# APP_THEME = "darkly.css"
# APP_THEME = "flatly.css"
# APP_THEME = "journal.css"
# APP_THEME = "lumen.css"
# APP_THEME = "paper.css"
# APP_THEME = "readable.css"
# APP_THEME = "sandstone.css"
# APP_THEME = "simplex.css"
# APP_THEME = "slate.css"
# APP_THEME = "solar.css"
# APP_THEME = "spacelab.css"
# APP_THEME = "superhero.css"
# APP_THEME = "united.css"
# APP_THEME = "yeti.css"
```
### Dockerfile
```
FROM apache/airflow:2.3.2
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
vim \
&& apt-get autoremove -yqq --purge \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
USER airflow
RUN pip install --no-cache-dir 'apache-airflow[amazon]' 'apache-airflow-providers-mongo' 'apache-airflow-providers-discord[http]==3.0.0'
COPY --chown=airflow:root ./dags/ ${AIRFLOW_HOME}/dags/
COPY --chown=airflow:root ./plugins/ ${AIRFLOW_HOME}/plugins/
COPY --chown=airflow:root ./webserver_config.py ${AIRFLOW_HOME}/webserver_config.py
```
### OAuth Apps
![image](https://user-images.githubusercontent.com/34729309/177220041-8348d426-45c8-4fd7-a98a-a31cfc638f43.png)
**GITHUB SSO**
![image](https://user-images.githubusercontent.com/34729309/177219212-9beed7e7-a6fa-4a5d-b21d-13d6de4489c5.png)
Any idea? Maybe i am not setting the Github Org
### What you think should happen instead
_No response_
### How to reproduce
_No response_
### Operating System
Debian GNU/Linux 11
### Versions of Apache Airflow Providers
```
apache-airflow-providers-amazon==3.4.0
apache-airflow-providers-celery==2.1.4
apache-airflow-providers-cncf-kubernetes==4.0.2
apache-airflow-providers-discord==3.0.0
apache-airflow-providers-docker==2.7.0
apache-airflow-providers-elasticsearch==3.0.3
apache-airflow-providers-ftp==2.1.2
apache-airflow-providers-google==7.0.0
apache-airflow-providers-grpc==2.0.4
apache-airflow-providers-hashicorp==2.2.0
apache-airflow-providers-http==2.1.2
apache-airflow-providers-imap==2.2.3
apache-airflow-providers-microsoft-azure==3.9.0
apache-airflow-providers-mongo==3.0.0
apache-airflow-providers-mysql==2.2.3
apache-airflow-providers-odbc==2.0.4
apache-airflow-providers-postgres==4.1.0
apache-airflow-providers-redis==2.0.4
apache-airflow-providers-sendgrid==2.0.4
apache-airflow-providers-sftp==2.6.0
apache-airflow-providers-slack==4.2.3
apache-airflow-providers-sqlite==2.1.3
apache-airflow-providers-ssh==2.4.4
```
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else
**override-values.yaml**
```
# Production Guide
# Database
# https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#database
postgresql:
enabled: false
data:
metadataSecretName: mydatabase-metadata-secret-name
resultBackendSecretName: mydatabase-result-backend-secret-name
# Webserver Secret Key
# https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#webserver-secret-key
webserverSecretKey: SECRET
# Manage DAGs files
# Mounting DAGs from a private Github repo using Git-Sync sidecar
# https://airflow.apache.org/docs/helm-chart/stable/manage-dags-files.html#mounting-dags-from-a-private-github-repo-using-git-sync-sidecar
dags:
gitSync:
enabled: true
repo: git@github.com:ORG/aument-airflow.git
branch: main
subPath: ""
sshKeySecret: airflow-ssh-secret
extraSecrets:
airflow-ssh-secret:
data: |
gitSshKey: 'KEY'
# Bake DAGs in Docker image
# https://airflow.apache.org/docs/helm-chart/stable/manage-dags-files.html#bake-dags-in-docker-image
images:
airflow:
pullPolicy: Always
# Adding Connections, Variables and Environment Variables
# Variables
# https://airflow.apache.org/docs/helm-chart/stable/adding-connections-and-variables.html#variables
env:
- name: "AIRFLOW__SCHEDULER__MIN_FILE_PROCESS_INTERVAL"
value: "0"
- name: "AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL"
value: "60"
- name: AIRFLOW__WEBSERVER__RELOAD_ON_PLUGIN_CHANGE
value: "True"
- name: "AIRFLOW__LOGGING__REMOTE_LOGGING"
value: "True"
- name: "AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER"
value: "s3://NAME-dev-airflow"
- name: AIRFLOW__LOGGING__REMOTE_LOG_CONN_ID
value: "aws_default"
- name: "AIRFLOW__SCHEDULER__SCHEDULE_AFTER_TASK_EXECUTION"
value: "False"
# - name: "AIRFLOW__CORE__DEFAULT_TASK_EXECUTION_TIMEOUT"
# value: "300"
# Airflow executor
# One of: LocalExecutor, LocalKubernetesExecutor, CeleryExecutor, KubernetesExecutor, CeleryKubernetesExecutor
executor: "KubernetesExecutor"
# https://airflow.apache.org/docs/helm-chart/stable/production-guide.html#pgbouncer
pgbouncer:
enabled: true
```
```
helm upgrade --install ${{ env.HELM_RELEASE }} -n ${{ env.NAMESPACE }} ${{ env.HELM_CHART }} \
--set images.airflow.repository=${{ env.AWS_REPO_URL }}/${{ env.AWS_REPO_NAME }} \
--set images.airflow.tag=${{ env.TAG}} \
-f override-values.yaml
```
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk closed issue #24833: Github SSO OAuth in Airflow 2.3.2 Issue
Posted by GitBox <gi...@apache.org>.
potiuk closed issue #24833: Github SSO OAuth in Airflow 2.3.2 Issue
URL: https://github.com/apache/airflow/issues/24833
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on issue #24833: Github SSO OAuth in Airflow 2.3.2 Issue
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #24833:
URL: https://github.com/apache/airflow/issues/24833#issuecomment-1174420133
Thanks for opening your first issue here! Be sure to follow the issue template!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org