diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs
index f897a7f1c..6ece1b56f 100644
--- a/.settings/org.eclipse.m2e.core.prefs
+++ b/.settings/org.eclipse.m2e.core.prefs
@@ -1,3 +1,4 @@
+#Wed May 30 14:51:48 EDT 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
diff --git a/account-chooser/.settings/org.eclipse.m2e.core.prefs b/account-chooser/.settings/org.eclipse.m2e.core.prefs
index 04d767089..6ece1b56f 100644
--- a/account-chooser/.settings/org.eclipse.m2e.core.prefs
+++ b/account-chooser/.settings/org.eclipse.m2e.core.prefs
@@ -1,4 +1,4 @@
-#Mon May 07 14:38:46 EDT 2012
+#Wed May 30 14:51:48 EDT 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
diff --git a/openid-connect-client/.classpath b/openid-connect-client/.classpath
index f5c551598..1b28ee5d7 100644
--- a/openid-connect-client/.classpath
+++ b/openid-connect-client/.classpath
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openid-connect-client/.settings/org.eclipse.m2e.core.prefs b/openid-connect-client/.settings/org.eclipse.m2e.core.prefs
index f897a7f1c..6ece1b56f 100644
--- a/openid-connect-client/.settings/org.eclipse.m2e.core.prefs
+++ b/openid-connect-client/.settings/org.eclipse.m2e.core.prefs
@@ -1,3 +1,4 @@
+#Wed May 30 14:51:48 EDT 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
diff --git a/openid-connect-common/.classpath b/openid-connect-common/.classpath
index f5c551598..1b28ee5d7 100644
--- a/openid-connect-common/.classpath
+++ b/openid-connect-common/.classpath
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openid-connect-common/.settings/org.eclipse.m2e.core.prefs b/openid-connect-common/.settings/org.eclipse.m2e.core.prefs
index f897a7f1c..6ece1b56f 100644
--- a/openid-connect-common/.settings/org.eclipse.m2e.core.prefs
+++ b/openid-connect-common/.settings/org.eclipse.m2e.core.prefs
@@ -1,3 +1,4 @@
+#Wed May 30 14:51:48 EDT 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
diff --git a/openid-connect-server/.classpath b/openid-connect-server/.classpath
index 5abeb50d1..8ca8f4c92 100644
--- a/openid-connect-server/.classpath
+++ b/openid-connect-server/.classpath
@@ -1,14 +1,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openid-connect-server/.settings/com.springsource.sts.maven.prefs b/openid-connect-server/.settings/com.springsource.sts.maven.prefs
index 049137b9c..94d0ffbed 100644
--- a/openid-connect-server/.settings/com.springsource.sts.maven.prefs
+++ b/openid-connect-server/.settings/com.springsource.sts.maven.prefs
@@ -1,2 +1,3 @@
+#Wed May 30 14:51:48 EDT 2012
com.springsource.sts.maven.maven.automatically.update=true
eclipse.preferences.version=1
diff --git a/openid-connect-server/.settings/org.eclipse.wst.common.component b/openid-connect-server/.settings/org.eclipse.wst.common.component
index 5b4c881f0..7becf4b04 100644
--- a/openid-connect-server/.settings/org.eclipse.wst.common.component
+++ b/openid-connect-server/.settings/org.eclipse.wst.common.component
@@ -5,10 +5,10 @@
-
+
uses
-
+
uses
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/ExpiredTokenException.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/ExpiredTokenException.java
index 935792f6f..2aa9118a6 100644
--- a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/ExpiredTokenException.java
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/ExpiredTokenException.java
@@ -15,11 +15,20 @@
******************************************************************************/
package org.mitre.openid.connect.exception;
+/**
+ * @author aanganes, nemonik
+ *
+ */
public class ExpiredTokenException extends RuntimeException {
- /**
- *
- */
private static final long serialVersionUID = 1L;
+ public ExpiredTokenException() {
+ super();
+ }
+
+ public ExpiredTokenException(String message) {
+ super(message);
+ }
+
}
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtIssuerException.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtIssuerException.java
index 43dab06e3..c760393ff 100644
--- a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtIssuerException.java
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtIssuerException.java
@@ -15,11 +15,20 @@
******************************************************************************/
package org.mitre.openid.connect.exception;
+/**
+ * @author aanganes, nemonik
+ *
+ */
public class InvalidJwtIssuerException extends RuntimeException {
- /**
- *
- */
private static final long serialVersionUID = 1L;
+ public InvalidJwtIssuerException() {
+ super();
+ }
+
+ public InvalidJwtIssuerException(String message) {
+ super(message);
+ }
+
}
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtSignatureException.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtSignatureException.java
index 72882c830..c4dbd79f7 100644
--- a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtSignatureException.java
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/InvalidJwtSignatureException.java
@@ -15,11 +15,20 @@
******************************************************************************/
package org.mitre.openid.connect.exception;
+/**
+ * @author aanganes, nemonik
+ *
+ */
public class InvalidJwtSignatureException extends RuntimeException {
- /**
- *
- */
private static final long serialVersionUID = 1L;
+
+ public InvalidJwtSignatureException() {
+ super();
+ }
+ public InvalidJwtSignatureException(String message) {
+ super(message);
+ }
+
}
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/UnknownUserInfoSchemaException.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/UnknownUserInfoSchemaException.java
index 07b4ee7ab..766357122 100644
--- a/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/UnknownUserInfoSchemaException.java
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/exception/UnknownUserInfoSchemaException.java
@@ -15,14 +15,20 @@
******************************************************************************/
package org.mitre.openid.connect.exception;
+/**
+ * @author aanganes, nemonik
+ *
+ */
public class UnknownUserInfoSchemaException extends RuntimeException {
- public UnknownUserInfoSchemaException(String string) {
- super(string);
+ private static final long serialVersionUID = 1L;
+
+ public UnknownUserInfoSchemaException() {
+ super();
}
- /**
- *
- */
- private static final long serialVersionUID = 1L;
+ public UnknownUserInfoSchemaException(String message) {
+ super(message);
+ }
+
}
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/view/ExceptionAsJSONView.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/ExceptionAsJSONView.java
new file mode 100644
index 000000000..e5da29707
--- /dev/null
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/view/ExceptionAsJSONView.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright 2012 The MITRE Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+package org.mitre.openid.connect.view;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.web.servlet.view.AbstractView;
+
+import com.google.gson.JsonObject;
+
+/**
+ * @author nemonik
+ *
+ */
+public class ExceptionAsJSONView extends AbstractView {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel
+ * (java.util.Map, javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ protected void renderMergedOutputModel(Map model,
+ HttpServletRequest requesr, HttpServletResponse response)
+ throws Exception {
+
+ response.setContentType("application/json");
+
+ final JsonObject jsonObject = new JsonObject();
+
+ Object ex = model.get("exception");
+
+ jsonObject.addProperty("error", ex.getClass().getName());
+ jsonObject.addProperty("error_description",
+ ((Exception) ex).getMessage());
+
+ response.getWriter().write(jsonObject.toString());
+ }
+
+}
diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/CheckIDEndpoint.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/CheckIDEndpoint.java
index a0e57814d..aa859b3cc 100644
--- a/openid-connect-server/src/main/java/org/mitre/openid/connect/web/CheckIDEndpoint.java
+++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/web/CheckIDEndpoint.java
@@ -50,7 +50,7 @@ public class CheckIDEndpoint {
if (!jwtSignerService.validateSignature(tokenString)) {
// can't validate
- throw new InvalidJwtSignatureException(); // TODO: attach a view to this exception
+ throw new InvalidJwtSignatureException("The Signature could not be validated.");
}
// it's a valid signature, parse the token
@@ -59,12 +59,12 @@ public class CheckIDEndpoint {
// check the expiration
if (jwtSignerService.isJwtExpired(token)) {
// token has expired
- throw new ExpiredTokenException(); // TODO create a view for this exception
+ throw new ExpiredTokenException("The token has expired.");
}
// check the issuer (sanity check)
if (!jwtSignerService.validateIssuedJwt(token, configBean.getIssuer())) {
- throw new InvalidJwtIssuerException(); // TODO: create a view for this exception
+ throw new InvalidJwtIssuerException("The JWT issuer is invalid.");
}
// pass the claims directly (the view doesn't care about other fields)
diff --git a/openid-connect-server/src/main/webapp/WEB-INF/spring-servlet.xml b/openid-connect-server/src/main/webapp/WEB-INF/spring-servlet.xml
index 80cb9f2ff..8fbd22685 100644
--- a/openid-connect-server/src/main/webapp/WEB-INF/spring-servlet.xml
+++ b/openid-connect-server/src/main/webapp/WEB-INF/spring-servlet.xml
@@ -1,12 +1,9 @@
-
-
+
+
@@ -27,64 +25,85 @@
-
+
-
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -96,7 +115,7 @@
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
-
+
-
+
+
+
-
-
-
+
-
-
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ exceptionAsJSONView
+
+
+ exceptionAsJSONView
+
+
+ exceptionAsJSONView
+
+
+
+
+
+
-
-
-
+
+
+