diff options
Diffstat (limited to 'eaaf_modules/eaaf_module_pvp2_idp')
-rw-r--r-- | eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java index 50fd0f44..afef878b 100644 --- a/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java +++ b/eaaf_modules/eaaf_module_pvp2_idp/src/main/java/at/gv/egiz/eaaf/modules/pvp2/idp/impl/AbstractPvp2XProtocol.java @@ -129,7 +129,7 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement final StatusCode statusCode = Saml2Utils.createSamlObject(StatusCode.class); final StatusMessage statusMessage = Saml2Utils.createSamlObject(StatusMessage.class); - String moaError = null; + String internalErrorCode = null; if (e instanceof NoPassivAuthenticationException) { statusCode.setValue(StatusCode.NO_PASSIVE); @@ -149,29 +149,35 @@ public abstract class AbstractPvp2XProtocol extends AbstractController implement final String statusMessageValue = ex.getStatusMessageValue(); if (statusMessageValue != null) { statusMessage.setMessage(StringEscapeUtils.escapeXml(statusMessageValue)); + } - moaError = statusMessager.mapInternalErrorToExternalError(ex.getErrorId()); + + internalErrorCode = ex.getErrorId(); } else { statusCode.setValue(StatusCode.RESPONDER); statusMessage.setMessage(StringEscapeUtils.escapeXml(e.getLocalizedMessage())); - moaError = statusMessager.getResponseErrorCode(e); + internalErrorCode = statusMessager.getResponseErrorCode(e); + } - if (StringUtils.isNotEmpty(moaError)) { - final StatusCode moaStatusCode = Saml2Utils.createSamlObject(StatusCode.class); - moaStatusCode.setValue(moaError); - statusCode.setStatusCode(moaStatusCode); + //set external sub-statusCode if one was selected + if (StringUtils.isNotEmpty(internalErrorCode)) { + final StatusCode externalStatusCode = Saml2Utils.createSamlObject(StatusCode.class); + externalStatusCode.setValue( + statusMessager.mapInternalErrorToExternalError(internalErrorCode)); + statusCode.setStatusCode(externalStatusCode); + } - status.setStatusCode(statusCode); + //set status-message if availabe if (statusMessage.getMessage() != null) { status.setStatusMessage(statusMessage); - } - samlResponse.setStatus(status); - final String remoteSessionID = Saml2Utils.getSecureIdentifier(); - samlResponse.setID(remoteSessionID); - + } + status.setStatusCode(statusCode); + + samlResponse.setStatus(status); + samlResponse.setID(Saml2Utils.getSecureIdentifier()); samlResponse.setIssueInstant(new DateTime()); final Issuer nissuer = Saml2Utils.createSamlObject(Issuer.class); nissuer.setValue(pvpBasicConfiguration.getIdpEntityId(pvpRequest.getAuthUrl())); |