import { Injectable } from '@angular/core' ; import { Observable , of } from 'rxjs' ; import { Credentials , CredentialsService } from './credentials.service' ; export interface LoginContext { username : string ; password : string ; remember ? : boolean ; } /**
 * Provides a base for authentication workflow.
 * The login/logout methods should be replaced with proper implementation.
 */ @ Injectable ( { providedIn : 'root' } ) export class AuthenticationService { constructor ( private credentialsService ) { } param context return login ( context ) { const data = { username : context . username , token : '123456' } ; this . credentialsService . setCredentials ( data , context . remember ) ; return of ( data ) ; } return logout ( ) { this . credentialsService . setCredentials ( ) ; return of ( true ) ; } }