Code Monkey home page Code Monkey logo

open-science-pool-registry's Introduction

registration

This is the web application for Open Science Pool token registration

Structure

The web app is a Flask app. The core app is created in an "application factory" in registry/app.py, and it hooks together blueprints found in some of the subdirectories of registry/.

Blueprints:

  • index - landing page, "about" page, etc.
  • account - handles user accounts. We don't quite have registration because we use CILogon, but this is where you can go to see (for example) your contact email.
  • signup - handles forms for users to register themselves and their data sources.
  • connect - provides instructions for users to install and connect their data sources.
  • token - handles the server side of the token workflow when connecting a new data source.

Each blueprint has its own static and templates directories, and there are also "global" static and templates directories that sit next to app.py. These directories are for:

register.py

This repository also includes register.py, the client-side script for getting a token for a new data source. It's stored here because it talks to the token blueprint, and therefore needs to stay in sync with it.

Development

To run the registration server locally, build and run the testing container image:

  1. Build the container image:

    docker build -t os-registry-test -f Dockerfile.testing .
    
  2. Copy example configuration required by the registry server:

    cp examples/config.py examples/humans.ini .
    
  3. Start the local registry:

    docker run --rm --name my-registry -it -v ${PWD}:/srv -p 8443:443 os-registry-test
    
  4. Access the local registry in your browser by accessing https://localhost:8443

  5. For a login shell to the registry, run the following:

    docker exec -it my-registry /bin/bash
    

    Helpful log files can be found in /var/log/httpd/ and /var/log/condor/registration.log.

Note that changes to files copied into the container image (e.g. COPY lines in Dockerfile.testing) will require a rebuild of the container image.

Installation

Clone the repository to wherever you would like to serve the application from (e.g., /var/www/registration).

Example/template Apache configuration:

<VirtualHost *:443>
  ServerName htpheno-cm.chtc.wisc.edu
  ServerAdmin [email protected]

  # This is the OIDC callback path
  <Location "/callback">
    <RequireAny>
      Require valid-user
    </RequireAny>
    AuthType openid-connect
  </Location>

  ## Logging
  ErrorLog "/var/log/httpd/local_default_ssl_error_ssl.log"
  LogLevel info
  ServerSignature Off
  CustomLog "/var/log/httpd/local_default_ssl_access_ssl.log" combined 

  ## SSL directives
  SSLEngine on
  SSLCertificateFile      "/var/www/hostcert.pem"
  SSLCertificateKeyFile   "/var/www/hostkey.pem"
  SSLCertificateChainFile "/var/www/hostcert.pem"

  ## WSGI configuration
  WSGIDaemonProcess Registration display-name=Registration group=condor processes=2 threads=25 user=condor
  WSGIProcessGroup Registration
  WSGIScriptAlias / "/var/www/registration/wsgi.py"

  ## OIDC configuration
  OIDCProviderMetadataURL https://cilogon.org/.well-known/openid-configuration
  OIDCClientID cilogon:/client_id/<secret>
  OIDCClientSecret <secret>

  OIDCRedirectURI https://htpheno-cm.chtc.wisc.edu/callback

  # Used to encrypt the session cookie and the local cache.
  OIDCCryptoPassphrase <secret>

  # Control the information in the returned token.
  OIDCScope  "openid email org.cilogon.userinfo"

  # The value of this scope is used as the username in the environment
  # variables provided to WSGI.
  OIDCRemoteUserClaim  eppn

</VirtualHost>

By default we "protect" everything under / with OIDC. Some pages should be "public", i.e., unprotected (right now, these are the "index" and "about" pages, and anything under /static, so that static assets can always be served). This is managed by Apache, not the webapp. Example configuration below:

  <Location "/">
    <RequireAny>
      Require valid-user
    </RequireAny>
    AuthType openid-connect
  </Location>

  <LocationMatch "^/$">
    <RequireAny>
      Require all granted
    </RequireAny>
    AuthType none
  </LocationMatch>

  <Location "/about">
    <RequireAny>
      Require all granted
    </RequireAny>
    AuthType none
  </Location>

  <Location "/static">
    <RequireAny>
      Require all granted
    </RequireAny>
    AuthType none
  </Location>

Configuration

Configuration options will be read out of a file named config.py, placed at the root of the repository, next to this README.md. The file should contain global variables with names matching the configuration options described below, like

USER_ID_ENV_VAR = "REMOTE_USER"

Required

These configuration options must be set. They do not have defaults.

  • COLLECTOR - The Open Science pool collector hostname.
  • SERVER_NAME - The hostname of the host server.
  • OIDC_REDIRECT_URI - The URI for the OIDC redirect.
  • USER_ID_ENV_VAR - The request environment variable that holds the user's identity.
  • HUMANS_FILE - The path to the file that contains information on humans.
  • ADMIN_EMAILS - The email addresses that will receive mail when users sign up, like ADMIN_EMAILS = "Foo Bar <[email protected]>, Wiz Bang <[email protected]>".
  • SUPPORT_EMAIL - The email address to display for users to send support questions to.

Optional

  • CONDOR_TOKEN_REQUEST_LIST - The path to the condor_token_request_list executable. By default, discover it on $PATH.
  • CONDOR_TOKEN_REQUEST_APPROVE - The path to the condor_token_request_approve executable. By default, discover it on $PATH.

open-science-pool-registry's People

Contributors

joshkarpel avatar jasoncpatton avatar bbockelm avatar caffretro avatar brianhlin avatar

Watchers

James Cloos avatar

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.