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 2020/12/17 21:42:28 UTC

[GitHub] [airflow] LamaAni opened a new issue #13142: Cannot set default public role as admin, while trying to disable login, AUTH_ROLE_PUBLIC = 'Admin'

LamaAni opened a new issue #13142:
URL: https://github.com/apache/airflow/issues/13142


   # Error while attempting to disable login
   
   **Apache Airflow version**: 2.0.0
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: mac-pro
   - **OS** (e.g. from /etc/os-release): osx
   - **Kernel** (e.g. `uname -a`): Darwin C02CW1JLMD6R 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   
   When setting in `webserver_config.py`,
   ```python
   AUTH_ROLE_PUBLIC = 'Admin'
   ```
   
   Got error on webserver, when going to localhost:8080/home,
   ```log
   [2020-12-17 16:29:09,993] {app.py:1891} ERROR - Exception on /home [GET]
   Traceback (most recent call last):
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
       response = self.full_dispatch_request()
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
       raise value
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
       rv = self.dispatch_request()
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/airflow/www/auth.py", line 34, in decorated
       return func(*args, **kwargs)
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/airflow/www/views.py", line 540, in index
       user_permissions = current_app.appbuilder.sm.get_all_permissions_views()
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/airflow/www/security.py", line 226, in get_all_permissions_views
       for role in self.get_user_roles():
     File "/Users/Zshot0831/.local/share/virtualenvs/airflow_2-DimIlKMl/lib/python3.8/site-packages/airflow/www/security.py", line 219, in get_user_roles
       public_role = current_app.appbuilder.config.get('AUTH_ROLE_PUBLIC')
   AttributeError: 'AirflowAppBuilder' object has no attribute 'config'
   ```
   
   
   **What you expected to happen**:
   
   Reached homepage without the need for authentication as admin.
   
   **How to reproduce it**:
   1. Install airflow in a new environment (or to a new directory, set env AIRFLOW_HOME=[my new dir])
   2. Uncomment and change in webserver_config.py 
       ```python
       AUTH_ROLE_PUBLIC = 'Admin'
       ```
   3. Start `airflow webserver`
   4. Look in localhost:8080/home or localhost:8080
   
   *webserver_config.py file**
   ```python
   #
   # 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_DB
   
   # from flask_appbuilder.security.manager import AUTH_LDAP
   # from flask_appbuilder.security.manager import AUTH_OAUTH
   # from flask_appbuilder.security.manager import AUTH_OID
   # from flask_appbuilder.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_DB
   
   # Uncomment to setup Full admin role name
   # AUTH_ROLE_ADMIN = 'Admin'
   
   # Uncomment to setup Public role name, no authentication needed
   AUTH_ROLE_PUBLIC = 'Admin'
   
   # Will allow user self registration
   # AUTH_USER_REGISTRATION = True
   
   # The default user self registration role
   # AUTH_USER_REGISTRATION_ROLE = "Public"
   
   # 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"
   ```
   
   ![Screen Shot 2020-12-17 at 4 37 06 PM](https://user-images.githubusercontent.com/3694482/102546943-64733800-4086-11eb-8dd7-6a36b2b8ee82.png)
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-748548824


   @AmarEL  I assigned you to this ticket.  🐈 🐈‍⬛


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-800762420


   > Did we get a fix for this issue? I'm still facing it while trying to disable authentication in airflow webserver.
   
   Please see the above. Its in the new release 2.0.1 and up.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] txr150430 commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
txr150430 commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-801497161


   Thanks @LamaAni! Upgrading to the latest release worked.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj closed issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
mik-laj closed issue #13142:
URL: https://github.com/apache/airflow/issues/13142


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-748505026


   > @LamaAni can you assign it to me, please?
   > I faced this problem and kind of solve it working on #12827
   
   Hi @AmarEL , I can't seem to be able to assign


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] maraimm commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
maraimm commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-1075619238


   I still have the same issue. My version is "2.2.4"


-- 
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] txr150430 commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
txr150430 commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-800731292


   Did we get a fix for this issue? I'm still facing it while trying to disable authentication in airflow webserver.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] abdullahodibat commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
abdullahodibat commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-770109041


   im using version 2.0.0.
   and i get same error as above when i open `http://localhost:8080/`


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] abdullahodibat commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
abdullahodibat commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768600981


   hallo, any updates on this?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] abdullahodibat commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
abdullahodibat commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768608907


   @LamaAni thanks for your reply!
   for me i dont get any error. but i still get a login screen. is this the correct way to disable the web login?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] AmarEL commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
AmarEL commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768985144


   Which version are you using @abdullahodibat?
   I tested for the current master and it worked fine.
   
   There is another issue #13340 related to this, but the login screen shouldn't appear as expected if you set the option to disable the login.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-751610691


   Thanks!


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768610171


   > @LamaAni thanks for your reply!
   > for me i dont get any error. but i still get a login screen. is this the correct way to disable the web login?
   
   Well, if your getting the login screen then you are either directly going to it (the link points there) or you are doing something wrong. This should be a valid method to disable login since all users should have admin privileges.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768604983


   @abdullahodibat   I think there was a PR to master: https://github.com/apache/airflow/pull/13191


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] abdullahodibat commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
abdullahodibat commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768615547


   i am accessing easily using `http://localhost:8080/`.  although i uncommented the above line and restarted the webserver i still get the login screen.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] AmarEL commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
AmarEL commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-770251815


   I think this correction is available just in the current master of this repo, and will be realesed officially in a new version. So, for this reason the error still happening to you with the version 2.0.0
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] AmarEL commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
AmarEL commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-748502463


   @LamaAni can you assign it to me, please?
   I faced this problem and kind of solve it working on #12827 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #13142: Cannot set default public role as admin, while trying to disable login, AUTH_ROLE_PUBLIC = 'Admin'

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-747719573


   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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] LamaAni commented on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
LamaAni commented on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-768625297


   > i am accessing easily using `http://localhost:8080/`. although i uncommented the above line and restarted the webserver i still get the login screen.
   
   I am not sure,
   I have not tested the solution since we went back the airflow 1 in my company. If I have time I would retest it.
   
   Maybe @AmarEL can help?


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj edited a comment on issue #13142: Error while attempting to disable login (setting AUTH_ROLE_PUBLIC = 'Admin')

Posted by GitBox <gi...@apache.org>.
mik-laj edited a comment on issue #13142:
URL: https://github.com/apache/airflow/issues/13142#issuecomment-748548824


   @AmarEL  I assigned you to this ticket.  🐈 🐈‍⬛ Only commuters and people with triage roles can assign a person to tickets. See: https://infra.apache.org/github-roles.html


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org