Skip to content

Commit e83c39c

Browse files
committed
Feedback Marco Rorro
1 parent a1824e3 commit e83c39c

File tree

1 file changed

+25
-58
lines changed

1 file changed

+25
-58
lines changed

docs/hosting/authentication.md

Lines changed: 25 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,75 +19,42 @@ As well as the `openid_connect_url` in `./src/config.override.toml` (for authent
1919
openid_connect_url = "https://auth.aiod.eu/aiod-auth/realms/aiod/.well-known/openid-configuration"
2020
```
2121

22-
## Hosting and External Identity Providers
22+
## Using External Identity Providers
2323

24-
Using external identity providers locally is hard.
25-
The problem is that the dockerized API thinks that the keycloak is located at host `keycloak` (the name of the keycloak docker container),
26-
while our keycloak console thinks that it's hosted at `localhost`. This is a problem for the authentication.
27-
The url of the keycloak is embedded in the token (the `iss` field),
28-
and must be the same as the url that the API uses, otherwise the API cannot authenticate the user.
29-
But when accessing e.g., the Google Identity Provider, Google requires the redirect-url to be localhost.
24+
There are two ways to integrate external identity providers (e.g. Google, [EGI Check-in](https://docs.egi.eu/users/aai/check-in/)).
3025

26+
Create both a private and a public client in the external provider (this step is required for both options below).
27+
28+
### Option 1: Update the configuration files
29+
- Replace `KEYCLOAK_CLIENT_SECRET` in `.env.override` with the value provided by the external IdP.
30+
- Update `server_url`, `client_idr`, `client_id_swagger` `openid_connect_url` and `scopes` in `./src/config.override.toml`.
31+
- In this setup, the Keycloak container is not required and can be shut down.
32+
### Option 2: use keycloak as an identity broker
33+
- Details can be found in the Keycloak documentation: [Integrating identity providers](https://www.keycloak.org/docs/latest/server_admin/index.html#_identity_broker).
34+
- This method allows to configure multiple IdPs.
35+
3136
[//]: # (Should include information on how to run it locally then...)
3237

3338
## Roles
3439

35-
The table below gives an overview of the different roles which are used in AI-on-Demand:
36-
37-
| Role | Comment |
38-
|---------------------|-----------------------------------------------|
39-
| edit_aiod_resources | Allows the user to upload and edit resources. |
40-
| default-roles-aiod | ??? |
41-
| offline_access | ??? |
42-
| uma_authorization | ??? |
43-
44-
Note that some roles may be used for services other than the metadata catalogue.
40+
Roles identify a type or category of user and determine their access and permissions within applications.
41+
Currently, only the ` edit_aiod_resources` role is defined, granting users the ability to upload and edit resources.
42+
Note that roles may be used for services other than the metadata catalogue.
4543

4644
[//]: # ( Are we missing roles? Check admin console. Are all roles still relevant? delete if not)
4745

4846
## Verifying Keycloak is Working
4947

50-
=== "Swagger"
51-
52-
To verify the Keycloak service is configured correctly (in production),
53-
- Go to http://localhost:8000/docs in your favourite browser
54-
- Go to `/authorization_test`, click on `try it out` and `execute`. You should get an `Error: Unauthorized`
55-
- Log in
56-
- using `Authorize` button in the top right
57-
- Use `OpenIdConnect (OAuth2, authorization_code with PKCE)`
58-
- click `Authorize`
59-
- Use any identity provider.
60-
- Go to `/authorization_test`, click on `try it out` and `execute`.
61-
62-
=== "Postman"
63-
64-
!!! warning
65-
66-
Instructions for Postman not updated.
48+
To verify the Keycloak service is configured correctly using the Swagger interface, follows these steps:
6749

68-
If you edit a collection, you can use OAuth 2.0 authorization. See image:
50+
1. Open your browser and go to `http://$HOSTNAME`
51+
2. Go to `/authorization_test`, click on `try it out` and `execute`.
52+
- You should get an `Error: Unauthorized`
53+
3. Log in:
54+
- Click the `Authorize` button in the top-right corner.
55+
- Select `OpenIdConnect (OAuth2, authorization_code with PKCE)`.
56+
- Click `Authorize` and log in using any available identity provider.
57+
4. Return to `/authorization_test`, click `try it out` and then `execute` again.
6958

70-
![Postman Authentication](../media/postman_authentication.png)
71-
72-
- As `auth url`, use https://test.openml.org/aiod-auth/realms/dev/protocol/openid-connect/auth
73-
- As `Access token url`, use https://test.openml.org/aiod-auth/realms/dev/protocol/openid-connect/token
74-
- As `client id`, use `aiod-api`
75-
- As `client secret`, use `7qpbFTGpONBPIn9nBovgd2843BK8Khjg`
76-
77-
Then, you should be able to send a `GET` to `localhost:8000/authorization_test`.
78-
79-
80-
A successful response to the `/authorization_test` endpoints should result in a response like:
81-
82-
```json
83-
{
84-
"name": "user",
85-
"roles": [
86-
"edit_aiod_resources",
87-
"default-roles-aiod",
88-
"offline_access",
89-
"uma_authorization"
90-
]
91-
}
92-
```
59+
If authentication is succesful, the request should now be authtorised.
9360

0 commit comments

Comments
 (0)