Skip to content

Commit

Permalink
chore: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nsklikas committed Dec 15, 2023
1 parent 71eb388 commit 98e18f8
Showing 1 changed file with 32 additions and 9 deletions.
41 changes: 32 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,55 @@ docker run -p 8080:8080 -it --name login-ui --rm localhost:32000/identity-platfo

## Development setup

As a requirement, please make sure to have `docker` and `docker-compose` installed as well as a set of client credentials for AzureAD.
As a requirement, please make sure to have `docker` and `docker-compose` installed.

Create a file called `.env` on the root of the repository and paste your client credentials:
You need to have a registered Github OAuth application to use for logging in.
To register a Github OAuth application:
1) Go to https://github.com/settings/applications/new. The application name and homepage URL do not matter, but the Authorization callback URL must be `http://localhost:4433/self-service/methods/oidc/callback/github`.
2) Generate a client secret
3) Create a file called `.env` on the root of the repository and paste your client credentials:

```
```text
CLIENT_ID=<client_id>
CLIENT_SECRET=<client_secret>
MICROSOFT_TENANT=<tenant_id>
```

We are going to use docker-compose to run Kratos, Hydra and OpenFGA:
Run the login UI's dependencies:

```console
docker-compose -f docker-compose.dev.yml up -- build --force-recreate
```

Now we can run the UI:
Run the Login UI:
```console
export KRATOS_PUBLIC_URL=http://localhost:4433
export HYDRA_ADMIN_URL=http://localhost:4445
export BASE_URL=http://localhost:4455
export PORT=4455
export TRACING_ENABLED=false
export LOG_LEVEL=debug
export OPENFGA_API_SCHEME=http
export OPENFGA_API_HOST=localhost:8080
export OPENFGA_STORE_ID=01GP1254CHWJC1MNGVB0WDG1T0
export AUTHORIZATION_ENABLED=false
go run cmd/main.go
```

To test the authorizatoin code flow you can use the Ory Hydra CLI:

> To install the Ory Hydra CLI follow the instruction at https://www.ory.sh/docs/hydra/self-hosted/install.
```console
code_client=$(hydra create client \
--endpoint http://localhost:4445 \
--name grafana \
--grant-type authorization_code,refresh_token \
--response-type code \
--format json \
--scope openid,offline_access,email,profile \
--redirect-uri http://127.0.0.1:4446/callback \
--audience app_client \
)
hydra perform authorization-code \
--endpoint http://localhost:4444 \
--client-id `echo "$code_client" | yq .client_id` \
--client-secret `echo "$code_client" | yq .client_secret` \
--scope openid,profile,email,offline_access
```

0 comments on commit 98e18f8

Please sign in to comment.