From: Bill Erickson Date: Tue, 12 Jun 2018 17:44:41 +0000 (-0400) Subject: LP#1775466 Port auth_proxy login support X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=721925ab0f94c933c0f0794fca7f316395aae42f;p=working%2FEvergreen.git LP#1775466 Port auth_proxy login support Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/core/auth.service.ts b/Open-ILS/src/eg2/src/app/core/auth.service.ts index 3176bf80e9..1de67dbbee 100644 --- a/Open-ILS/src/eg2/src/app/core/auth.service.ts +++ b/Open-ILS/src/eg2/src/app/core/auth.service.ts @@ -116,14 +116,40 @@ export class AuthService { }); } - login(args: AuthLoginArgs, isOpChange?: boolean): Promise { - return this.net.request('open-ils.auth', 'open-ils.auth.login', args) + loginApi(args: AuthLoginArgs, service: string, + method: string, isOpChange?: boolean): Promise { + + return this.net.request(service, method, args) .toPromise().then(res => { return this.handleLoginResponse( args, this.egEvt.parse(res), isOpChange); }); } + login(args: AuthLoginArgs, isOpChange?: boolean): Promise { + let service = 'open-ils.auth'; + let method = 'open-ils.auth.login'; + + return this.net.request( + 'open-ils.auth_proxy', + 'open-ils.auth_proxy.enabled') + .toPromise().then( + enabled => { + if (Number(enabled) === 1) { + service = 'open-ils.auth_proxy'; + method = 'open-ils.auth_proxy.login'; + } + return this.loginApi(args, service, method, isOpChange); + }, + error => { + // auth_proxy check resulted in a low-level error. + // Likely the service is not running. Fall back to + // standard auth login. + return this.loginApi(args, service, method, isOpChange); + } + ); + } + handleLoginResponse( args: AuthLoginArgs, evt: EgEvent, isOpChange: boolean): Promise {