[java-identity-provider COMMIT] in /trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile: CheckMandatoryIss...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Aug 31 12:15:37 BST 2011
Author: lajoie
Date: Wed Aug 31 12:15:37 2011
New Revision: 4042
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4042&view=rev
Log:
Add action-specific exception to each action so that error pages can be customized based on exception type
Added:
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ProfileException.java (with props)
Modified:
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMandatoryIssuer.java
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageLifetime.java
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageReplay.java
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/InitializeProfileRequestContext.java
trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/ProfileRequestContext.java
Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMandatoryIssuer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMandatoryIssuer.java?rev=4042&r1=4041&r2=4042&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMandatoryIssuer.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMandatoryIssuer.java Wed Aug 31 12:15:37 2011
@@ -22,7 +22,7 @@
import org.springframework.webflow.execution.RequestContext;
/** Checks that the incoming message has an issuer. */
-public class CheckMandatoryIssuer extends AbstractInboundMessageSubcontextAction<BasicMessageMetadataSubcontext> {
+public final class CheckMandatoryIssuer extends AbstractInboundMessageSubcontextAction<BasicMessageMetadataSubcontext> {
/** Constructor. The ID of this component is set to the name of this class. */
public CheckMandatoryIssuer() {
@@ -39,10 +39,50 @@
BasicMessageMetadataSubcontext messageSubcontext) {
if (messageSubcontext.getMessageIssuer() == null) {
- return ActionSupport.buildErrorEvent(this, null,
+ return ActionSupport.buildErrorEvent(this, new NoMessageIssuerException(),
"Basic message metadata subcontext does not a message issuer");
}
return ActionSupport.buildEvent(this, ActionSupport.PROCEED_EVENT_ID, null);
}
+
+ /** A profile processing exception that occurs when the inbound message has no identified message issuer. */
+ public static class NoMessageIssuerException extends ProfileException {
+
+ /** Serial version UID. */
+ private static final long serialVersionUID = 8451917927885322986L;
+
+ /** Constructor. */
+ public NoMessageIssuerException() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message exception message
+ */
+ public NoMessageIssuerException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param wrappedException exception to be wrapped by this one
+ */
+ public NoMessageIssuerException(Exception wrappedException) {
+ super(wrappedException);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message exception message
+ * @param wrappedException exception to be wrapped by this one
+ */
+ public NoMessageIssuerException(String message, Exception wrappedException) {
+ super(message, wrappedException);
+ }
+ }
}
Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageLifetime.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageLifetime.java?rev=4042&r1=4041&r2=4042&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageLifetime.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/CheckMessageLifetime.java Wed Aug 31 12:15:37 2011
@@ -22,7 +22,7 @@
import org.springframework.webflow.execution.RequestContext;
/** An action that checks that the inbound message should be considered valid based upon when it was issued. */
-public class CheckMessageLifetime extends AbstractInboundMessageSubcontextAction<BasicMessageMetadataSubcontext> {
+public final class CheckMessageLifetime extends AbstractInboundMessageSubcontextAction<BasicMessageMetadataSubcontext> {
/** Allowed clock skew, in milliseconds. */
private long clockskew;
@@ -53,15 +53,101 @@
long currentTime = System.currentTimeMillis();
if (issueInstant < currentTime - clockskew) {
- return ActionSupport.buildErrorEvent(this, null, "Message " + messageSubcontext.getMessageId()
- + " was expired");
+ return ActionSupport.buildErrorEvent(this, new PastMessageException(),
[... 203 lines stripped ...]
More information about the commits
mailing list