Skip to content

Commit

Permalink
Merge pull request #7 from learningequality/kolibri-0.16x-compatibility
Browse files Browse the repository at this point in the history
Tests with kolibri 0.16
  • Loading branch information
jredrejo authored Oct 22, 2023
2 parents a9a359f + 731533c commit 5a7276e
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions provider-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,33 @@ For this example, Kolibri will have its home at `/tmp/provider` for the OIDC pr



## Provider configuration steps


IMPORTANT: For all the steps below you'll want to set your `KOLIBRI_HOME` to an alternate location so you can have another Kolibri running in parallel. This could be e.g. `/tmp/provider` or `~/.kolibri-oidc-provider`


## Provider configuration steps:

1. `pip install kolibri-oidc-provider-plugin`

2. `kolibri plugin enable kolibri_oidc_provider_plugin`
2. `KOLIBRI_HOME=/tmp/provider kolibri plugin enable kolibri_oidc_provider_plugin`

3. `kolibri manage migrate`
3. `KOLIBRI_HOME=/tmp/provider kolibri manage migrate`

4. `kolibri manage creatersakey`
4. `KOLIBRI_HOME=/tmp/provider kolibri manage creatersakey`

5. Let's create an authorized client:

`kolibri manage oidccreateclient --name=myapp --clientid=myclient.app --redirect-uri="http://127.0.0.1:9000/oidccallback/"`
`KOLIBRI_HOME=/tmp/provider kolibri manage oidccreateclient --name=myapp --clientid=myclient.app --redirect-uri="http://127.0.0.1:9000/oidccallback/"`

It will output a client secret code that must be used when configuring the client, replacing the `<secret_given_by_the_provider>` text below.

6. `yarn run build` to build assets

7. Start Kolibri with `kolibri start --foreground`, go through the wizard and create at least one user. Ensure to logout afterwards.

8. As a check, open this url in the browser: http://localhost:8080/.well-known/openid-configuration . It should show all the available OIDC endpoints.
6. Start Kolibri with `KOLIBRI_HOME=/tmp/provider kolibri start --foreground`, go through the wizard and create at least one user. Ensure to logout afterwards.

## Client configuration steps
7. As a check, open this url in the browser: http://localhost:8080/.well-known/openid-configuration . It should show all the available OIDC endpoints.

Here you'll need to set `KOLIBRI_HOME` to something different, e.g. `/tmp/client` or `~/.kolibri-oidc-client`.

You'll also need to set these environment variables:

```
CLIENT_ID=myclient.app
CLIENT_SECRET=<secret_given_by_the_provider>
KOLIBRI_OIDC_CLIENT_URL=http://localhost:8080/oidc_provider
KOLIBRI_HTTP_PORT=9000 # need a different port from the provider
```
## Client configuration steps:

1. `pip install kolibri-oidc-client-plugin`
2. `kolibri plugin enable kolibri_oidc_client_plugin`
3. Start Kolibri with `kolibri start --foreground`
2. `KOLIBRI_HOME=/tmp/client kolibri plugin enable kolibri_oidc_client_plugin`
3. Start Kolibri with `KOLIBRI_HOME=/tmp/client CLIENT_ID=myclient.app CLIENT_SECRET=<secret_given_by_the_provider> KOLIBRI_OIDC_PROVIDER_URL=http://localhost:8080/oidc_provider KOLIBRI_OIDC_CLIENT_URL=http://127.0.0.1:9000 KOLIBRI_HTTP_PORT=9000 kolibri start --foreground`
4. Open a browser in http://127.0.0.1:9000 and use the OIDC authentication button: it should connect to the provider server (check the urls jump to the urls with port 8080). **It's important to use *127.0.0.1* and not *localhost* in the url to avoid a cookies conflict if the provider has been open in the browser.**
5. Signing in with the user that has been created in the provider should be possible and it will appear as an user in the kolibri client server

0 comments on commit 5a7276e

Please sign in to comment.