Skip to content

Commit

Permalink
Merge pull request #32 from icebreakerone/preprod
Browse files Browse the repository at this point in the history
Documentation fixes
  • Loading branch information
kipparker authored Jun 26, 2024
2 parents cff8df6 + e305960 commit 10e218a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ instance/
.mypy_cache/
.env

.env*
.env
.pytest_cache
__pycache__
.DS_Store
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ The resource api is in the [resource](resource) directory. It demonstrates how t

Resource API documentation is available at https://perseus-demo-energy.ib1.org/api-docs.

## Environment variables

Both apps have example `.env.template` files in their root directories. These should be copied to `.env` and edited as required, filling CLIENT_ID and CLIENT_SECRET with the values provided by Ory Hydra, or on request from ib1 for the demo apps.

## Running a dev server

```bash
Expand Down Expand Up @@ -56,8 +60,6 @@ The included docker compose file will bring up both APIs. It uses nginx to proxy
docker-compose up
```

The environment variables in the docker compose file point to the FAPI api running on localhost port 8020 (http://host.docker.internal:8020). As the FAPI api is not running in the docker environment, you may need to change these environment variables to match your local environment. It will also work with the live FAPI api by changing these values to "https://perseus-demo-authentication.ib1.org".

## Pushed Authorization Request (PAR)

As PAR is not available on the Ory Hydra service that this demo is based on, a PAR endpoint has been implemented in this example service. It is expected that production ipmlementations may use the PAR endpoint of their Fapi provider.
Expand Down Expand Up @@ -91,10 +93,10 @@ Code verifier: c6P-FfD0ayLslzCUESCsay8QHEg71O0SnKLeHPkOSyOZ6KubKPRaclM4u5veKcqI7
https://vigorous-heyrovsky-1trvv0ikx9.projects.oryapis.com/oauth2/auth?client_id=f67916ce-de33-4e2f-a8e3-cbd5f6459c30&response_type=code&redirect_uri=http://127.0.0.1:3000/callback&scope=profile+offline_access&state=9mpb2gDwhp2fLTa_MwJGM21R7FjOQCJq&code_challenge=cksXMlSWrcflDTJoyrpiWX0u2VRV6C--pzetmBIo6LQ&code_challenge_method=S256
```

By default the client will use the local docker environment and expects a local instance of the FAPI api to be running on localhost:8020. Testing against the deployed API can be achieved by setting the `AUTHENTICATION_API` and `RESOURCE_API` environment variables, and optionally the FAPI_API environment variable.
By default the client will use the local docker environment and expects instances to be running on ports 8000 (authentication) and 8010 (resource). Testing against other endpoints can be achieved by setting the `AUTHENTICATION_API` and `RESOURCE_API` environment variables, eg. to test against the deployed demo:

```bash
FAPI_API=https://perseus-demo-authentication.ib1.org AUTHENTICATION_API="https://perseus-demo-authentication.ib1.org" RESOURCE_API=https://perseus-demo-energy.ib1.org python -W ignore client.py auth
AUTHENTICATION_API="https://perseus-demo-authentication.ib1.org" RESOURCE_API=https://perseus-demo-energy.ib1.org python -W ignore client.py auth
```

Opening the redirect url will present you with the default Ory Hydra log in/ sign up screen, followed by a consent screen:
Expand Down
6 changes: 6 additions & 0 deletions authentication/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
REDIS_HOST=localhost
OAUTH_URL=https://<ory-supplied-url>
CLIENT_ID=<perseus-client-id>
CLIENT_SECRET=<perseus-client-secret>
REDIRECT_URI=http://127.0.0.1:3000/callback
ISSUER_URL=https://authentication_web
3 changes: 3 additions & 0 deletions resource/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CLIENT_ID=<perseus-client-id>
CLIENT_SECRET=<perseus-client-secret>
ISSUER_URL=https://authentication_web

0 comments on commit 10e218a

Please sign in to comment.