@@ -51,6 +51,66 @@ public Saml2Error(String errorCode, String description) {
5151 this .description = description ;
5252 }
5353
54+ /**
55+ * Construct an {@link Saml2ErrorCodes#INVALID_RESPONSE} error
56+ * @param description the error description
57+ * @return the resulting {@link Saml2Error}
58+ * @since 7.0
59+ */
60+ public static Saml2Error invalidResponse (String description ) {
61+ return new Saml2Error (Saml2ErrorCodes .INVALID_RESPONSE , description );
62+ }
63+
64+ /**
65+ * Construct an {@link Saml2ErrorCodes#INTERNAL_VALIDATION_ERROR} error
66+ * @param description the error description
67+ * @return the resulting {@link Saml2Error}
68+ * @since 7.0
69+ */
70+ public static Saml2Error internalValidationError (String description ) {
71+ return new Saml2Error (Saml2ErrorCodes .INTERNAL_VALIDATION_ERROR , description );
72+ }
73+
74+ /**
75+ * Construct an {@link Saml2ErrorCodes#MALFORMED_RESPONSE_DATA} error
76+ * @param description the error description
77+ * @return the resulting {@link Saml2Error}
78+ * @since 7.0
79+ */
80+ public static Saml2Error malformedResponseData (String description ) {
81+ return new Saml2Error (Saml2ErrorCodes .MALFORMED_RESPONSE_DATA , description );
82+ }
83+
84+ /**
85+ * Construct an {@link Saml2ErrorCodes#DECRYPTION_ERROR} error
86+ * @param description the error description
87+ * @return the resulting {@link Saml2Error}
88+ * @since 7.0
89+ */
90+ public static Saml2Error decryptionError (String description ) {
91+ return new Saml2Error (Saml2ErrorCodes .DECRYPTION_ERROR , description );
92+ }
93+
94+ /**
95+ * Construct an {@link Saml2ErrorCodes#RELYING_PARTY_REGISTRATION_NOT_FOUND} error
96+ * @param description the error description
97+ * @return the resulting {@link Saml2Error}
98+ * @since 7.0
99+ */
100+ public static Saml2Error relyingPartyRegistrationNotFound (String description ) {
101+ return new Saml2Error (Saml2ErrorCodes .RELYING_PARTY_REGISTRATION_NOT_FOUND , description );
102+ }
103+
104+ /**
105+ * Construct an {@link Saml2ErrorCodes#SUBJECT_NOT_FOUND} error
106+ * @param description the error description
107+ * @return the resulting {@link Saml2Error}
108+ * @since 7.0
109+ */
110+ public static Saml2Error subjectNotFound (String description ) {
111+ return new Saml2Error (Saml2ErrorCodes .SUBJECT_NOT_FOUND , description );
112+ }
113+
54114 /**
55115 * Returns the error code.
56116 * @return the error code
0 commit comments