message: App: Adapt AuthenticationService for cookie-token
  Removes the obsolete localStorage tokens (token & mediaToken) as well as
  the obsolete authHeader method and adjusts isLoggedIn accordingly.
diff: -import {Injectable} from '@angular/core';
  -import {HttpHeaders} from '@angular/common/http';
  -import {UserService} from './user.service';
  +import {Injectable} from '@angular/core';
  import {HttpClient} from '@angular/common/http';
  -import {IUser} from '../../../../../../shared/models/IUser';
  import {Router} from '@angular/router';
  -import {isNullOrUndefined} from 'util';
  +import {UserService} from './user.service';
  +import {IUser} from '../../../../../../shared/models/IUser';
  @Injectable()
  export class AuthenticationService {
  public static readonly API_URL = '/api/';
  - public token: string;
  - public mediaToken: string;
  - public isLoggedIn = false;
  + public isLoggedIn: Boolean = false;
  constructor(private http: HttpClient,
  private router: Router,
  private userService: UserService) {
  - this.token = localStorage.getItem('token');
  - this.mediaToken = localStorage.getItem('mediaToken');
  - if (isNullOrUndefined(this.token)) {
  - this.token = '';
  - }
  - if (isNullOrUndefined(this.mediaToken)) {
  - this.mediaToken = '';
  - }
  - this.isLoggedIn = this.token !== ''; // Not checking against the mediaToken, because the app may still be partly functional without it.
  + // Currently 'isLoggedIn' in localStorage could be replaced by checking for 'user' (userService.user).
  + this.isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
  }
  async login(email: string, password: string) {
  @@ -36,13 +25,8 @@ export class AuthenticationService {
  return this.http.post(AuthenticationService.API_URL + 'auth/login', {email: email, password: password})
  .subscribe(
  (response) => {
  - // See JwtUtils.ts (generateToken function) in the back-end API for a description of the mediaToken's purpose.
  - // To easily attach the mediaToken to an URL you can use the jwt.pipe.ts (e.g. 'some/url/file.png | jwt').
  - this.token = response['token'];
  - this.mediaToken = response['mediaToken'];
  - localStorage.setItem('token', this.token);
  - localStorage.setItem('mediaToken', this.mediaToken);
  this.isLoggedIn = true;
  + localStorage.setItem('isLoggedIn', 'true');
  this.userService.setUser(response['user']);
  @@ -55,7 +39,7 @@ export class AuthenticationService {
  reloadUser() {
  if (this.isLoggedIn && this.userService.user) {
  - return this.http.get<IUser>(`${AuthenticationService.API_URL}users/${this.userService.user._id}`, {headers: this.authHeader()})
  + return this.http.get<IUser>(`${AuthenticationService.API_URL}users/${this.userService.user._id}`)
  .subscribe(
  (response) => {
  this.userService.setUser(response);
  @@ -67,13 +51,9 @@ export class AuthenticationService {
  unsetAuthData() {
  this.isLoggedIn = false;
  - this.token = null;
  - this.mediaToken = null;
  - localStorage.removeItem('token');
  - localStorage.removeItem('mediaToken');
  - this.http.delete(AuthenticationService.API_URL + 'auth/logout').toPromise();
  -
  + localStorage.removeItem('isLoggedIn');
  this.userService.unsetUser();
  + this.http.delete(AuthenticationService.API_URL + 'auth/logout').toPromise();
  }
  logout(): void {
  @@ -168,12 +148,4 @@ export class AuthenticationService {
  });
  });
  }
  -
  - authHeader() {
  - let headers = new HttpHeaders({'Content-Type': 'application/json'});
  - if (this.token) {
  - headers = headers.append('Authorization', this.token);
  - }
  - return headers;
  - }
  }
  