8000 GitHub - LucaCinquini/esgf-auth · GitHub
[go: up one dir, main page]

Skip to content
{"props":{"color_mode":"dark","logged_in":false,"marketing_page":false,"home_path":"/","login_path":"/login?return_to=https%3A%2F%2Fgithub.com%2FLucaCinquini%2Fesgf-auth","signup_path":"/signup?ref_cta=Sign+up\u0026ref_loc=header+logged+out\u0026ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E\u0026source=header-repo\u0026source_repo=LucaCinquini%2Fesgf-auth","signup_enabled":true,"is_signup_controller":false,"show_search_and_nav":true,"hide_search":false,"private_mode_enabled":false,"should_use_dotcom_links":true,"auth_hydro_click":"{\"event_type\":\"authentication.click\",\"payload\":{\"location_in_page\":\"site header menu\",\"repository_id\":null,\"auth_type\":\"SIGN_UP\",\"originating_url\":\"https://github.com/LucaCinquini/esgf-auth\",\"user_id\":null}}","auth_hydro_click_hmac":"7bd32e317028b4e27be9b06ed5c2d8053385057aead04b54790e6dd8fba08c60"}}
LucaCinquiniPublic

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

esgf-auth

OpenID/OAuth2 authentication client for ESGF

The ESGF authentication client is a Django web aplication that replaces the ESGF ORP. If a dataset file requires authentication, the THREDDS authentication filter redirects a user web browser to the web app. The web app discovers authentication services provided by an IdP selected by a user in the drop down, and redirects the user web browser to OAuth2 or OpenID server where the user enters his/her username and password. When the user is authenticated successfully, the OAuth2 (or OpenID) server redirects the user web browser back to the web app. The web app sets a secret cookie and redirects the user back to the THREDDS authentication filter.

Install esgf-auth

Create Python 2.7 virtual environment

$ python --version 
Python 2.7.10
$ virtualenv venv
$ . venv/bin/activate

Download and install crypto-cookie:

(venv)$ git clone git@github.com:philipkershaw/crypto-cookie
(venv)$ cd crypto-cookie
(venv)$ python setup.py
(venv)$ cd ..

Download and install esgf-auth with dependencies (Django, social-auth-app-django, social-auth-core, etc.)

(venv)$ git clone git@github.com:lukaszlacinski/esgf-auth
(venv)$ cd esgf-auth
(venv)$ pip install -r requirements.txt

Create the database

(venv)$ ./manage.py migrate

Create /esg/config/esgf_oauth2.json file with a client key and secret received from an admin of an ESGF OAuth2 server. When you register your OAuth2 client, your redirect URI is https://<your_hostname>/esgf-auth/complete/esgf/. Here is a sample esgf_oauth2.json file:

{
    "ceda.ac.uk":
        "key": "BUwBQaqS7qs2pSLhwHiAQlqt+hc=",
        "secret": "Qf+EsAoDmZzdW1L/H4zAj2u/tg3ISCnqxby+2bD7hY/GCZcRJgUjFQ=="
    },
    "esgf-node.llnl.gov": {
        "key": "RMRXIub0/m4RIfo7sdr2OiGOTmc=",
        "secret": "N9PT+3/rGnjGPkEBsyzhoggsyFYdX6ptPG9Gy6Olb0j8ub/4+DJtiA=="
    }
}

Create a second file /esg/config/esgf_auth_config.json with additional site-specific information. An example of such configuration file is:

{
"ESGF_HOSTNAME":"my-node.esgf.org",
"ESGF_SECRET_KEY":"o7GIieXmQzUGslstjWS7d8==",
"DJANGO_SECRET_KEY":"xu0jf]LBUHfLHWbHXzBcDuffHaWQYrev8ojXXd1M"
}

where all values need to be changed by each site administrator. The value of "ESGF_SECRET_KEY" must match the value used to encode the authentication cookies that is configured in the THREDDS web.xml file.

Apache/mod_wsgi

For example, on Ubuntu, add the following lines to /etc/apache2/sites-available/default-ssl,conf in <VirtualHost _default_:443>

    WSGIDaemonProcess esgf_auth python-path=<your_base_dir>/esgf-auth:<your_base_dir>/venv/lib/python2.7/site-packages
    WSGIScriptAlias /esgf-auth <your_base_dir>/esgf-auth/esgf_auth/wsgi.py process-group=esgf_auth
    <Directory <your_base_dir>/esgf-auth/esgf_auth>
        <Files wsgi.py>
            # Apache >= 2.4
            #Require all granted
            # Apache <= 2.2
            Order allow,deny
            Allow from all
        </Files>
    </Directory>
    Alias /esgf-auth/home/static/ <your_base_dir>/esgf-auth/static/
    <Directory <your_base_dir>/esgf-auth/static>
        Options -Indexes
        # Apache >= 2.4
        #Require all granted
        # Apache <= 2.2
        Order allow,deny
        Allow from all
        AllowOverride None
    </Directory>

After restarting Apache, open https://<your_hostname>/esgf-auth/thredds/ in a web browser. The page mimics THREDDS server with the authentication filter. You will also likely need to change ownership of the 'esgf-auth' directory to www-data (on Ubuntu), so Apache can access the SQLite3 database file.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0