Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ protected String postProcessXml(final String authnRequestXml, final AuthnRequest
}

/**
* Returns the base64 encoded, unsigned AuthnRequest, optionally deflated.
*
* @return the base64 encoded unsigned AuthnRequest (deflated or not)
*
* @param deflated
Expand All @@ -161,6 +163,8 @@ public String getEncodedAuthnRequest(Boolean deflated) {
}

/**
* Returns the base64 encoded, unsigned AuthnRequest using the default deflate setting.
*
* @return base64 encoded, unsigned AuthnRequest (deflated or not)
*
*/
Expand All @@ -169,6 +173,8 @@ public String getEncodedAuthnRequest() {
}

/**
* Returns the unsigned plain-text AuthnRequest XML.
*
* @return unsigned plain-text AuthnRequest.
*/
public String getAuthnRequestXml() {
Expand Down Expand Up @@ -281,6 +287,8 @@ private static StringBuilder getAuthnRequestTemplate() {
}

/**
* Returns the generated id of the AuthnRequest message.
*
* @return the generated id of the AuthnRequest message
*/
public String getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ protected AuthnRequestParams(final AuthnRequestParams source) {
}

/**
* Returns whether the <code>ForceAuthn</code> attribute should be set.
*
* @return whether the <code>ForceAuthn</code> attribute should be set to
* <code>true</code>
*/
Expand All @@ -135,6 +137,8 @@ public boolean isForceAuthn() {
}

/**
* Returns whether the <code>IsPassive</code> attribute should be set.
*
* @return whether the <code>IsPassive</code> attribute should be set to
* <code>true</code>
*/
Expand All @@ -143,13 +147,17 @@ public boolean isPassive() {
}

/**
* Returns whether a <code>NameIDPolicy</code> should be set.
*
* @return whether a <code>NameIDPolicy</code> should be set
*/
public boolean isSetNameIdPolicy() {
return setNameIdPolicy;
}

/**
* Returns whether the <code>AllowCreate</code> attribute should be set on the <code>NameIDPolicy</code>.
*
* @return whether the <code>AllowCreate</code> attribute should be set to
* <code>true</code> on the <code>NameIDPolicy</code> element (only
* meaningful if {@link #isSetNameIdPolicy()} is also <code>true</code>)
Expand All @@ -159,6 +167,8 @@ public boolean isAllowCreate() {
}

/**
* Returns the subject that should be authenticated.
*
* @return the subject that should be authenticated
*/
public String getNameIdValueReq() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public Map<String, List<String>> getAttributes() {
/**
* Returns the ResponseStatus object
*
* @return
* @return the response status
*/
public SamlResponseStatus getResponseStatus() {
return this.responseStatus;
Expand Down Expand Up @@ -848,13 +848,17 @@ public String getSessionIndex() {
}

/**
* Returns the ID of the Response.
*
* @return the ID of the Response
*/
public String getId() {
return samlResponseDocument.getDocumentElement().getAttributes().getNamedItem("ID").getNodeValue();
}

/**
* Returns the ID of the assertion in the Response.
*
* @return the ID of the assertion in the Response
*
*/
Expand All @@ -867,6 +871,8 @@ public String getAssertionId() {
}

/**
* Returns the NotOnOrAfter values of this Response.
*
* @return a list of NotOnOrAfter values from SubjectConfirmationData nodes in this Response
*
*/
Expand Down Expand Up @@ -1220,6 +1226,8 @@ private Document decryptAssertion(final Document dom) {
}

/**
* Returns the SAMLResponse XML.
*
* @return the SAMLResponse XML, If the Assertion of the SAMLResponse was encrypted,
* returns the XML with the assertion decrypted
*/
Expand All @@ -1234,6 +1242,8 @@ public String getSAMLResponseXml() {
}

/**
* Returns the SAMLResponse Document.
*
* @return the SAMLResponse Document, If the Assertion of the SAMLResponse was encrypted,
* returns the Document with the assertion decrypted
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

import java.security.spec.InvalidKeySpecException;

/**
* Runtime exception wrapping an {@link InvalidKeySpecException}.
*/
public class InvalidKeySpecRuntimeException extends RuntimeException {

/** Serial version UID. */
private static final long serialVersionUID = 1L;

/**
* Constructs a new {@code InvalidKeySpecRuntimeException} wrapping the given key spec exception.
*
* @param e the underlying invalid key spec exception
*/
public InvalidKeySpecRuntimeException(InvalidKeySpecException e) {
super(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
package org.codelibs.saml2.core.exception;

/**
* Exception thrown when a severe, non-recoverable SAML error occurs.
* Each instance carries an error code identifying the specific severe condition.
*/
public class SAMLSevereException extends SAMLException {

/** Serialization version identifier. */
private static final long serialVersionUID = 1L;

/** Error code indicating that the settings file could not be found. */
public static final int SETTINGS_FILE_NOT_FOUND = 1;
/** Error code indicating that the service provider metadata is invalid. */
public static final int METADATA_SP_INVALID = 2;
/** Error code indicating that the SAML response was not found. */
public static final int SAML_RESPONSE_NOT_FOUND = 3;
/** Error code indicating that the SAML logout message was not found. */
public static final int SAML_LOGOUTMESSAGE_NOT_FOUND = 4;
/** Error code indicating that the SAML logout request is invalid. */
public static final int SAML_LOGOUTREQUEST_INVALID = 5;
/** Error code indicating that the SAML logout response is invalid. */
public static final int SAML_LOGOUTRESPONSE_INVALID = 6;
/** Error code indicating that single logout is not supported. */
public static final int SAML_SINGLE_LOGOUT_NOT_SUPPORTED = 7;

/** The error code identifying the specific severe condition. */
private final int errorCode;

/**
* Constructs a new severe exception with the given message and error code.
*
* @param message the detail message describing the error
* @param errorCode the error code identifying the severe condition
*/
public SAMLSevereException(final String message, final int errorCode) {
super(message);
this.errorCode = errorCode;
}

/**
* Constructs a new severe exception with the given message, error code, and cause.
*
* @param message the detail message describing the error
* @param errorCode the error code identifying the severe condition
* @param cause the underlying cause of this exception
*/
public SAMLSevereException(final String message, final int errorCode, final Throwable cause) {
super(message, cause);
this.errorCode = errorCode;
}

/**
* Returns the error code identifying the specific severe condition.
*
* @return the error code
*/
public int getErrorCode() {
return errorCode;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
package org.codelibs.saml2.core.exception;

/**
* Exception thrown when a SAML signature operation fails.
*/
public class SAMLSignatureException extends SAMLException {

/** Serial version UID. */
private static final long serialVersionUID = 1L;

/**
* Constructs a new {@code SAMLSignatureException} wrapping the given exception.
*
* @param e the underlying exception
*/
public SAMLSignatureException(Exception e) {
super(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
package org.codelibs.saml2.core.exception;

/**
* Exception thrown when an error related to SAML settings configuration occurs.
* Each instance carries an error code identifying the specific settings problem.
*/
public class SettingsException extends SAMLException {

/** Serialization version identifier. */
private static final long serialVersionUID = 1L;

/** Error code indicating that the settings syntax is invalid. */
public static final int SETTINGS_INVALID_SYNTAX = 1;
/** Error code indicating that the settings are invalid. */
public static final int SETTINGS_INVALID = 2;
/** Error code indicating that a certificate could not be found. */
public static final int CERT_NOT_FOUND = 3;
/** Error code indicating that a private key could not be found. */
public static final int PRIVATE_KEY_NOT_FOUND = 4;
/** Error code indicating that the public certificate file could not be found. */
public static final int PUBLIC_CERT_FILE_NOT_FOUND = 5;
/** Error code indicating that the private key file could not be found. */
public static final int PRIVATE_KEY_FILE_NOT_FOUND = 6;

/** The error code identifying the specific settings problem. */
private final int errorCode;

/**
* Constructs a new settings exception with the given message and error code.
*
* @param message the detail message describing the error
* @param errorCode the error code identifying the settings problem
*/
public SettingsException(final String message, final int errorCode) {
super(message);
this.errorCode = errorCode;
}

/**
* Returns the error code identifying the specific settings problem.
*
* @return the error code
*/
public int getErrorCode() {
return errorCode;
}
Expand Down
Loading
Loading