Skip to content
Snippets Groups Projects
Verified Commit 0908ca0e authored by Mark's avatar Mark
Browse files

Add more instructions

parent a9f78cea
No related branches found
No related tags found
1 merge request!5Service Integration
Pipeline #1363 failed with stages
in 1 minute and 34 seconds
This is a test application to verify that all of the components provided in this repository This is a test application to verify that all of the components provided in this repository
work together according to [OpenID Connect Standards](https://openid.net/developers/specs/) work together according to [OpenID Connect Standards](https://openid.net/developers/specs/)
## Prerequisites
The single sign-on application needs to be up and running. Instructions on how to accomplish
that can be found in `../../README.md`.
### Create oAuth Client
You also need to create an oAuth2-Client to enable this application to communicate with the
oAuth server.
To do that you can run the `create-hydra-client` script in this repository:
```
bash ../create-hydra-client.bash testapplication clientsecret http://localhost:4445 http://localhost:13337/callback
```
`http://localhost:4445` refers to the hydra-admin service. `http://localhost:13337/callback` is the
callback address of the test application. Make sure it matches the address specified in `../../docker-compose.yml`
> `serve all --dangerous-force-http --dangerous-allow-insecure-redirect-urls "http://localhost:13337/callback":`
### Create users
In the default setup, users can be created by executing the scripts contained in `../../user-panel/utils/`
```
bash ../../user-panel/utils/create-user.bash admin adminadmin admin@example.net
bash ../../user-panel/utils/create-application.bash testapplication
bash ../../user-panel/utils/grant-access.bash admin testapplication
bash ../../user-panel/utils/create-role.bash admin
bash ../../user-panel/utils/assign-role.bash admin admin
```
## Installation
Install the requirements with: Install the requirements with:
``` ```
...@@ -9,22 +39,59 @@ virtualenv venv ...@@ -9,22 +39,59 @@ virtualenv venv
pip3 install -r requrements.txt pip3 install -r requrements.txt
``` ```
Before running the application with `flask run --port=????`, make sure you export the following ## Configuration
environment variables with values according to your setup.
Make sure you export the following
environment variables with values according to your setup. Use the default values provided here
if you run your setup locally.
``` ```
export BASE_URL=http://sso.oas.example.net:4444/ # Hydra public API Base export BASE_URL=http://localhost:4444/ # Hydra public API Base
export ACCESS_TOKEN_URL=http://sso.oas.example.net:4444/oauth2/token # Hydra token endpoint export ACCESS_TOKEN_URL=http://localhost:4444/oauth2/token # Hydra token endpoint
export LOGOUT_URL=http://sso.oas.example.net:4444/oauth2/sessions/logout # Hydra logout endpoint export LOGOUT_URL=http://localhost:4444/oauth2/sessions/logout # Hydra logout endpoint
export AUTHORIZE_URL=http://sso.oas.example.net:4444/oauth2/auth # Hydra authentication endpoint export AUTHORIZE_URL=http://localhost:4444/oauth2/auth # Hydra authentication endpoint
export USERINFO_URL=http://sso.oas.example.net:4444/userinfo # Hydra OpenID Connect userinfo endpoint export USERINFO_URL=http://localhost:4444/userinfo # Hydra OpenID Connect userinfo endpoint
export KEY=testapplication # name of your oauth/openID Connect client (application) export KEY=testapplication # name of your oauth/openID Connect client (application)
export SECRET=clientsecret # secret of yout oauth/openID Connect client (application) export SECRET=clientsecret # secret of yout oauth/openID Connect client (application)
``` ```
Navigate to `localhost:port/` to trigger the openID connect authentication flow. During the login
## Run the tests
Start the application with:
```
flask run --port=13337
```
Navigate to `http://localhost:13337/` to trigger the openID connect authentication flow. During the login
process your agent's browser will be redirected multiple times. If successful, you will see a process your agent's browser will be redirected multiple times. If successful, you will see a
json reply containing your oAuth token. json reply containing your oAuth token.
Navigate to `localhost:port/userinfo` after you received the token to pull userinfo via openID Navigate to `http://localhost:13337/userinfo` after you received the token to pull userinfo via openID
Connect scopes. Connect scopes.
### Run auto tests
Run the following commands to run the tests
```
export TESTUSER_USERNAME=user
export TESTUSER_PASSWORD=secret
export TESTUSER_USERNAME2=user2
export TESTUSER_EMAIL=test@example.net
export ROLE=admin
bash ../../user-panel/utils/create-user.bash $TESTUSER_USERNAME $TESTUSER_PASSWORD $TESTUSER_EMAIL
bash ../../user-panel/utils/create-user.bash $TESTUSER_USERNAME2 RANDOMPW $TESTUSER_EMAIL
bash ../../user-panel/utils/create-application.bash testapplication
bash ../../user-panel/utils/grant-access.bash $TESTUSER_USERNAME testapplication
bash ../../user-panel/utils/create-role.bash $ROLE
bash ../../user-panel/utils/assign-role.bash $TESTUSER_USERNAME $ROLE
python3 -m behave \
-D headless=True \
-D url=http://localhost:13337 \
-D logout_url=http://localhost:5000/logout \
-D userinfo_url=http://localhost:4444/userinfo \
-D username=${TESTUSER_USERNAME} \
-D username2=${TESTUSER_USERNAME2} \
-D password=${TESTUSER_PASSWORD} \
-D email=${TESTUSER_EMAIL} \
-D role=${ROLE}
```
Note: You need to have chromedriver isntalled to run the tests
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment