diff --git a/src/app/_services/auth.service.ts b/src/app/_services/auth.service.ts index 5c02f96..c7771d9 100644 --- a/src/app/_services/auth.service.ts +++ b/src/app/_services/auth.service.ts @@ -92,6 +92,7 @@ export class AuthService { const authHeader: string = response.headers.get('WWW-Authenticate'); return hobaParseChallengeHeader(authHeader); } + console.log('DEBUG: expected a 401 and www-authenticate header!') }); } @@ -106,7 +107,6 @@ export class AuthService { // this.loggingService.sendErrorLevelMessage('Login token failed', this, { error: e }); //} } else { - try { const o = await this.getChallenge(); const r = await signChallenge( @@ -128,13 +128,6 @@ export class AuthService { }); return } - if (response.status === 403) { - console.log('Getting back a 403 but I think the server should send 200') - //this.errorDialogService.openDialog({ - // message: 'You are not authorized to use this system', - //}); - // return - } if (!response.ok) { console.log("Failed to get a login token with signed challenge 😭", response.statusText) return @@ -147,41 +140,38 @@ export class AuthService { return true } return false - } catch (e) { - this.loggingService.sendErrorLevelMessage('Login challenge failed', this, { error: e }); - } } } - async loginResponse(o: { challenge: string; realm: any }): Promise { - const r = await signChallenge( - o.challenge, - o.realm, - environment.cicMetaUrl, - this.mutableKeyStore - ); + //async loginResponse(o: { challenge: string; realm: any }): Promise { + // const r = await signChallenge( + // o.challenge, + // o.realm, + // environment.cicMetaUrl, + // this.mutableKeyStore + // ); - return this.sendSignedChallenge(r); - // if (error instanceof HttpError) { - // if (error.status === 403) { - // this.errorDialogService.openDialog({ - // message: 'You are not authorized to use this system', - // }); - // } else if (error.status === 401) { - // this.errorDialogService.openDialog({ - // message: - // 'Unable to authenticate with the service. ' + - // 'Please speak with the staff at Grassroots ' + - // 'Economics for requesting access ' + - // 'staff@grassrootseconomics.net.', - // }); - // } - // } else { - // // TODO define this error - // this.errorDialogService.openDialog({ message: 'Incorrect key passphrase.' }); - // } - // resolve(false); - } + // return this.sendSignedChallenge(r); + // // if (error instanceof HttpError) { + // // if (error.status === 403) { + // // this.errorDialogService.openDialog({ + // // message: 'You are not authorized to use this system', + // // }); + // // } else if (error.status === 401) { + // // this.errorDialogService.openDialog({ + // // message: + // // 'Unable to authenticate with the service. ' + + // // 'Please speak with the staff at Grassroots ' + + // // 'Economics for requesting access ' + + // // 'staff@grassrootseconomics.net.', + // // }); + // // } + // // } else { + // // // TODO define this error + // // this.errorDialogService.openDialog({ message: 'Incorrect key passphrase.' }); + // // } + // // resolve(false); + //} loginView(): void { document.getElementById('one').style.display = 'none';