Skip to content

Commit

Permalink
[Security] Remove Identity Plugin (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvigliotta authored Aug 22, 2024
1 parent 872d521 commit 6be4a68
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 160 deletions.
7 changes: 1 addition & 6 deletions src/AMMOSPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ define([
'./taxonomy/plugin',
'./time/plugin',
'services/time/vistaTime',
'./identity/plugin',
'./historical/plugin',
'./realtime/plugin',
'./link/plugin',
Expand Down Expand Up @@ -41,7 +40,6 @@ define([
TaxonomyPlugin,
TimePlugin,
getVistaTime,
IdentityPlugin,
HistoricalTelemetryPlugin,
RealtimeTelemetryPlugin,
LinkPlugin,
Expand Down Expand Up @@ -92,10 +90,7 @@ define([
});
openmct.install(RealtimeIndicatorPlugin.default(vistaTime));

const identityPlugin = new IdentityPlugin(options);
openmct.install(identityPlugin);

mcwsClient.default.configure(options, identityPlugin.login);
mcwsClient.default.configure(options);

openmct.install(MultipleHistoricalSessions.default(options.tablePerformanceOptions));
openmct.install(RealtimeSessions.default());
Expand Down
92 changes: 0 additions & 92 deletions src/identity/LoginService.js

This file was deleted.

18 changes: 0 additions & 18 deletions src/identity/close.html

This file was deleted.

20 changes: 0 additions & 20 deletions src/identity/plugin.js

This file was deleted.

25 changes: 1 addition & 24 deletions src/services/mcws/MCWSClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ class MCWSClient {
this._updatePending = this._updatePending.bind(this);
}

configure(config, login) {
configure(config) {
this.config = config;
this.login = login;
}

proxyRequest(options) {
Expand Down Expand Up @@ -86,35 +85,13 @@ class MCWSClient {
return this.proxyRequest(options);
};

isCamResponse(response) {
const contentType = response?.headers?.['content-type'];

return contentType?.includes('text/html');
}

getResponseType(response) {
// TODO: more nuanced response handling should be done here
if (this.isCamResponse(response)) {
return 'cam';
} else {
return 'unhandled';
}
}

async authorizedRequest(options) {
let response;
const url = options.url;
delete options.url;

try {
response = await this.baseRequest(url, options);
const responseType = this.getResponseType(response);

if (responseType === 'cam') {
await this.login();

response = await this.baseRequest(url, options);
}
} catch(error) {
return Promise.reject(error);
}
Expand Down

0 comments on commit 6be4a68

Please sign in to comment.