|
30 | 30 | import com.onelogin.saml2.http.HttpRequest; |
31 | 31 | import com.onelogin.saml2.logout.LogoutRequest; |
32 | 32 | import com.onelogin.saml2.logout.LogoutResponse; |
| 33 | +import com.onelogin.saml2.model.SamlResponseStatus; |
33 | 34 | import com.onelogin.saml2.model.KeyStoreSettings; |
34 | 35 | import com.onelogin.saml2.servlet.ServletUtils; |
35 | 36 | import com.onelogin.saml2.settings.Saml2Settings; |
@@ -749,11 +750,22 @@ public void processResponse(String requestId) throws Exception { |
749 | 750 | lastAssertionNotOnOrAfter = samlResponse.getAssertionNotOnOrAfter(); |
750 | 751 | LOGGER.debug("processResponse success --> " + samlResponseParameter); |
751 | 752 | } else { |
752 | | - errors.add("invalid_response"); |
753 | | - LOGGER.error("processResponse error. invalid_response"); |
754 | | - LOGGER.debug(" --> " + samlResponseParameter); |
755 | 753 | errorReason = samlResponse.getError(); |
756 | 754 | validationException = samlResponse.getValidationException(); |
| 755 | + SamlResponseStatus samlResponseStatus = samlResponse.getResponseStatus(); |
| 756 | + if (samlResponseStatus.getStatusCode() == null || !samlResponseStatus.getStatusCode().equals(Constants.STATUS_SUCCESS)) { |
| 757 | + errors.add("response_not_success"); |
| 758 | + LOGGER.error("processResponse error. sso_not_success"); |
| 759 | + LOGGER.debug(" --> " + samlResponseParameter); |
| 760 | + errors.add(samlResponseStatus.getStatusCode()); |
| 761 | + if (samlResponseStatus.getSubStatusCode() != null) { |
| 762 | + errors.add(samlResponseStatus.getSubStatusCode()); |
| 763 | + } |
| 764 | + } else { |
| 765 | + errors.add("invalid_response"); |
| 766 | + LOGGER.error("processResponse error. invalid_response"); |
| 767 | + LOGGER.debug(" --> " + samlResponseParameter); |
| 768 | + } |
757 | 769 | } |
758 | 770 | } else { |
759 | 771 | errors.add("invalid_binding"); |
@@ -798,11 +810,16 @@ public void processSLO(Boolean keepLocalSession, String requestId) throws Except |
798 | 810 | errorReason = logoutResponse.getError(); |
799 | 811 | validationException = logoutResponse.getValidationException(); |
800 | 812 | } else { |
801 | | - String status = logoutResponse.getStatus(); |
| 813 | + SamlResponseStatus samlResponseStatus = logoutResponse.getSamlResponseStatus(); |
| 814 | + String status = samlResponseStatus.getStatusCode(); |
802 | 815 | if (status == null || !status.equals(Constants.STATUS_SUCCESS)) { |
803 | 816 | errors.add("logout_not_success"); |
804 | 817 | LOGGER.error("processSLO error. logout_not_success"); |
805 | 818 | LOGGER.debug(" --> " + samlResponseParameter); |
| 819 | + errors.add(samlResponseStatus.getStatusCode()); |
| 820 | + if (samlResponseStatus.getSubStatusCode() != null) { |
| 821 | + errors.add(samlResponseStatus.getSubStatusCode()); |
| 822 | + } |
806 | 823 | } else { |
807 | 824 | lastMessageId = logoutResponse.getId(); |
808 | 825 | LOGGER.debug("processSLO success --> " + samlResponseParameter); |
|
0 commit comments