Skip to content

Commit

Permalink
fix basic auth expiration behavior (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yshayy committed Mar 27, 2019
1 parent c21a23c commit e7040aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion services/editor/src/services/auth-service.js
Expand Up @@ -37,13 +37,18 @@ const retrieveOidcSettings = () => JSON.parse(storage.getItem('oidc-settings'));
export const isAuthenticated = async () => {
const token = retrieveToken();
if (token) {
const expiration = moment.unix(jwt_decode(token).exp);
const decoded = jwt_decode(token);
const expiration = moment.unix(decoded.exp);
if (moment().isBefore(expiration)) {
return true;
}

if (isAzure()) {
return false;
}
if (decoded.iss === 'tweek-basic-auth') {
return false;
}
const settings = retrieveOidcSettings();
const oidcClient = getOidcClient(settings);
try {
Expand Down

0 comments on commit e7040aa

Please sign in to comment.