The FDA MyStudies Auth server is the centralized authentication mechanism for the various client applications of the MyStudies platform.
The client applications are:
The Auth serverprovides the following functionality:
- User registration
- User credentials management
- User authentication
- User logout
- Server-to-server authentication support
The Auth server identity management application is built as a Spring Boot application that implements user login and consent flows. It integrates with your deployment’s instance of ORY Hydra for token generation and management.
NOTE: Holistic deployment of the FDA MyStudies platform with Terraform and infrastructure-as-code is the recommended approach to deploying this component. A step-by-step guide to semi-automated deployment can be found in the
deployment/directory. The following instructions are provided in case manual deployment in a VM is required. Google Cloud infrastructure is indicated, but equivalent alternative infrastructure can be used as well. It is important for the deploying organization to consider the identity and access control choices made when configuring the selected services. If pursuing a manual deployment, a convenient sequence ishydra/→auth-server/→participant-datastore/→participant-manager-datastore/→participant-manager/→study-datastore/→response-datastore/→study-builder/→Android/→iOS/.
To deploy the Auth server manually:
- Create a Compute Engine VM instance with your preferred machine type and OS (for example, e2-medium and Debian 10), then reserve a static IP
- Verify that your VM instance has the
Stackdriver Logging APIwrite access scope (on by default) and that your VM’s service account has theLogs Writerrole (off by default) - Check out the latest code from the FDA MyStudies repository
- Create a Cloud SQL instance with MySQL v5.7 (instructions)
- Configure the
Auth serverdatabase on the Cloud SQL instance- Create a user account that the
Auth serverapplication will use to access this instance (instructions) - Create a database named
oauth_server_hydrawith themystudies_oauth_server_hydra_db_script.sqlscript (instructions) - Enable the database’s private IP connectivity in the same network as your VM (instructions)
- Create a user account that the
- To enable
https, obtain a certificate from a certificate authority or prepare a self-signed certificate- For example, if you included the host name of this VM instance in the list of Subject Alternative Names in the certificate that you created during
Hydradeployment, you could useopenssl pkcs12 -export -password pass:changeit -out mystudies-cert.p12 -inkey <path_to_mystudies-private.key> -in <path_to_mystudies-cert.pem>to convert that certificate for use in this deployment (wheremystudies-private.keyandmystudies-cert.pemare the certificate files you created duringHydradeployment)
- For example, if you included the host name of this VM instance in the list of Subject Alternative Names in the certificate that you created during
- Deploy the
Auth servercontainer to the VM- Create the Docker image using
sudo mvn -B package -Pprod com.google.cloud.tools:jib-maven-plugin:2.5.2:dockerBuild -Dimage=auth-server-imagefrom theauth-server/directory (you may need to install Docker and Maven, for examplesudo apt install maven) - Update the Docker environment file
variables.envwith the values of theapplication.propertiesfile for your deployment - Run the container on your VM using
sudo docker run --detach -v ~/certs:/certs --env-file variables.env -p 443:8080 --name auth-server auth-server-image(you may need to adjust the port to 80 if you are usinghttp) - If your
Hydrainstance is using a self-signed certificate, add that certificate to your container’s keystore, for example withsudo docker exec -it auth-server bash -c "openssl s_client -connect <your_hydra_instance> | sed -ne '/-BEGIN CERTIFICATE/,/END CERTIFICATE/p' > hydra.crt; keytool -import -trustcacerts -alias hydra -file hydra.crt -keystore /usr/local/openjdk-11/lib/security/cacerts -storepass changeit", then restart the container withsudo docker restart auth-server
- Create the Docker image using
- Test if the application is running with
curl -k https://0.0.0.0/auth-server/healthCheck - You can review application logs in the logging directory you specified, or with
sudo docker logs auth-server; audit logs are available in Cloud Logging
Copyright 2020 Google LLC