From 0da02accef9737d48cf995c5e406deafd23ce32e Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 30 Jul 2019 12:33:26 +0200 Subject: some some updates --- .../builder/AbstractAuthenticationDataBuilder.java | 4 +- .../services/ProtocolAuthenticationService.java | 2 +- .../idp/module/test/DummyProtocolAuthService.java | 49 +++++++++++++++++++--- .../core/impl/idp/module/test/TestRequestImpl.java | 9 +++- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java index 558a9a33..af66552d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java @@ -95,10 +95,10 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati log.info("User authentication uses the deprecated. Building AuthData from deprecated information ... "); authData = buildDeprecatedAuthData(pendingReq); Assert.notNull(authData, "AuthData is null"); - + } - } catch ( EAAFAuthenticationException e) { + } catch ( final EAAFAuthenticationException e) { throw e; } catch (XPathException | DOMException | EAAFException e) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java index 0aa7ff89..b4b188b6 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java @@ -390,7 +390,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer if (params[i] != null) errorCodeParams[i] = params[i].toString(); else - errorCodeParams[i] = "'null'"; + errorCodeParams[i] = "null"; } } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java index a50e92cb..94209dd6 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java @@ -10,33 +10,72 @@ import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService import at.gv.egiz.eaaf.core.exceptions.EAAFException; public class DummyProtocolAuthService implements IProtocolAuthenticationService { - + + private IRequest pendingReq; + private HttpServletRequest httpReq; + private HttpServletResponse httpResp; + private Throwable exception; + private boolean writeToStatisticLog; + + @Override public void performAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException { - // TODO Auto-generated method stub + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; } @Override public void finalizeAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) throws EAAFException, IOException { - // TODO Auto-generated method stub + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; } @Override public void buildProtocolSpecificErrorResponse(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException { - // TODO Auto-generated method stub + this.pendingReq = pendingReq; + this.httpReq = req; + this.httpResp = resp; + this.exception = throwable; } @Override public void handleErrorNoRedirect(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, boolean writeExceptionToStatisticLog) throws IOException, EAAFException { - // TODO Auto-generated method stub + this.httpReq = req; + this.httpResp = resp; + this.exception = throwable; + this.writeToStatisticLog = writeExceptionToStatisticLog; + + } + + public IRequest getPendingReq() { + return pendingReq; + } + + public HttpServletRequest getHttpReq() { + return httpReq; + } + + public HttpServletResponse getHttpResp() { + return httpResp; + } + + public Throwable getException() { + return exception; + } + public boolean isWriteToStatisticLog() { + return writeToStatisticLog; } + + } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java index b1d4e113..ceb4d9fe 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java @@ -48,6 +48,7 @@ public class TestRequestImpl implements IRequest { private String pendingReqId = null; private String authURL = null; private boolean authenticated; + private boolean needAuthentication = false; /* (non-Javadoc) * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule() @@ -152,8 +153,8 @@ public class TestRequestImpl implements IRequest { */ @Override public boolean isNeedAuthentication() { - // TODO Auto-generated method stub - return false; + return this.needAuthentication; + } /* (non-Javadoc) @@ -312,6 +313,10 @@ public class TestRequestImpl implements IRequest { public void setAuthURL(String authURL) { this.authURL = authURL; } + + public void setNeedAuthentication(boolean needAuthentication) { + this.needAuthentication = needAuthentication; + } -- cgit v1.2.3