services: fix oidc usage
This commit is contained in:
+9
-9
@@ -1801,7 +1801,7 @@ async function setupProxyAuth(app, options) {
|
||||
debug('Creating OpenID client for proxyAuth');
|
||||
|
||||
// openid client_id is appId for now
|
||||
const [error, result] = await safe(oidc.clients.get(app.id));
|
||||
const [error, result] = await safe(oidc.getClient(app.id));
|
||||
if (error) throw error;
|
||||
|
||||
// ensure we keep the secret
|
||||
@@ -1814,8 +1814,8 @@ async function setupProxyAuth(app, options) {
|
||||
appId: app.id
|
||||
};
|
||||
|
||||
if (result) await oidc.clients.update(app.id, data);
|
||||
else await oidc.clients.add(app.id, data);
|
||||
if (result) await oidc.updateClient(app.id, data);
|
||||
else await oidc.addClient(app.id, data);
|
||||
}
|
||||
|
||||
async function teardownProxyAuth(app, options) {
|
||||
@@ -1826,7 +1826,7 @@ async function teardownProxyAuth(app, options) {
|
||||
|
||||
debug('Deleting OpenID client for proxyAuth');
|
||||
|
||||
const [error] = await safe(oidc.clients.del(app.id));
|
||||
const [error] = await safe(oidc.delClient(app.id));
|
||||
if (error && error.reason !== BoxError.NOT_FOUND) throw error;
|
||||
}
|
||||
|
||||
@@ -2118,7 +2118,7 @@ async function setupOidc(app, options) {
|
||||
debug('Setting up OpenID connect');
|
||||
|
||||
// openid client_id is appId for now
|
||||
const [error, result] = await safe(oidc.clients.get(app.id));
|
||||
const [error, result] = await safe(oidc.getClient(app.id));
|
||||
if (error) throw error;
|
||||
|
||||
// ensure we keep the secret
|
||||
@@ -2131,8 +2131,8 @@ async function setupOidc(app, options) {
|
||||
appId: app.id
|
||||
};
|
||||
|
||||
if (result) await oidc.clients.update(app.id, data);
|
||||
else await oidc.clients.add(app.id, data);
|
||||
if (result) await oidc.updateClient(app.id, data);
|
||||
else await oidc.addClient(app.id, data);
|
||||
}
|
||||
|
||||
async function teardownOidc(app, options) {
|
||||
@@ -2141,7 +2141,7 @@ async function teardownOidc(app, options) {
|
||||
|
||||
debug('Tearing down OpenID connect');
|
||||
|
||||
const [error] = await safe(oidc.clients.del(app.id));
|
||||
const [error] = await safe(oidc.delClient(app.id));
|
||||
if (error && error.reason !== BoxError.NOT_FOUND) throw error;
|
||||
}
|
||||
|
||||
@@ -2153,7 +2153,7 @@ async function getDynamicEnvironmentOidc(app, options) {
|
||||
|
||||
if (!app.sso) return {};
|
||||
|
||||
const client = await oidc.clients.get(app.id);
|
||||
const client = await oidc.getClient(app.id);
|
||||
if (!client) throw new BoxError(BoxError.NOT_FOUND, `OIDC client for ${app.id} has not been allocated yet`); // happens with overzealous scheduler logic
|
||||
|
||||
const tmp = {};
|
||||
|
||||
Reference in New Issue
Block a user