Skip to content

Commit c321f50

Browse files
maxceemVikas Agarwal
authored and
Vikas Agarwal
committed
fully removed system user token usage
1 parent 5a9cd64 commit c321f50

File tree

5 files changed

+2
-24
lines changed

5 files changed

+2
-24
lines changed

config/custom-environment-variables.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
"fileServiceEndpoint": "FILE_SERVICE_ENDPOINT",
2323
"identityServiceEndpoint": "IDENTITY_SERVICE_ENDPOINT",
2424
"memberServiceEndpoint": "MEMBER_SERVICE_ENDPOINT",
25-
"systemUserClientId": "SYSTEM_USER_CLIENT_ID",
26-
"systemUserClientSecret": "SYSTEM_USER_CLIENT_SECRET",
2725
"connectProjectsUrl": "CONNECT_PROJECTS_URL",
2826
"dbConfig": {
2927
"masterUrl": "DB_MASTER_URL",

config/default.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
"timelineIndexName": "timelines",
2626
"timelineDocType": "timelineV4"
2727
},
28-
"systemUserClientId": "",
29-
"systemUserClientSecret": "",
3028
"connectProjectUrl":"",
3129
"dbConfig": {
3230
"masterUrl": "",

src/events/projectMembers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const projectMemberAddedHandler = Promise.coroutine(function* a(logger, msg, cha
4848
// add copilot/update manager permissions operation promise
4949
const directProjectId = yield models.Project.getDirectProjectId(projectId);
5050
if (directProjectId) {
51-
const token = yield util.getSystemUserToken(logger);
51+
const token = yield util.getM2MToken();
5252
const req = {
5353
id: origRequestId,
5454
log: logger,
@@ -119,7 +119,7 @@ const projectMemberRemovedHandler = Promise.coroutine(function* (logger, msg, ch
119119
if (_.indexOf([PROJECT_MEMBER_ROLE.COPILOT, PROJECT_MEMBER_ROLE.MANAGER], member.role) > -1) {
120120
const directProjectId = yield models.Project.getDirectProjectId(projectId);
121121
if (directProjectId) {
122-
const token = yield util.getSystemUserToken(logger);
122+
const token = yield util.getM2MToken();
123123
const req = {
124124
id: origRequestId,
125125
log: logger,

src/services/messageService.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ async function getClient(logger) {
6565
function createTopic(topic, logger) {
6666
logger.debug(`createTopic for topic: ${JSON.stringify(topic)}`);
6767
return getClient(logger).then((msgClient) => {
68-
// return util.getSystemUserToken(logger).then((adminToken) => {
6968
logger.debug('calling message service');
7069
return msgClient.post('/topics/create', topic)
71-
// const httpClient = util.getHttpClient({ id: `topic#create#${topic.referenceId}`, log: logger });
72-
// httpClient.defaults.headers.common.Authorization = `Bearer ${adminToken}`;
73-
// return httpClient.post(`${config.get('messageApiUrl')}/topics/create`, topic)
7470
.then((resp) => {
7571
logger.debug('Topic created successfully');
7672
logger.debug(`Topic created successfully [status]: ${resp.status}`);

src/util.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,6 @@ _.assignIn(util, {
261261
});
262262
},
263263

264-
getSystemUserToken: (logger, id = 'system') => {
265-
const httpClient = util.getHttpClient({ id, log: logger });
266-
const url = `${config.get('identityServiceEndpoint')}authorizations`;
267-
const formData = `clientId=${config.get('systemUserClientId')}&` +
268-
`secret=${encodeURIComponent(config.get('systemUserClientSecret'))}`;
269-
return httpClient.post(url, formData,
270-
{
271-
timeout: 4000,
272-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
273-
},
274-
)
275-
.then(res => res.data.result.content.token);
276-
},
277-
278264
/**
279265
* Get machine to machine token.
280266
* @returns {Promise} promise which resolves to the m2m token

0 commit comments

Comments
 (0)