Skip to content

Commit

Permalink
Docs/examples: update Keycloak and CDOGS API urls
Browse files Browse the repository at this point in the history
Also:
* Remove urls and ids for hosted CDOGS's Keycloak realm - deployment is now handled via GitHub Actions
* Bump up Node version
  • Loading branch information
norrisng-bc committed Nov 21, 2023
1 parent 306b58a commit 264b299
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This API is defined and described in OpenAPI 3.0 specification.

When the API is running, you should be able to view the specification through ReDoc at <http://localhost:3000/api/v2/docs> (assuming you are running this microservice locally).

The hosted CDOGS API can usually be found at <https://cdogs.nrs.gov.bc.ca/api/v2/docs>.
The hosted CDOGS API can usually be found at <https://cdogs.api.gov.bc.ca/api/v2/docs>.

For more details on using CDOGS and its underlying Carbone library, take a look at the [Usage guide](/app/USAGE.md).

Expand Down Expand Up @@ -62,8 +62,8 @@ The following variables alter CDOGS authentication behavior. By default, if `KC_
| `clientSecret` | `KC_CLIENTSECRET` | | Keycloak client secret for CDOGS |
| `enabled` | `KC_ENABLED` | | Whether to run CDOGS in unauthenticated or Keycloak protected mode |
| `publicKey` | `KC_PUBLICKEY` | | If specified, verify all incoming JWT signatures off of the provided public key |
| `realm` | `KC_REALM` | `jbd6rnxw` | Keycloak realm for CDOGS |
| `serverUrl` | `KC_SERVERURL` | `https://dev.oidc.gov.bc.ca/auth` | Keycloak server url for CDOGS authentication |
| `realm` | `KC_REALM` | | Keycloak realm for CDOGS |
| `serverUrl` | `KC_SERVERURL` | | Keycloak server url for CDOGS authentication |

### Server Variables

Expand Down Expand Up @@ -107,7 +107,7 @@ For more dedicated deployments of CDOGS in a Docker environment, make sure to co

### Local Machine

This section assumes you have a recent version of Node.js (12.x or higher) and LibreOffice™ (6.3.4.x or higher) installed. Make sure to have an understanding of what environment variables are passed into the application before proceeding.
This section assumes you have a recent version of Node.js (16.x or higher) and LibreOffice™ (6.3.4.x or higher) installed. Make sure to have an understanding of what environment variables are passed into the application before proceeding.

#### Configuration

Expand Down
2 changes: 1 addition & 1 deletion app/src/docs/v2.api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ components:
OpenID:
type: openIdConnect
openIdConnectUrl: >-
https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/.well-known/openid-configuration
https://loginproxy.gov.bc.ca/auth/realms/your-realm-name/.well-known/openid-configuration
schemas:
BadRequest:
allOf:
Expand Down
6 changes: 3 additions & 3 deletions examples/01-authenticated.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#! /usr/bin/env bash

# Retrieve a valid bearer token from oidc.
# Retrieve a valid bearer token from keycloak.
token=$(curl --request POST \
--url 'https://dev.oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
--url 'https://dev.loginproxy.gov.bc.ca/auth/realms/your-realm-name/protocol/openid-connect/token' \
-H 'content-type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id="$CLIENT_ID" \
Expand All @@ -13,7 +13,7 @@ base64_encoded_template=$(base64 -i template.txt)

# This sends data to CDOGS so that our template.txt can be rendered out to file test.pdf.
curl --request POST \
--url 'https://cdogs-dev.apps.silver.devops.gov.bc.ca/api/v2/template/render' \
--url 'https://cdogs-dev.api.gov.bc.ca/api/v2/template/render' \
-H "Authorization: Bearer $token" \
-H 'content-type: application/json' \
-o 'test.pdf' \
Expand Down
3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Example usage of CDOGS

If you would like to use the KeyCloak Realm `jbd6rnxw` hosted by the Common Services Team (as used by this token endpoint `https://dev.oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token`), you can request client setup with [GETOK](https://getok.nrs.gov.bc.ca/app/about)
If you would like to use the same Keycloak Realm as our hosted service
(`comsvcauth`, as used by this token endpoint `https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token`), you can request client setup through [the API Services Portal](https://api.gov.bc.ca/devportal/api-directory/3181).

## Node

Expand Down
4 changes: 2 additions & 2 deletions examples/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function base64_encode(file) {

// We need the oidc api to generate a token for us
const oidcResponse = await fetch(
'https://dev.oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token',
'https://dev.loginproxy.gov.bc.ca/auth/realms/your-realm-name/protocol/openid-connect/token',
{
method: 'POST',
body: `grant_type=client_credentials&client_id=${client_id}&client_secret=${client_secret}`,
Expand Down Expand Up @@ -40,7 +40,7 @@ const templateContent = base64_encode('./template.txt');
// Hello {d.firstName} {d.lastName}!

const cdogsResponse = await fetch(
'https://cdogs-dev.apps.silver.devops.gov.bc.ca/api/v2/template/render',
'https://cdogs-dev.api.gov.bc.ca/api/v2/template/render',
{
method: 'POST',
body: JSON.stringify({
Expand Down

0 comments on commit 264b299

Please sign in to comment.