Browse Source

Add Saml2Error Static Factories

pull/17202/merge
Josh Cummings 7 months ago
parent
commit
3de7312658
No known key found for this signature in database
GPG Key ID: 869B37A20E876129
  1. 60
      saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/Saml2Error.java

60
saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/core/Saml2Error.java

@ -51,6 +51,66 @@ public class Saml2Error implements Serializable { @@ -51,6 +51,66 @@ public class Saml2Error implements Serializable {
this.description = description;
}
/**
* Construct an {@link Saml2ErrorCodes#INVALID_RESPONSE} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error invalidResponse(String description) {
return new Saml2Error(Saml2ErrorCodes.INVALID_RESPONSE, description);
}
/**
* Construct an {@link Saml2ErrorCodes#INTERNAL_VALIDATION_ERROR} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error internalValidationError(String description) {
return new Saml2Error(Saml2ErrorCodes.INTERNAL_VALIDATION_ERROR, description);
}
/**
* Construct an {@link Saml2ErrorCodes#MALFORMED_RESPONSE_DATA} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error malformedResponseData(String description) {
return new Saml2Error(Saml2ErrorCodes.MALFORMED_RESPONSE_DATA, description);
}
/**
* Construct an {@link Saml2ErrorCodes#DECRYPTION_ERROR} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error decryptionError(String description) {
return new Saml2Error(Saml2ErrorCodes.DECRYPTION_ERROR, description);
}
/**
* Construct an {@link Saml2ErrorCodes#RELYING_PARTY_REGISTRATION_NOT_FOUND} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error relyingPartyRegistrationNotFound(String description) {
return new Saml2Error(Saml2ErrorCodes.RELYING_PARTY_REGISTRATION_NOT_FOUND, description);
}
/**
* Construct an {@link Saml2ErrorCodes#SUBJECT_NOT_FOUND} error
* @param description the error description
* @return the resulting {@link Saml2Error}
* @since 7.0
*/
public static Saml2Error subjectNotFound(String description) {
return new Saml2Error(Saml2ErrorCodes.SUBJECT_NOT_FOUND, description);
}
/**
* Returns the error code.
* @return the error code

Loading…
Cancel
Save