@@ -85,6 +85,11 @@ public class SamlResponse {
8585 */
8686 private String error ;
8787
88+ /**
89+ * The respone status code and messages
90+ */
91+ private SamlResponseStatus responseStatus ;
92+
8893 /**
8994 * Constructor to have a Response object fully built and ready to validate the saml response.
9095 *
@@ -574,19 +579,27 @@ public HashMap<String, List<String>> getAttributes() throws XPathExpressionExcep
574579 return attributes ;
575580 }
576581
582+ /**
583+ * Returns the latest response status
584+ *
585+ * @return
586+ */
587+ public SamlResponseStatus getResponseStatus () {
588+ return this .responseStatus ;
589+ }
590+
577591 /**
578592 * Checks the Status
579593 *
580- * @throws ValidationError
581- * If status is not success
594+ * @throws ValidationError If status is not success
582595 */
583596 public void checkStatus () throws ValidationError {
584- SamlResponseStatus responseStatus = getStatus (samlResponseDocument );
585- if (!responseStatus .is (Constants .STATUS_SUCCESS )) {
597+ this . responseStatus = getStatus (samlResponseDocument );
598+ if (!this . responseStatus .is (Constants .STATUS_SUCCESS )) {
586599 String statusExceptionMsg = "The status code of the Response was not Success, was "
587- + responseStatus .getStatusCode ();
588- if (responseStatus .getStatusMessage () != null ) {
589- statusExceptionMsg += " -> " + responseStatus .getStatusMessage ();
600+ + this . responseStatus .getStatusCode ();
601+ if (this . responseStatus .getStatusMessage () != null ) {
602+ statusExceptionMsg += " -> " + this . responseStatus .getStatusMessage ();
590603 }
591604 throw new ValidationError (statusExceptionMsg , ValidationError .STATUS_CODE_IS_NOT_SUCCESS );
592605 }
0 commit comments