Commit 4ba29f54 authored by Chris Hines's avatar Chris Hines
Browse files

better detection of when a certificate has expired

parent 89522064
Pipeline #10303 passed with stages
in 3 minutes and 32 seconds
...@@ -203,8 +203,18 @@ public getKeys(id?: Identity) { ...@@ -203,8 +203,18 @@ public getKeys(id?: Identity) {
let agentpipe$ = agentquery$.pipe( let agentpipe$ = agentquery$.pipe(
tap((_) => this.notifications.notify("Updating the list of available accounts")), tap((_) => this.notifications.notify("Updating the list of available accounts")),
catchError((e) => { this.querySshAgentError(e); return of([])}), catchError((e) => { this.querySshAgentError(e); return of([])}),
tap((resp) => this.agentContents.next(resp)), tap((resp) => { console.log('agent contents',resp) }),
tap((_) => this.notifications.notify("")) tap((resp) => { console.log('agent contents',resp) }),
tap((resp) => {
if (this.agentContents.value !== null && this.agentContents.value.length > resp.length) {
this.notifications.notify("Your login expired. Please login again");
console.log('login expired');
} else {
this.notifications.notify("");
};
this.agentContents.next(resp)
}),
//tap((_) => this.notifications.notify(""))
) )
return agentpipe$ return agentpipe$
} }
......
...@@ -39,6 +39,7 @@ export class JobsService { ...@@ -39,6 +39,7 @@ export class JobsService {
} }
public getJobsError(error,identity: Identity) { public getJobsError(error,identity: Identity) {
this.tsub.unsubscribe()
this.authService.updateAgentContents().subscribe((_) => {return}); this.authService.updateAgentContents().subscribe((_) => {return});
} }
......
...@@ -72,7 +72,7 @@ export class KeygenComponent implements OnInit, OnDestroy { ...@@ -72,7 +72,7 @@ export class KeygenComponent implements OnInit, OnDestroy {
switchMap((_) => of([null])), switchMap((_) => of([null])),
); );
agent$.subscribe( (res) => this.router.navigate([sessionStorage.getItem('path')]), agent$.subscribe( (res) => this.router.navigate([sessionStorage.getItem('path')]),
(err) => { this.logout(err.sshauthzservice); this.router.navigate(['/noaccount',err.sshauthzservice.name])}) (err) => { console.log(err) ; this.logout(err.sshauthzservice); this.router.navigate(['/noaccount',err.sshauthzservice.name])})
} }
extractToken(frag: string) { extractToken(frag: string) {
......
...@@ -368,20 +368,13 @@ public getSftpData(id: Identity, path: string, cd: string ) { ...@@ -368,20 +368,13 @@ public getSftpData(id: Identity, path: string, cd: string ) {
private handleError(error: HttpErrorResponse) { private handleError(error: HttpErrorResponse) {
console.error(error); console.error(error);
console.log('in handle error');
if (error.error instanceof ErrorEvent) { if (error.error instanceof ErrorEvent) {
this.notifications.notify("A networking error occured.") this.notifications.notify("A networking error occured.")
return return
} else { } else {
var re = /identity/gi; this.notifications.notify("Your login appears to have expired. Please login again");
if (error.error.message != undefined) { this.authorisationService.updateAgentContents().subscribe((v) => {return});
let searchresult = error.error.message.search(re);
if (searchresult != -1) {
this.notifications.notify('Login expired, refreshing');
this.authorisationService.updateAgentContents();
return
}
return this.notifications.notify(error.error.message)
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment