Skip to content
Terry edited this page Mar 3, 2017 · 6 revisions

Welcome to the MIDAS Accounts Wiki!

MIDAS Accounts

This project consists of the centralized web services that can be used by other MIDAS-Network applications. It is a Java web application based on Spring Boot, Spring Security, Thymeleaf, Maven, and Auth0 (http://auth0.com).

Current implementation

An overview of the protocol (defined by Auth0 in https://auth0.com/docs/protocols#oauth-server-side) is shown in the picture below:

Midas Accounts Overview

(For this example the app will be deployed with /dev as context and 9000 as port)

  1. Authorize: The Auth0 script (lock.js) in auth0Login.html prompts the user to sign in. After the user chooses an identity provider (e.g. Google, Facebook), lock.js sends an authorization request to Auth0.

  2. Authenticate: Next, Auth0 redirects the user to the identity provider to authenticate the user. This step may be skipped if the user is already signed in with the provider.

  3. Code: If the user is authenticated, Auth0 will redirect to the URL provided as the callbackURL field in auth0Login.html (http://localhost:9000/dev/callback) with code and state as query parameters.

  4. Code: Then the doGet method of the configured servlet, Auth0ServletCallback (com.auth0::auth0-servlet), handles the redirection.

  5. Get Access Token: The method fetches the token and the user profile from Auth0 and stores them into the HTTP Session. The browser will be redirected to the configured URL (http://localhost:9000/dev/auth0) by the redirectCallback Bean handled by method processAuth0Login of class Auth0LoginController. The method saves the user profile as Auth0User. This Auth0User is used as ModelAttribute in other Controllers. Finally, it redirects to http://localhost:9000/dev/terms.

Instructions

Development

Downloading source code

$ git clone https://github.com/midas-isg/midas-hub

Running the application

Run Application.main just as a Java application.

Deployment

Start

  1. Download the source code (see Downloading source code).

  2. Run ./start.sh. (If this is the first run, it will fail because the previous step forces you to override the application properties, so edit the config/application.properties file to match auth0.com and your application settings.)

  3. Run ./start.sh again.