Compare commits

...

2 Commits

Author SHA1 Message Date
6c19409567 Get variables from env 2023-04-13 22:38:35 +03:00
f0bce986f1 Add deployment.yaml to .dockerignore 2023-04-13 22:38:09 +03:00
3 changed files with 12 additions and 5 deletions

View File

@ -5,6 +5,7 @@ README.md
.git/
node_modules/
.drone.yml
deployment.yaml
# Editor directories and files
.vscode/*

10
app.js
View File

@ -7,12 +7,12 @@ async function run() {
app.use(bodyParser.urlencoded());
app.use(bodyParser.json())
const issuer = await Issuer.discover('https://gateway-gab7y.codemowers.ee/');
const issuer = await Issuer.discover(process.env.OIDC_GATEWAY_URI);
console.log('Discovered issuer %s %O', issuer.issuer, issuer.metadata);
const client = new issuer.Client({
client_id: 'foo',
redirect_uris: ['https://client-gab7y.codemowers.ee/cb'],
client_id: process.env.OIDC_CLIENT_ID,
redirect_uris: [process.env.OIDC_REDIRECT_URIS],
response_types: ['id_token'],
// id_token_signed_response_alg (default "RS256")
})
@ -20,7 +20,7 @@ async function run() {
app.get('/', async function (req, res) {
let url = client.authorizationUrl({
redirect_uri: 'https://client-gab7y.codemowers.ee/cb',
redirect_uri: process.env.CLIENT_URL + '/cb',
scope: 'openid',
response_mode: 'form_post',
nonce,
@ -30,7 +30,7 @@ async function run() {
});
app.post('/cb', async function (req, res) {
const params = client.callbackParams(req);
const tokenSet = await client.callback('https://client-gab7y.codemowers.ee/ok', params, {nonce});
const tokenSet = await client.callback(process.env.CLIENT_URL + '/cb', params, {nonce});
console.log('received and validated tokens %j', tokenSet);
console.log('validated ID Token claims %j', tokenSet.claims());
res.send(tokenSet.claims());

View File

@ -58,3 +58,9 @@ spec:
image: oidc-test-client
ports:
- containerPort: 3000
env:
- name: CLIENT_URL
value: https://client-gab7y.codemowers.ee
envFrom:
- secretRef:
name: oidc-client-implicit-id-token-sample-client-owner-secrets