Skip to content

Commit

Permalink
release v0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kikkomep committed May 29, 2023
2 parents f312947 + 562da4a commit eb479b8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions k8s/lifemonitor-web/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ data:
{
"apiBaseUrl": "https://{{ .Values.externalServerName }}/api",
"appDomain": "{{ .Values.externalServerName }}",
"socketBaseUrl": "https://{{ .Values.externalServerName }}",
"clientId": "{{ .Values.backend.clientId }}"
"socketBaseUrl": "https://{{ .Values.externalServerName }}"{{ if .Values.backend.clientId }},{{ end }}
{{ if .Values.backend.clientId }}"clientId": "{{ .Values.backend.clientId }}"{{ end }}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lifemonitor",
"version": "0.5.1",
"version": "0.5.2",
"scripts": {
"start": "ng build --configuration production && http-server -p 4202 --ssl -C ./certs/lm.crt -K ./certs/lm.key --host lm dist/lifemonitor",
"start:dev": "ng serve --port 4200 --ssl --ssl-key ./certs/lm.key --ssl-cert ./certs/lm.crt --host lm",
Expand Down
16 changes: 13 additions & 3 deletions src/app/utils/services/auth-base.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,29 @@ export abstract class AuthBaseService implements IAuthService {
skipIfNone: boolean = false
): Observable<User | null> {
this.logger.warn('fetchUserData', this.baseUrl);
// fetch current token
const accessToken = this.getToken();
const useToken = accessToken !== null && accessToken !== undefined;
if (skipIfNone) {
this.logger.debug('_fetchUserData: skipIfNone', skipIfNone);
// check if user is logged
const userData = this.isUserLogged();
// get current path
const currentPath = window.location.pathname;
if (!userData || currentPath.startsWith('/logout')) {
if (
// if the user flag is not set
!userData ||
// or if the access token is not set and the client id is set
(accessToken === null && this.config.clientId !== null) ||
// or if the current path is the logout page
currentPath.startsWith('/logout')
) {
this._userData = null;
this.setUserData(null, true);
return of(null);
}
}
this.logger.debug('Trying to fetch user data');
const accessToken = this.getToken();
const useToken = accessToken !== null && accessToken !== undefined;
return this.httpClient
.get(this.baseUrl + '/users/current', {
withCredentials: !useToken,
Expand Down
4 changes: 4 additions & 0 deletions src/app/utils/services/auth-oauth2.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ export class AuthOAuth2Service extends AuthBaseService implements IAuthService {
}
const token = JSON.parse(oauthState);
this.logger.log('Fetched Token: ', token);
if (!token || !('accessToken' in token)) {
this.logger.debug('No access token found');
return null;
}

this._token = {
scopes: token.scopes,
Expand Down

0 comments on commit eb479b8

Please sign in to comment.