matlab-proxy 0.15.1__tar.gz → 0.17.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {matlab-proxy-0.15.1/matlab_proxy.egg-info → matlab-proxy-0.17.0}/PKG-INFO +1 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/actionCreators/index.js +2 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/App.spec.js +12 -11
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/index.js +20 -3
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/constants.js +1 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/app.py +33 -17
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/app_state.py +90 -6
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/constants.py +1 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/settings.py +7 -4
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/token_auth.py +19 -5
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0/matlab_proxy.egg-info}/PKG-INFO +1 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/setup.py +1 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_with_license/test_http_end_points.py +4 -4
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_without_license/conftest.py +4 -3
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_app.py +15 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_app_state.py +86 -4
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_constants.py +2 -1
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/test_token_auth.py +23 -9
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/LICENSE.md +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/MANIFEST.in +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/README.md +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/.eslintrc.json +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/.gitignore +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/README.md +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/package-lock.json +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/package.json +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/public/favicon.ico +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/public/index.html +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/public/manifest.json +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/public/robots.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/actionCreators/actionCreators.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/actions/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/css/bootstrap.min.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/css/site7.min.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/glyphicons-halflings-regular.eot +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/glyphicons-halflings-regular.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/glyphicons-halflings-regular.ttf +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/glyphicons-halflings-regular.woff +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/glyphicons-halflings-regular.woff2 +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-eps.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-eps.ttf +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-eps.woff +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-pictograms.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-pictograms.ttf +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks-pictograms.woff +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks.ttf +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/fonts/mathworks.woff +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/bug_reports/workaround.gif +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/responsive/global/ico-header-account-hover.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/responsive/global/ico-header-account.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/responsive/global/ico-header-contact-hover.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/responsive/global/ico-header-contact.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/3p/images/responsive/global/ico-sprite.png +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/App.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/App/MATLAB-env-blur.png +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Confirmation/Confirmation.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Confirmation/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/Controls.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/Controls.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/feedback.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/help.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/restart.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/sign-out.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/start.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/stop.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Controls/terminate.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/EntitlementSelector/EntitlementSelector.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/EntitlementSelector/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Error/Error.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Error/Error.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Error/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Help/Help.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Help/Help.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Help/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Information/Information.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Information/Information.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Information/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/ExistingLicense.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/ExistingLicense.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/LicenseGatherer.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/LicensingGatherer.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/MHLM.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/NLM.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/LicensingGatherer/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/MatlabJsd/MatlabJsd.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/MatlabJsd/MatlabJsd.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/MatlabJsd/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Overlay/Overlay.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Overlay/Overlay.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/Overlay/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/OverlayTrigger.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/OverlayTrigger.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/ResizeOverlayTrigger.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/arrow.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/gripper.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/trigger-error.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/components/OverlayTrigger/trigger-ok.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/index.css +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/jest.config.json +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/logo.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/reducers/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/reducers/reducers.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/selectors/index.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/selectors/selectors.spec.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/serviceWorker.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/setupTests.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/test/utils/react-test.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/gui/src/test/utils/state.js +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/default_configuration.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/devel.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/icons/matlab.svg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/matlab/startup.m +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/event_loop.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/list_servers.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mw.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/custom_http_headers.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/download.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/embedded_connector/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/embedded_connector/helpers.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/embedded_connector/request.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/environment_variables.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/exceptions.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/logger.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/mwi/validators.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/system.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy/util/windows.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/SOURCES.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/dependency_links.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/entry_points.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/not-zip-safe +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/requires.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/matlab_proxy.egg-info/top_level.txt +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/setup.cfg +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_with_license/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_with_license/conftest.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_without_license/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/integration_tests_without_license/test_matlab_is_down_if_unlicensed.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/utils/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/utils/integration_tests_utils.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/integration/utils/licensing.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/conftest.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_ddux.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_devel.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_non_dev_mode.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/test_settings.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/embedded_connector/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/embedded_connector/test_helpers.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/embedded_connector/test_request.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/test_custom_http_headers.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/test_logger.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/mwi/test_validators.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/test_mw.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/unit/util/test_util.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/utils/__init__.py +0 -0
- {matlab-proxy-0.15.1 → matlab-proxy-0.17.0}/tests/utils/logging_util.py +0 -0
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
selectIsAuthenticated
|
|
36
36
|
} from '../selectors';
|
|
37
37
|
import sha256 from 'crypto-js/sha256';
|
|
38
|
+
import { MWI_AUTH_TOKEN_NAME_FOR_HTTP } from '../constants';
|
|
38
39
|
|
|
39
40
|
export function setAuthStatus (authentication) {
|
|
40
41
|
return {
|
|
@@ -296,7 +297,7 @@ export function updateAuthStatus (token) {
|
|
|
296
297
|
const options = {
|
|
297
298
|
method: 'POST',
|
|
298
299
|
headers: {
|
|
299
|
-
|
|
300
|
+
[MWI_AUTH_TOKEN_NAME_FOR_HTTP]: tokenHash
|
|
300
301
|
}
|
|
301
302
|
};
|
|
302
303
|
const response = await fetchWithTimeout(dispatch, './authenticate', options, 15000);
|
|
@@ -7,6 +7,7 @@ import App from './index';
|
|
|
7
7
|
import * as actionCreators from '../../actionCreators';
|
|
8
8
|
import state from '../../test/utils/state';
|
|
9
9
|
import { MAX_REQUEST_FAIL_COUNT } from '../../constants';
|
|
10
|
+
import { MWI_AUTH_TOKEN_NAME_FOR_HTTP } from '../../constants';
|
|
10
11
|
|
|
11
12
|
const _ = require('lodash');
|
|
12
13
|
|
|
@@ -47,7 +48,7 @@ describe('App Component', () => {
|
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
it('should render overlayTrigger (after closing the tutorial)', () => {
|
|
50
|
-
|
|
51
|
+
// Hide the tutorial before rendering the component.
|
|
51
52
|
initialState.tutorialHidden = true;
|
|
52
53
|
initialState.overlayVisibility = false;
|
|
53
54
|
|
|
@@ -64,7 +65,7 @@ describe('App Component', () => {
|
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
it('should render LicensingGatherer component within the App component when no licensing is provided and user is authenticated', () => {
|
|
67
|
-
|
|
68
|
+
// Set licensingInfo to empty object.
|
|
68
69
|
initialState.overlayVisibility = true;
|
|
69
70
|
initialState.serverStatus.licensingInfo = {};
|
|
70
71
|
initialState.authentication.enabled = true;
|
|
@@ -79,7 +80,7 @@ describe('App Component', () => {
|
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
it('should render LicensingGatherer component within the App component when no licensing is provided and authentication is disabled', () => {
|
|
82
|
-
|
|
83
|
+
// Set licensingInfo to empty object.
|
|
83
84
|
initialState.overlayVisibility = true;
|
|
84
85
|
initialState.serverStatus.licensingInfo = {};
|
|
85
86
|
initialState.authentication.enabled = false;
|
|
@@ -93,7 +94,7 @@ describe('App Component', () => {
|
|
|
93
94
|
});
|
|
94
95
|
|
|
95
96
|
it('should render Information Component within App Component after licensing is provided and user is authenticated', () => {
|
|
96
|
-
|
|
97
|
+
// Hide the tutorial and make the overlay visible.
|
|
97
98
|
initialState.tutorialHidden = true;
|
|
98
99
|
initialState.overlayVisibility = true;
|
|
99
100
|
|
|
@@ -112,7 +113,7 @@ describe('App Component', () => {
|
|
|
112
113
|
});
|
|
113
114
|
|
|
114
115
|
it('should render Information Component within App Component after licensing is provided and auth is not enabled', () => {
|
|
115
|
-
|
|
116
|
+
// Hide the tutorial and make the overlay visible.
|
|
116
117
|
initialState.tutorialHidden = true;
|
|
117
118
|
initialState.overlayVisibility = true;
|
|
118
119
|
|
|
@@ -131,7 +132,7 @@ describe('App Component', () => {
|
|
|
131
132
|
});
|
|
132
133
|
|
|
133
134
|
it('should display integration terminated error', () => {
|
|
134
|
-
|
|
135
|
+
// Hide the tutorial, make the overlay visible and set fetchFailCount to MAX_REQUEST_FAIL_COUNT
|
|
135
136
|
initialState.tutorialHidden = true;
|
|
136
137
|
initialState.overlayVisibility = true;
|
|
137
138
|
initialState.serverStatus.fetchFailCount = MAX_REQUEST_FAIL_COUNT;
|
|
@@ -173,7 +174,7 @@ describe('App Component', () => {
|
|
|
173
174
|
});
|
|
174
175
|
|
|
175
176
|
it('should display Confirmation component ', () => {
|
|
176
|
-
|
|
177
|
+
// Hide the tutorial and make the overlay visible
|
|
177
178
|
initialState.tutorialHidden = true;
|
|
178
179
|
initialState.overlayVisibility = true;
|
|
179
180
|
|
|
@@ -196,7 +197,7 @@ describe('App Component', () => {
|
|
|
196
197
|
});
|
|
197
198
|
|
|
198
199
|
it('should display Help Component', () => {
|
|
199
|
-
|
|
200
|
+
// Hide the tutorial and make the overlay visible
|
|
200
201
|
initialState.tutorialHidden = true;
|
|
201
202
|
initialState.overlayVisibility = true;
|
|
202
203
|
|
|
@@ -230,9 +231,9 @@ describe('App Component', () => {
|
|
|
230
231
|
|
|
231
232
|
const tokenInQuery = '12345';
|
|
232
233
|
it.each([
|
|
233
|
-
[
|
|
234
|
-
[`?test1=1
|
|
235
|
-
[`?test1=1&test2=2
|
|
234
|
+
[`?${MWI_AUTH_TOKEN_NAME_FOR_HTTP}=${tokenInQuery}&test1=1&test2=2`, tokenInQuery],
|
|
235
|
+
[`?test1=1&${MWI_AUTH_TOKEN_NAME_FOR_HTTP}=${tokenInQuery}&test2=2`, tokenInQuery],
|
|
236
|
+
[`?test1=1&test2=2&${MWI_AUTH_TOKEN_NAME_FOR_HTTP}=${tokenInQuery}`, tokenInQuery]
|
|
236
237
|
])("should pick the token correctly when the query parameters are '%s'", (queryParams, expectedToken) => {
|
|
237
238
|
const url = 'http://localhost.com:5555';
|
|
238
239
|
const mockUpdateAuthStatus = jest.spyOn(actionCreators, 'updateAuthStatus');
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
} from '../../actionCreators';
|
|
44
44
|
import blurredBackground from './MATLAB-env-blur.png';
|
|
45
45
|
import EntitlementSelector from '../EntitlementSelector';
|
|
46
|
+
import { MWI_AUTH_TOKEN_NAME_FOR_HTTP } from '../../constants';
|
|
46
47
|
|
|
47
48
|
function App () {
|
|
48
49
|
const dispatch = useDispatch();
|
|
@@ -165,15 +166,31 @@ function App () {
|
|
|
165
166
|
cancel={endSession}
|
|
166
167
|
title='MATLAB is currently open in another window'
|
|
167
168
|
cancelButton={wasEverActive ? ('Cancel') : ('Continue in existing window')}
|
|
168
|
-
confirmButton
|
|
169
|
+
confirmButton={wasEverActive ? ('Confirm') : ('Continue in this window')}>
|
|
169
170
|
{wasEverActive
|
|
170
171
|
? 'You have been disconnected because MATLAB is open in another window. Click on Confirm to continue using MATLAB here.'
|
|
171
|
-
: <div>MATLAB is open in another window and cannot be opened in a second window or tab at the same time.<br></br>Would you like to continue in this window?</div>
|
|
172
|
+
: <div>MATLAB is open in another window and cannot be opened in a second window or tab at the same time.<br></br>Would you like to continue in this window?</div>}
|
|
172
173
|
</Confirmation>
|
|
173
174
|
);
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
const handlePageHide = (event) => {
|
|
180
|
+
// Performs actions before the component unloads
|
|
181
|
+
if (isConcurrencyEnabled && !isSessionConcurrent && hasFetchedServerStatus) {
|
|
182
|
+
// A POST request to clear the active client when the tab/browser is closed
|
|
183
|
+
navigator.sendBeacon('./clear_client_id');
|
|
184
|
+
}
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
event.returnValue = '';
|
|
187
|
+
};
|
|
188
|
+
window.addEventListener('pagehide', handlePageHide);
|
|
189
|
+
return () => {
|
|
190
|
+
window.removeEventListener('pagehide', handlePageHide);
|
|
191
|
+
};
|
|
192
|
+
}, [isConcurrencyEnabled, isSessionConcurrent, hasFetchedServerStatus]);
|
|
193
|
+
|
|
177
194
|
useEffect(() => {
|
|
178
195
|
// Initial fetch environment configuration
|
|
179
196
|
if (!hasFetchedEnvConfig) {
|
|
@@ -204,7 +221,7 @@ function App () {
|
|
|
204
221
|
|
|
205
222
|
useEffect(() => {
|
|
206
223
|
const queryParams = parseQueryParams(window.location);
|
|
207
|
-
const token = queryParams.get(
|
|
224
|
+
const token = queryParams.get(MWI_AUTH_TOKEN_NAME_FOR_HTTP);
|
|
208
225
|
|
|
209
226
|
if (token) {
|
|
210
227
|
dispatch(updateAuthStatus(token));
|
|
@@ -6,7 +6,6 @@ import mimetypes
|
|
|
6
6
|
import pkgutil
|
|
7
7
|
import secrets
|
|
8
8
|
import sys
|
|
9
|
-
import uuid
|
|
10
9
|
|
|
11
10
|
import aiohttp
|
|
12
11
|
from aiohttp import client_exceptions, web
|
|
@@ -97,16 +96,15 @@ def marshal_error(error):
|
|
|
97
96
|
|
|
98
97
|
|
|
99
98
|
async def create_status_response(
|
|
100
|
-
app, loadUrl=None, client_id=None,
|
|
99
|
+
app, loadUrl=None, client_id=None, is_active_client=None
|
|
101
100
|
):
|
|
102
101
|
"""Send a generic status response about the state of server, MATLAB, MATLAB Licensing and the client session status.
|
|
103
102
|
|
|
104
103
|
Args:
|
|
105
104
|
app (aiohttp.web.Application): Web Server
|
|
106
105
|
loadUrl (String, optional): Represents the root URL. Defaults to None.
|
|
107
|
-
client_id (String, optional): Represents the
|
|
108
|
-
|
|
109
|
-
is_desktop (Boolean, optional): Represents whether the request is made by the desktop app or some other kernel. Defaults to False.
|
|
106
|
+
client_id (String, optional): Represents the generated client_id when concurrency check is enabled and client does not have a client_id. Defaults to None.
|
|
107
|
+
is_active_client (Boolean, optional): Represents whether the current client is the active_client when concurrency check is enabled. Defaults to None.
|
|
110
108
|
|
|
111
109
|
Returns:
|
|
112
110
|
JSONResponse: A JSONResponse object containing the generic state of the server, MATLAB, MATLAB Licensing and the client session status.
|
|
@@ -124,17 +122,30 @@ async def create_status_response(
|
|
|
124
122
|
"wsEnv": state.settings.get("ws_env", ""),
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
if
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
if client_id:
|
|
126
|
+
status["clientId"] = client_id
|
|
127
|
+
if is_active_client is not None:
|
|
128
|
+
status["isActiveClient"] = is_active_client
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
state.active_client = client_id
|
|
130
|
+
return web.json_response(status)
|
|
134
131
|
|
|
135
|
-
status["isActiveClient"] = True if state.active_client == client_id else False
|
|
136
132
|
|
|
137
|
-
|
|
133
|
+
@token_auth.authenticate_access_decorator
|
|
134
|
+
async def clear_client_id(req):
|
|
135
|
+
"""API endpoint to reset the active client
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
req (HTTPRequest): HTTPRequest Object
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Response: an empty response in JSON format
|
|
142
|
+
"""
|
|
143
|
+
# Sleep for one second prior to clearing the client id to ensure that any remaining get_status responses are fully processed first.
|
|
144
|
+
await asyncio.sleep(1)
|
|
145
|
+
state = req.app["state"]
|
|
146
|
+
state.active_client = None
|
|
147
|
+
# This response is of no relevance to the front-end as the client has already exited
|
|
148
|
+
return web.json_response({})
|
|
138
149
|
|
|
139
150
|
|
|
140
151
|
@token_auth.authenticate_access_decorator
|
|
@@ -201,15 +212,17 @@ async def get_status(req):
|
|
|
201
212
|
JSONResponse: JSONResponse object containing information about the server, MATLAB and MATLAB Licensing.
|
|
202
213
|
"""
|
|
203
214
|
# The client sends the CLIENT_ID as a query parameter if the concurrency check has been set to true.
|
|
215
|
+
state = req.app["state"]
|
|
204
216
|
client_id = req.query.get("MWI_CLIENT_ID", None)
|
|
205
217
|
transfer_session = json.loads(req.query.get("TRANSFER_SESSION", "false"))
|
|
206
218
|
is_desktop = req.query.get("IS_DESKTOP", False)
|
|
207
219
|
|
|
220
|
+
generated_client_id, is_active_client = state.get_session_status(
|
|
221
|
+
is_desktop, client_id, transfer_session
|
|
222
|
+
)
|
|
223
|
+
|
|
208
224
|
return await create_status_response(
|
|
209
|
-
req.app,
|
|
210
|
-
client_id=client_id,
|
|
211
|
-
transfer_session=transfer_session,
|
|
212
|
-
is_desktop=is_desktop,
|
|
225
|
+
req.app, client_id=generated_client_id, is_active_client=is_active_client
|
|
213
226
|
)
|
|
214
227
|
|
|
215
228
|
|
|
@@ -773,6 +786,8 @@ async def cleanup_background_tasks(app):
|
|
|
773
786
|
# Stop any running async tasks
|
|
774
787
|
logger = mwi.logger.get()
|
|
775
788
|
tasks = state.tasks
|
|
789
|
+
if state.task_detect_client_status:
|
|
790
|
+
tasks["detect_client_status"] = state.task_detect_client_status
|
|
776
791
|
for task_name, task in tasks.items():
|
|
777
792
|
if not task.cancelled():
|
|
778
793
|
logger.debug(f"Cancelling MWI task: {task_name} : {task} ")
|
|
@@ -868,6 +883,7 @@ def create_app(config_name=matlab_proxy.get_default_config_name()):
|
|
|
868
883
|
app.router.add_route("GET", f"{base_url}/get_auth_token", get_auth_token)
|
|
869
884
|
app.router.add_route("GET", f"{base_url}/get_env_config", get_env_config)
|
|
870
885
|
app.router.add_route("PUT", f"{base_url}/start_matlab", start_matlab)
|
|
886
|
+
app.router.add_route("POST", f"{base_url}/clear_client_id", clear_client_id)
|
|
871
887
|
app.router.add_route("DELETE", f"{base_url}/stop_matlab", stop_matlab)
|
|
872
888
|
app.router.add_route("PUT", f"{base_url}/set_licensing_info", set_licensing_info)
|
|
873
889
|
app.router.add_route("PUT", f"{base_url}/update_entitlement", update_entitlement)
|
|
@@ -9,14 +9,16 @@ import time
|
|
|
9
9
|
from collections import deque
|
|
10
10
|
from datetime import datetime, timedelta, timezone
|
|
11
11
|
from typing import Final, Optional
|
|
12
|
+
import uuid
|
|
12
13
|
|
|
13
14
|
from matlab_proxy import util
|
|
14
|
-
from matlab_proxy.settings import (
|
|
15
|
-
get_process_startup_timeout,
|
|
16
|
-
)
|
|
17
15
|
from matlab_proxy.constants import (
|
|
18
16
|
CONNECTOR_SECUREPORT_FILENAME,
|
|
19
17
|
MATLAB_LOGS_FILE_NAME,
|
|
18
|
+
IS_CONCURRENCY_CHECK_ENABLED,
|
|
19
|
+
)
|
|
20
|
+
from matlab_proxy.settings import (
|
|
21
|
+
get_process_startup_timeout,
|
|
20
22
|
)
|
|
21
23
|
from matlab_proxy.util import mw, mwi, system, windows
|
|
22
24
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
@@ -28,12 +30,11 @@ from matlab_proxy.util.mwi.exceptions import (
|
|
|
28
30
|
LicensingError,
|
|
29
31
|
MatlabError,
|
|
30
32
|
OnlineLicensingError,
|
|
31
|
-
XvfbError,
|
|
32
33
|
UIVisibleFatalError,
|
|
34
|
+
XvfbError,
|
|
33
35
|
log_error,
|
|
34
36
|
)
|
|
35
37
|
|
|
36
|
-
|
|
37
38
|
logger = mwi.logger.get()
|
|
38
39
|
|
|
39
40
|
|
|
@@ -104,6 +105,12 @@ class AppState:
|
|
|
104
105
|
# connected to the backend
|
|
105
106
|
self.active_client = None
|
|
106
107
|
|
|
108
|
+
# Used to detect whether the active client is actively sending out request or is inactive
|
|
109
|
+
self.active_client_request_detected = False
|
|
110
|
+
|
|
111
|
+
# An event loop task to handle the detection of client activity
|
|
112
|
+
self.task_detect_client_status = None
|
|
113
|
+
|
|
107
114
|
def __get_cached_config_file(self):
|
|
108
115
|
"""Get the cached config file
|
|
109
116
|
|
|
@@ -314,7 +321,11 @@ class AppState:
|
|
|
314
321
|
[Dict | None]: Returns token authentication headers if any.
|
|
315
322
|
"""
|
|
316
323
|
return (
|
|
317
|
-
{
|
|
324
|
+
{
|
|
325
|
+
self.settings["mwi_auth_token_name_for_http"]: self.settings[
|
|
326
|
+
"mwi_auth_token_hash"
|
|
327
|
+
]
|
|
328
|
+
}
|
|
318
329
|
if self.settings["mwi_is_token_auth_enabled"]
|
|
319
330
|
else None
|
|
320
331
|
)
|
|
@@ -1301,3 +1312,76 @@ class AppState:
|
|
|
1301
1312
|
if err is not None:
|
|
1302
1313
|
self.error = err
|
|
1303
1314
|
log_error(logger, err)
|
|
1315
|
+
|
|
1316
|
+
def get_session_status(self, is_desktop, client_id, transfer_session):
|
|
1317
|
+
"""
|
|
1318
|
+
Determines the session status for a client, potentially generating a new client ID.
|
|
1319
|
+
|
|
1320
|
+
This function is responsible for managing and tracking the session status of a client.
|
|
1321
|
+
It can generate a new client ID if one is not provided and the conditions are met.
|
|
1322
|
+
It also manages the active client status within the session, especially in scenarios
|
|
1323
|
+
involving desktop clients and when concurrency checks are enabled.
|
|
1324
|
+
|
|
1325
|
+
Args:
|
|
1326
|
+
is_desktop (bool): A flag indicating whether the client is a desktop client.
|
|
1327
|
+
client_id (str or None): The client ID. If None, a new client ID may be generated.
|
|
1328
|
+
transfer_session (bool): Indicates whether the session should be transferred to this client.
|
|
1329
|
+
|
|
1330
|
+
Returns:
|
|
1331
|
+
tuple:
|
|
1332
|
+
- A 2-tuple containing the generated client ID (or None if not generated) and
|
|
1333
|
+
a boolean indicating whether the client is considered the active client.
|
|
1334
|
+
- If concurrency checks are not enabled or the client is not a desktop client, it returns None for both
|
|
1335
|
+
the generated client ID and the active client status.
|
|
1336
|
+
"""
|
|
1337
|
+
if IS_CONCURRENCY_CHECK_ENABLED and is_desktop:
|
|
1338
|
+
generated_client_id = None
|
|
1339
|
+
if not client_id:
|
|
1340
|
+
generated_client_id = str(uuid.uuid4())
|
|
1341
|
+
client_id = generated_client_id
|
|
1342
|
+
|
|
1343
|
+
if not self.active_client or transfer_session:
|
|
1344
|
+
self.active_client = client_id
|
|
1345
|
+
|
|
1346
|
+
if not self.task_detect_client_status:
|
|
1347
|
+
# Create the loop to detect the active status of the client
|
|
1348
|
+
loop = util.get_event_loop()
|
|
1349
|
+
self.task_detect_client_status = loop.create_task(
|
|
1350
|
+
self.detect_active_client_status()
|
|
1351
|
+
)
|
|
1352
|
+
|
|
1353
|
+
if self.active_client == client_id:
|
|
1354
|
+
is_active_client = True
|
|
1355
|
+
self.active_client_request_detected = True
|
|
1356
|
+
else:
|
|
1357
|
+
is_active_client = False
|
|
1358
|
+
return generated_client_id, is_active_client
|
|
1359
|
+
return None, None
|
|
1360
|
+
|
|
1361
|
+
async def detect_active_client_status(self, sleep_time=1, max_inactive_count=10):
|
|
1362
|
+
"""Detects whether the client is online or not by continuously checking if the active client is making requests
|
|
1363
|
+
|
|
1364
|
+
Args:
|
|
1365
|
+
sleep_time (int): The time in seconds for which the process waits before checking for the next get_status request from the active client.
|
|
1366
|
+
max_inactive_count (int): The maximum number of times the check for the request from the active_client fails before reseting the active client id.
|
|
1367
|
+
"""
|
|
1368
|
+
inactive_count = 0
|
|
1369
|
+
while self.active_client:
|
|
1370
|
+
# Check if the get_status request from the active client is received or not
|
|
1371
|
+
await asyncio.sleep(sleep_time)
|
|
1372
|
+
if self.active_client_request_detected:
|
|
1373
|
+
self.active_client_request_detected = False
|
|
1374
|
+
inactive_count = 0
|
|
1375
|
+
else:
|
|
1376
|
+
inactive_count = inactive_count + 1
|
|
1377
|
+
if inactive_count > max_inactive_count:
|
|
1378
|
+
# If no request is received from the active_client for more than 10 seconds then clear the active client id
|
|
1379
|
+
inactive_count = 0
|
|
1380
|
+
self.active_client = None
|
|
1381
|
+
if self.task_detect_client_status:
|
|
1382
|
+
try:
|
|
1383
|
+
# Self cleanup of the task
|
|
1384
|
+
self.task_detect_client_status.cancel()
|
|
1385
|
+
self.task_detect_client_status = None
|
|
1386
|
+
except Exception as e:
|
|
1387
|
+
logger.error("Cleaning of task: 'detect_client_status' failed.")
|
|
@@ -17,6 +17,7 @@ from cryptography.x509.oid import NameOID
|
|
|
17
17
|
|
|
18
18
|
import matlab_proxy
|
|
19
19
|
from matlab_proxy import constants
|
|
20
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
20
21
|
from matlab_proxy.util import mwi, system
|
|
21
22
|
from matlab_proxy.util.mwi import environment_variables as mwi_env
|
|
22
23
|
from matlab_proxy.util.mwi import token_auth
|
|
@@ -197,11 +198,12 @@ def get_dev_settings(config):
|
|
|
197
198
|
"mwi_logs_root_dir": get_mwi_logs_root_dir(dev=True),
|
|
198
199
|
"mw_context_tags": get_mw_context_tags(matlab_proxy.get_default_config_name()),
|
|
199
200
|
"mwi_server_url": None,
|
|
200
|
-
"mwi_is_token_auth_enabled": mwi_auth_token
|
|
201
|
+
"mwi_is_token_auth_enabled": mwi_auth_token is not None,
|
|
201
202
|
"mwi_auth_status": False,
|
|
202
203
|
"mwi_auth_token": mwi_auth_token,
|
|
203
204
|
"mwi_auth_token_hash": mwi_auth_token_hash,
|
|
204
|
-
"
|
|
205
|
+
"mwi_auth_token_name_for_http": MWI_AUTH_TOKEN_NAME_FOR_HTTP,
|
|
206
|
+
"mwi_auth_token_name_for_env": mwi_env.get_env_name_mwi_auth_token().lower(),
|
|
205
207
|
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
|
|
206
208
|
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
|
|
207
209
|
),
|
|
@@ -322,11 +324,12 @@ def get_server_settings(config_name):
|
|
|
322
324
|
"mw_context_tags": get_mw_context_tags(config_name),
|
|
323
325
|
# The url where the matlab-proxy server is accessible at
|
|
324
326
|
"mwi_server_url": None,
|
|
325
|
-
"mwi_is_token_auth_enabled": mwi_auth_token
|
|
327
|
+
"mwi_is_token_auth_enabled": mwi_auth_token is not None,
|
|
326
328
|
"mwi_auth_status": False,
|
|
327
329
|
"mwi_auth_token": mwi_auth_token,
|
|
328
330
|
"mwi_auth_token_hash": mwi_auth_token_hash,
|
|
329
|
-
"
|
|
331
|
+
"mwi_auth_token_name_for_http": MWI_AUTH_TOKEN_NAME_FOR_HTTP,
|
|
332
|
+
"mwi_auth_token_name_for_env": mwi_env.get_env_name_mwi_auth_token().lower(),
|
|
330
333
|
"mwi_use_existing_license": mwi.validators.validate_use_existing_licensing(
|
|
331
334
|
os.getenv(mwi_env.get_env_name_mwi_use_existing_license(), "")
|
|
332
335
|
),
|
|
@@ -59,7 +59,7 @@ def generate_mwi_auth_token_and_hash():
|
|
|
59
59
|
def get_mwi_auth_token_access_str(app_settings):
|
|
60
60
|
"""Returns formatted string with mwi token for use with server URL"""
|
|
61
61
|
if app_settings["mwi_is_token_auth_enabled"]:
|
|
62
|
-
mwi_auth_token_name = app_settings["
|
|
62
|
+
mwi_auth_token_name = app_settings["mwi_auth_token_name_for_http"]
|
|
63
63
|
mwi_auth_token = app_settings["mwi_auth_token"]
|
|
64
64
|
return f"?{mwi_auth_token_name}={mwi_auth_token}"
|
|
65
65
|
|
|
@@ -134,7 +134,20 @@ async def _get_token_name(request):
|
|
|
134
134
|
str : token name
|
|
135
135
|
"""
|
|
136
136
|
app_settings = request.app["settings"]
|
|
137
|
-
return app_settings["
|
|
137
|
+
return app_settings["mwi_auth_token_name_for_env"]
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _get_token_name_for_http(request):
|
|
141
|
+
"""Gets the name of the token from settings.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
request (HTTPRequest) : Used to get to app settings
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
str : token name
|
|
148
|
+
"""
|
|
149
|
+
app_settings = request.app["settings"]
|
|
150
|
+
return app_settings["mwi_auth_token_name_for_http"]
|
|
138
151
|
|
|
139
152
|
|
|
140
153
|
async def _get_token(request):
|
|
@@ -238,11 +251,11 @@ async def _is_valid_token_in_url_query(request):
|
|
|
238
251
|
query_string = request.query_string
|
|
239
252
|
logger.debug(f"url query parameters found:{query_string}")
|
|
240
253
|
if query_string:
|
|
241
|
-
token_name =
|
|
254
|
+
token_name = _get_token_name_for_http(request)
|
|
242
255
|
parsed_token = parse_qs(request.query_string).get(token_name)
|
|
243
256
|
if parsed_token:
|
|
244
257
|
parsed_token = parsed_token[0]
|
|
245
|
-
logger.debug(
|
|
258
|
+
logger.debug("parsed_token from url query string.")
|
|
246
259
|
return await _is_valid_token(parsed_token, request)
|
|
247
260
|
|
|
248
261
|
logger.debug("Token not found in url query.")
|
|
@@ -262,8 +275,9 @@ async def _is_valid_token_in_headers(request):
|
|
|
262
275
|
"""
|
|
263
276
|
logger.debug("Checking for token in request headers...")
|
|
264
277
|
headers = request.headers
|
|
265
|
-
token_name =
|
|
278
|
+
token_name = _get_token_name_for_http(request)
|
|
266
279
|
if token_name in headers:
|
|
280
|
+
logger.debug(f"Token found in headers: {token_name}")
|
|
267
281
|
is_valid_token = await _is_valid_token(headers[token_name], request)
|
|
268
282
|
if is_valid_token:
|
|
269
283
|
await _store_token_hash_into_session(request)
|
|
@@ -12,7 +12,7 @@ import re
|
|
|
12
12
|
from requests.adapters import HTTPAdapter, Retry
|
|
13
13
|
from urllib.parse import urlparse, parse_qs
|
|
14
14
|
from tests.utils.logging_util import create_integ_test_logger
|
|
15
|
-
from
|
|
15
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
16
16
|
|
|
17
17
|
_logger = create_integ_test_logger(__name__)
|
|
18
18
|
|
|
@@ -64,9 +64,9 @@ class RealMATLABServer:
|
|
|
64
64
|
parsed_url = urlparse(utils.get_connection_string(self.mwi_app_port))
|
|
65
65
|
|
|
66
66
|
self.headers = {
|
|
67
|
-
|
|
68
|
-
parse_qs(parsed_url.query)[
|
|
69
|
-
if
|
|
67
|
+
MWI_AUTH_TOKEN_NAME_FOR_HTTP: (
|
|
68
|
+
parse_qs(parsed_url.query)[MWI_AUTH_TOKEN_NAME_FOR_HTTP][0]
|
|
69
|
+
if MWI_AUTH_TOKEN_NAME_FOR_HTTP in parse_qs(parsed_url.query)
|
|
70
70
|
else ""
|
|
71
71
|
)
|
|
72
72
|
}
|
|
@@ -6,6 +6,7 @@ import requests
|
|
|
6
6
|
from tests.utils.logging_util import create_integ_test_logger
|
|
7
7
|
import os
|
|
8
8
|
from urllib.parse import urlparse, parse_qs
|
|
9
|
+
from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
|
|
9
10
|
|
|
10
11
|
_logger = create_integ_test_logger(__name__)
|
|
11
12
|
|
|
@@ -34,9 +35,9 @@ def parse_matlab_proxy_url():
|
|
|
34
35
|
parsed_url = urlparse(utils.get_connection_string(mwi_app_port))
|
|
35
36
|
|
|
36
37
|
headers = {
|
|
37
|
-
|
|
38
|
-
parse_qs(parsed_url.query)[
|
|
39
|
-
if
|
|
38
|
+
MWI_AUTH_TOKEN_NAME_FOR_HTTP: (
|
|
39
|
+
parse_qs(parsed_url.query)[MWI_AUTH_TOKEN_NAME_FOR_HTTP][0]
|
|
40
|
+
if MWI_AUTH_TOKEN_NAME_FOR_HTTP in parse_qs(parsed_url.query)
|
|
40
41
|
else ""
|
|
41
42
|
)
|
|
42
43
|
}
|
|
@@ -284,6 +284,20 @@ async def test_get_status_route(test_server):
|
|
|
284
284
|
assert resp.status == HTTPStatus.OK
|
|
285
285
|
|
|
286
286
|
|
|
287
|
+
async def test_clear_client_id_route(test_server):
|
|
288
|
+
"""Test to check endpoint: "/clear_client_id"
|
|
289
|
+
|
|
290
|
+
Args:
|
|
291
|
+
test_server (aiohttp_client): A aiohttp_client server for sending POST request.
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
state = test_server.server.app["state"]
|
|
295
|
+
state.active_client = "mock_client_id"
|
|
296
|
+
resp = await test_server.post("/clear_client_id")
|
|
297
|
+
assert resp.status == HTTPStatus.OK
|
|
298
|
+
assert state.active_client is None
|
|
299
|
+
|
|
300
|
+
|
|
287
301
|
async def test_get_env_config(test_server):
|
|
288
302
|
"""Test to check endpoint : "/get_env_config"
|
|
289
303
|
|
|
@@ -1031,7 +1045,7 @@ async def test_update_entitlement_with_correct_entitlement(set_licensing_info):
|
|
|
1031
1045
|
assert resp.status == HTTPStatus.OK
|
|
1032
1046
|
|
|
1033
1047
|
|
|
1034
|
-
async def test_get_auth_token_route(test_server
|
|
1048
|
+
async def test_get_auth_token_route(test_server):
|
|
1035
1049
|
"""Test to check endpoint : "/get_auth_token"
|
|
1036
1050
|
|
|
1037
1051
|
Args:
|