Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
remove pylon address dependency (#3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqinzheng authored and debuggy committed Jul 19, 2019
1 parent 7e288ee commit 897fde0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/webportal/deploy/webportal.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ spec:
image: {{ cluster_cfg['cluster']['docker-registry']['prefix'] }}webportal:{{ cluster_cfg['cluster']['docker-registry']['tag'] }}
imagePullPolicy: Always
env:
- name: PYLON_ADDRESS
value: {{ cluster_cfg['pylon']['uri'] }}
- name: REST_SERVER_URI
value: {{ cluster_cfg['rest-server']['uri'] }}
- name: PROMETHEUS_URI
Expand Down
24 changes: 14 additions & 10 deletions src/webportal/src/app/home/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'whatwg-fetch';
import {FontClassNames} from '@uifabric/styling';
import c from 'classnames';
import {initializeIcons} from 'office-ui-fabric-react';
import querystring from 'querystring';
import React, {useState, useCallback} from 'react';
import ReactDOM from 'react-dom';

Expand All @@ -36,15 +37,15 @@ import url from 'url';

const loginTarget = '/home.html';

if ( config.authnMethod === 'OIDC') {
const query = url.parse(window.location.href, true).query;
const expiration = 7;
if (query['token']) {
cookies.set('user', query.user, {expires: expiration});
cookies.set('token', query.token, {expires: expiration});
cookies.set('admin', query.admin, {expires: expiration});
cookies.set('hasGitHubPAT', query.hasGitHubPAT, {expires: expiration});
}
if (config.authnMethod === 'OIDC') {
const query = url.parse(window.location.href, true).query;
const expiration = 7;
if (query['token']) {
cookies.set('user', query.user, {expires: expiration});
cookies.set('token', query.token, {expires: expiration});
cookies.set('admin', query.admin, {expires: expiration});
cookies.set('hasGitHubPAT', query.hasGitHubPAT, {expires: expiration});
}
}

if (checkToken(false)) {
Expand Down Expand Up @@ -79,7 +80,10 @@ const Index = () => {
if (config.authnMethod === 'basic') {
setLoginModal(true);
} else {
location.href = config.restServerUri + '/api/v1/authn/oidc/login?redirect_uri=' + encodeURIComponent(config.pylonAddress+'/index.html')+ '&callback=' + encodeURIComponent(location.href);
location.href = config.restServerUri + `/api/v1/authn/oidc/login?${querystring.stringify({
redirect_uri: new URL('/index.html', window.location.href).href,
callback: window.location.href,
})}`;
}
},
[],
Expand Down
2 changes: 1 addition & 1 deletion src/webportal/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-8.0.1.tgz#9712fa2ad124ac64668ab06ba847b1eaf83a03fd"
integrity sha512-cctMYH5RLbElaUpZn3IJaUj9QNQD8iXDnl7xNY6KB1aFD2ciJrwpo3kvZowIT75uA+silJFDnSR2kGakALUymg==

"@hapi/joi@^15.1.0":
"@hapi/joi@~15.1.0":
version "15.1.0"
resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-15.1.0.tgz#940cb749b5c55c26ab3b34ce362e82b6162c8e7a"
integrity sha512-n6kaRQO8S+kepUTbXL9O/UOL788Odqs38/VOfoCrATDtTvyfiO3fgjlSRaNkHabpTLgM7qru9ifqXlXbXk8SeQ==
Expand Down

0 comments on commit 897fde0

Please sign in to comment.