read OIDC config from env

This commit is contained in:
Markus Thielen 2023-11-01 17:54:55 +01:00
parent 38c5f2f67e
commit 6bc2e95015
2 changed files with 10 additions and 11 deletions

View File

@ -97,10 +97,6 @@ This will install the client app's dependencies.
You can setup and use your own OpenID Connect server; if you do so, you also have to update the config files `bbconf/broker-config.toml` and `bbconf/dbroxy-config.toml` accordingly.
If you just want to try things out, you are welcome to use our development Keycloak server. The config files are already setup to use it. There is a test user named `tester`, the password is `rantanplan`.
We have an extra page in our documentation dedicated to [Authorization](https://docs.basebox.io/guide/authorization/).
## Run
### Start dbproxy

View File

@ -9,14 +9,17 @@
import { Log, UserManager, WebStorageStateStore } from 'oidc-client-ts';
Log.logger = console;
Log.level = (process.env.NODE_ENV === 'production') ? Log.ERROR : Log.DEBUG;
Log.level = (import.meta.env.PROD) ? Log.ERROR : Log.DEBUG;
/* OpenID Connect Config */
const oidcProviderDomain = 'https://basebox-test-1.eu.auth0.com';
const clientId = '5wl8hQV1thh07rScSoJ3aN56ETuXWprg';
const clientSecret = 'QlHMvIffKLRviCcSu_bPQcf8e4dc6WeS3BwZE1r1F-9R30AFoeYEwaOazAuFenI5';
const scopes = "openid profile email name nickname";
export const callbackPath = "/auth/callback"
/**
* OpenID Connect Config
* Fields can be overridden by environment variables. All variables start with a VITE_BB_OIDC_ prefix.
*/
const oidcProviderDomain = import.meta.env.VITE_BB_OIDC_DOMAIN || 'https://basebox-test-1.eu.auth0.com';
const clientId = import.meta.env.VITE_BB_OIDC_CLIENT_ID || '5wl8hQV1thh07rScSoJ3aN56ETuXWprg';
const clientSecret = import.meta.env.VITE_BB_OIDC_SECRET || 'QlHMvIffKLRviCcSu_bPQcf8e4dc6WeS3BwZE1r1F-9R30AFoeYEwaOazAuFenI5';
const scopes = import.meta.env.VITE_BB_OIDC_SCOPES || "openid profile email name nickname";
export const callbackPath = import.meta.env.VITE_BB_OIDC_CALLBACK_PATH || "/auth/callback"
/* OIDC UserManager singleton */
let userMgr = null;