Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

no real advantage to using URL versus String for message parameters

git-svn-id: file:///Users/willnorris/Projects/svn-import/java-openid/trunk@94 eae3f9c0-6542-46b9-8785-326aab784c2f
  • Loading branch information...
commit 0bc4634c1ce0cc60b63d878b354b177d49ad5e0a 1 parent 265d0ef
@willnorris authored
Showing with 83 additions and 161 deletions.
  1. +2 −3 src/main/java/edu/internet2/middleware/openid/extensions/ax/FetchRequest.java
  2. +2 −3 src/main/java/edu/internet2/middleware/openid/extensions/ax/FetchResponse.java
  3. +3 −4 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestImpl.java
  4. +2 −3 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestMarshaller.java
  5. +2 −8 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestUnmarshaller.java
  6. +3 −4 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseImpl.java
  7. +2 −3 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseMarshaller.java
  8. +1 −7 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseUnmarshaller.java
  9. +2 −4 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationMessageMarshaller.java
  10. +1 −11 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationMessageUnmarshaller.java
  11. +2 −3 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationRequest.java
  12. +3 −4 src/main/java/edu/internet2/middleware/openid/extensions/sreg/impl/SimpleRegistrationRequestImpl.java
  13. +2 −4 src/main/java/edu/internet2/middleware/openid/message/AuthenticationRequest.java
  14. +2 −4 src/main/java/edu/internet2/middleware/openid/message/PositiveAssertion.java
  15. +2 −4 src/main/java/edu/internet2/middleware/openid/message/VerifyRequest.java
  16. +3 −3 src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestImpl.java
  17. +1 −1  src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestMarshaller.java
  18. +1 −9 src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestUnmarshaller.java
  19. +3 −5 src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionImpl.java
  20. +1 −1  src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionMarshaller.java
  21. +1 −9 src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionUnmarshaller.java
  22. +3 −6 src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestImpl.java
  23. +1 −1  src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestMarshaller.java
  24. +1 −9 src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestUnmarshaller.java
  25. +5 −6 src/test/java/edu/internet2/middleware/openid/extensions/ax/FetchRequestTest.java
  26. +5 −6 src/test/java/edu/internet2/middleware/openid/extensions/ax/FetchResponseTest.java
  27. +5 −6 src/test/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationRequestTest.java
  28. +5 −7 src/test/java/edu/internet2/middleware/openid/message/AuthenticationImmediateRequestTest.java
  29. +5 −7 src/test/java/edu/internet2/middleware/openid/message/AuthenticationInteractiveRequestTest.java
  30. +5 −6 src/test/java/edu/internet2/middleware/openid/message/PositiveAssertionTest.java
  31. +5 −7 src/test/java/edu/internet2/middleware/openid/message/VerifyRequestTest.java
  32. +2 −3 src/test/java/edu/internet2/middleware/openid/security/SecurityUtilsTest.java
View
5 src/main/java/edu/internet2/middleware/openid/extensions/ax/FetchRequest.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax;
-import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -56,13 +55,13 @@
*
* @return the update URL
*/
- public URL getUpdateURL();
+ public String getUpdateURL();
/**
* Set the update URL.
*
* @param newURL the update URL
*/
- public void setUpdateURL(URL newURL);
+ public void setUpdateURL(String newURL);
}
View
5 src/main/java/edu/internet2/middleware/openid/extensions/ax/FetchResponse.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax;
-import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -42,13 +41,13 @@
*
* @return the update URL
*/
- public URL getUpdateURL();
+ public String getUpdateURL();
/**
* Set update URL.
*
* @param newURL new URL
*/
- public void setUpdateURL(URL newURL);
+ public void setUpdateURL(String newURL);
}
View
7 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestImpl.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -47,7 +46,7 @@
/**
* Update URL.
*/
- private URL updateURL;
+ private String updateURL;
/**
* Constructor.
@@ -79,12 +78,12 @@ public String getMode() {
}
/** {@inheritDoc} */
- public URL getUpdateURL() {
+ public String getUpdateURL() {
return updateURL;
}
/** {@inheritDoc} */
- public void setUpdateURL(URL newUpdateURL) {
+ public void setUpdateURL(String newUpdateURL) {
updateURL = newUpdateURL;
}
View
5 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestMarshaller.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -42,9 +41,9 @@ public void marshall(FetchRequest request, ParameterMap parameters) {
types.setAliasPrefix(AttributeExchange.ALIAS_PREFIX);
// update URL
- URL policyURL = request.getUpdateURL();
+ String policyURL = request.getUpdateURL();
if (policyURL != null) {
- parameters.put(Parameter.update_url.QNAME, policyURL.toString());
+ parameters.put(Parameter.update_url.QNAME, policyURL);
}
// required attributes
View
10 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchRequestUnmarshaller.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import javax.xml.namespace.QName;
import org.slf4j.Logger;
@@ -66,11 +63,8 @@ public void unmarshall(FetchRequest request, ParameterMap parameters) {
String updateURL = parameters.get(Parameter.update_url.QNAME);
if (!DatatypeHelper.isEmpty(updateURL)) {
- try {
- request.setUpdateURL(new URL(updateURL));
- } catch (MalformedURLException e) {
- log.warn("Attribute Exchange update_url malformed: '{}'", updateURL);
- }
+ request.setUpdateURL(updateURL);
+
}
}
View
7 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseImpl.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.URL;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -36,7 +35,7 @@
/**
* Update URL.
*/
- private URL updateURL;
+ private String updateURL;
/**
* Constructor.
@@ -56,12 +55,12 @@ public String getMode() {
}
/** {@inheritDoc} */
- public URL getUpdateURL() {
+ public String getUpdateURL() {
return updateURL;
}
/** {@inheritDoc} */
- public void setUpdateURL(URL newUpdateURL) {
+ public void setUpdateURL(String newUpdateURL) {
updateURL = newUpdateURL;
}
View
5 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseMarshaller.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.URL;
import java.util.List;
import java.util.Map;
@@ -41,9 +40,9 @@ public void marshall(FetchResponse response, ParameterMap parameters) {
types.setAliasPrefix(AttributeExchange.ALIAS_PREFIX);
// update URL
- URL policyURL = response.getUpdateURL();
+ String policyURL = response.getUpdateURL();
if (policyURL != null) {
- parameters.put(Parameter.update_url.QNAME, policyURL.toString());
+ parameters.put(Parameter.update_url.QNAME, policyURL);
}
// attributes
View
8 src/main/java/edu/internet2/middleware/openid/extensions/ax/impl/FetchResponseUnmarshaller.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.extensions.ax.impl;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -47,11 +45,7 @@ public void unmarshall(FetchResponse response, ParameterMap parameters) {
String updateURL = parameters.get(Parameter.update_url.QNAME);
if (!DatatypeHelper.isEmpty(updateURL)) {
- try {
- response.setUpdateURL(new URL(updateURL));
- } catch (MalformedURLException e) {
- log.warn("Attribute Exchange update_url malformed: '{}'", updateURL);
- }
+ response.setUpdateURL(updateURL);
}
// get all the attribute types
View
6 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationMessageMarshaller.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.extensions.sreg;
-import java.net.URL;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,9 +58,9 @@ protected void marshall(SimpleRegistrationRequest request, ParameterMap paramete
log.debug("marshalling simple registration request");
// policy URL
- URL policyURL = request.getPolicyURL();
+ String policyURL = request.getPolicyURL();
if (policyURL != null) {
- parameters.put(Parameter.policy_url.QNAME, policyURL.toString());
+ parameters.put(Parameter.policy_url.QNAME, policyURL);
}
// required parameters
View
12 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationMessageUnmarshaller.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.extensions.sreg;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import javax.xml.namespace.QName;
import org.slf4j.Logger;
@@ -61,14 +58,7 @@ public SimpleRegistrationMessage unmarshall(ParameterMap parameters) throws Unma
* @throws UnmarshallingException thrown if an error occurs unmarshalling the message extension from the map
*/
public void unmarshall(SimpleRegistrationRequest request, ParameterMap parameters) throws UnmarshallingException {
- String policyURL = parameters.get(Parameter.policy_url.QNAME);
- if (!DatatypeHelper.isEmpty(policyURL)) {
- try {
- request.setPolicyURL(new URL(policyURL));
- } catch (MalformedURLException e) {
- // TODO
- }
- }
+ request.setPolicyURL(parameters.get(Parameter.policy_url.QNAME));
String optional = parameters.get(Parameter.optional.QNAME);
if (!DatatypeHelper.isEmpty(optional)) {
View
5 src/main/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationRequest.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.sreg;
-import java.net.URL;
import java.util.EnumSet;
import edu.internet2.middleware.openid.extensions.sreg.SimpleRegistration.Field;
@@ -48,12 +47,12 @@
*
* @return the policy URL
*/
- public URL getPolicyURL();
+ public String getPolicyURL();
/**
* Set the policy URL.
*
* @param policyURL the policy URL
*/
- public void setPolicyURL(URL policyURL);
+ public void setPolicyURL(String policyURL);
}
View
7 src/main/java/edu/internet2/middleware/openid/extensions/sreg/impl/SimpleRegistrationRequestImpl.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.extensions.sreg.impl;
-import java.net.URL;
import java.util.EnumSet;
import edu.internet2.middleware.openid.extensions.sreg.SimpleRegistration;
@@ -41,7 +40,7 @@
/**
* Policy URL.
*/
- private URL policyURL;
+ private String policyURL;
/**
* Default constructor.
@@ -68,12 +67,12 @@ public String getNamespace() {
}
/** {@inheritDoc} */
- public URL getPolicyURL() {
+ public String getPolicyURL() {
return policyURL;
}
/** {@inheritDoc} */
- public void setPolicyURL(URL newPolicyURL) {
+ public void setPolicyURL(String newPolicyURL) {
policyURL = newPolicyURL;
}
View
6 src/main/java/edu/internet2/middleware/openid/message/AuthenticationRequest.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
-
/**
* OpenID authentication request.
*/
@@ -82,14 +80,14 @@
*
* @return the return-to URL
*/
- public URL getReturnTo();
+ public String getReturnTo();
/**
* Set the return to URL.
*
* @param newReturnTo the return to URL
*/
- public void setReturnTo(URL newReturnTo);
+ public void setReturnTo(String newReturnTo);
/**
* Get the URL pattern the OpenID Provider should ask the end user to trust.
View
6 src/main/java/edu/internet2/middleware/openid/message/PositiveAssertion.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
-
/**
* Response to an authentication request indicating that the OpenID Provider was successfully able to authenticate the
* end user.
@@ -76,14 +74,14 @@
*
* @return return-to URL
*/
- public URL getReturnTo();
+ public String getReturnTo();
/**
* Set the return to URL.
*
* @param newReturnTo the return to URL
*/
- public void setReturnTo(URL newReturnTo);
+ public void setReturnTo(String newReturnTo);
/**
* Unique nonce for this response.
View
6 src/main/java/edu/internet2/middleware/openid/message/VerifyRequest.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
-
/**
* Request to verify a positive authentication assertion. All of the data from the assertion to be verified is included
* in the verification request.
@@ -76,14 +74,14 @@
*
* @return return-to URL
*/
- public URL getReturnTo();
+ public String getReturnTo();
/**
* Set the return to URL.
*
* @param newReturnTo the return to URL
*/
- public void setReturnTo(URL newReturnTo);
+ public void setReturnTo(String newReturnTo);
/**
* Unique nonce for this response.
View
6 src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestImpl.java
@@ -38,7 +38,7 @@
private String realm;
/** Return to URL. */
- private URL returnTo;
+ private String returnTo;
/** Message mode. */
private String mode;
@@ -94,12 +94,12 @@ public void setRealm(String newRealm) {
}
/** {@inheritDoc} */
- public URL getReturnTo() {
+ public String getReturnTo() {
return returnTo;
}
/** {@inheritDoc} */
- public void setReturnTo(URL newReturnTo) {
+ public void setReturnTo(String newReturnTo) {
returnTo = newReturnTo;
}
View
2  src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestMarshaller.java
@@ -34,7 +34,7 @@ public void marshallParameters(AuthenticationRequest request, ParameterMap param
parameters.put(Parameter.identity.QNAME, request.getIdentity());
parameters.put(Parameter.assoc_handle.QNAME, request.getAssociationHandle());
- parameters.put(Parameter.return_to.QNAME, request.getReturnTo().toString());
+ parameters.put(Parameter.return_to.QNAME, request.getReturnTo());
parameters.put(Parameter.realm.QNAME, request.getRealm());
}
View
10 src/main/java/edu/internet2/middleware/openid/message/impl/AuthenticationRequestUnmarshaller.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.message.impl;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import edu.internet2.middleware.openid.common.ParameterMap;
import edu.internet2.middleware.openid.common.OpenIDConstants.Parameter;
import edu.internet2.middleware.openid.message.AuthenticationRequest;
@@ -38,12 +35,7 @@ public void unmarshallParameters(AuthenticationRequest request, ParameterMap par
request.setMode(parameters.get(Parameter.mode.QNAME));
request.setRealm(parameters.get(Parameter.realm.QNAME));
- try {
- String returnTo = parameters.get(Parameter.return_to.QNAME);
- request.setReturnTo(new URL(returnTo));
- } catch (MalformedURLException e) {
- // TODO
- }
+ request.setReturnTo(parameters.get(Parameter.return_to.QNAME));
}
}
View
8 src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionImpl.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message.impl;
-import java.net.URL;
-
import edu.internet2.middleware.openid.message.PositiveAssertion;
/**
@@ -44,7 +42,7 @@
private String nonce;
/** Return to URL. */
- private URL returnTo;
+ private String returnTo;
/** {@inheritDoc} */
public String getMode() {
@@ -112,12 +110,12 @@ public void setResponseNonce(String newNonce) {
}
/** {@inheritDoc} */
- public URL getReturnTo() {
+ public String getReturnTo() {
return returnTo;
}
/** {@inheritDoc} */
- public void setReturnTo(URL newReturnTo) {
+ public void setReturnTo(String newReturnTo) {
returnTo = newReturnTo;
}
View
2  src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionMarshaller.java
@@ -47,7 +47,7 @@ public void marshallParameters(PositiveAssertion response, ParameterMap paramete
parameters.put(Parameter.response_nonce.QNAME, response.getResponseNonce());
}
if (response.getReturnTo() != null) {
- parameters.put(Parameter.return_to.QNAME, response.getReturnTo().toString());
+ parameters.put(Parameter.return_to.QNAME, response.getReturnTo());
}
if (response.getSignature() != null) {
parameters.put(Parameter.sig.QNAME, response.getSignature());
View
10 src/main/java/edu/internet2/middleware/openid/message/impl/PositiveAssertionUnmarshaller.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.message.impl;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import edu.internet2.middleware.openid.common.ParameterMap;
import edu.internet2.middleware.openid.common.OpenIDConstants.Parameter;
import edu.internet2.middleware.openid.message.PositiveAssertion;
@@ -37,12 +34,7 @@ public void unmarshallParameters(PositiveAssertion response, ParameterMap parame
response.setIdentity(parameters.get(Parameter.identity.QNAME));
response.setInvalidateHandle(parameters.get(Parameter.invalidate_handle.QNAME));
response.setResponseNonce(parameters.get(Parameter.response_nonce.QNAME));
- try {
- String returnTo = parameters.get(Parameter.return_to.QNAME);
- response.setReturnTo(new URL(returnTo));
- } catch (MalformedURLException e) {
- // TODO
- }
+ response.setReturnTo(parameters.get(Parameter.return_to.QNAME));
response.setSignature(parameters.get(Parameter.sig.QNAME));
String signedFields = parameters.get(Parameter.signed.QNAME);
View
9 src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestImpl.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.message.impl;
-import java.net.URL;
-
-import edu.internet2.middleware.openid.message.PositiveAssertion;
import edu.internet2.middleware.openid.message.VerifyRequest;
/**
@@ -45,7 +42,7 @@
private String nonce;
/** Return to URL. */
- private URL returnTo;
+ private String returnTo;
/** {@inheritDoc} */
public String getMode() {
@@ -113,12 +110,12 @@ public void setResponseNonce(String newNonce) {
}
/** {@inheritDoc} */
- public URL getReturnTo() {
+ public String getReturnTo() {
return returnTo;
}
/** {@inheritDoc} */
- public void setReturnTo(URL newReturnTo) {
+ public void setReturnTo(String newReturnTo) {
returnTo = newReturnTo;
}
View
2  src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestMarshaller.java
@@ -47,7 +47,7 @@ public void marshallParameters(VerifyRequest request, ParameterMap parameters) {
parameters.put(Parameter.response_nonce.QNAME, request.getResponseNonce());
}
if (request.getReturnTo() != null) {
- parameters.put(Parameter.return_to.QNAME, request.getReturnTo().toString());
+ parameters.put(Parameter.return_to.QNAME, request.getReturnTo());
}
if (request.getSignature() != null) {
parameters.put(Parameter.sig.QNAME, request.getSignature());
View
10 src/main/java/edu/internet2/middleware/openid/message/impl/VerifyRequestUnmarshaller.java
@@ -16,9 +16,6 @@
package edu.internet2.middleware.openid.message.impl;
-import java.net.MalformedURLException;
-import java.net.URL;
-
import edu.internet2.middleware.openid.common.ParameterMap;
import edu.internet2.middleware.openid.common.OpenIDConstants.Parameter;
import edu.internet2.middleware.openid.message.VerifyRequest;
@@ -37,12 +34,7 @@ public void unmarshallParameters(VerifyRequest request, ParameterMap parameters)
request.setIdentity(parameters.get(Parameter.identity.QNAME));
request.setInvalidateHandle(parameters.get(Parameter.invalidate_handle.QNAME));
request.setResponseNonce(parameters.get(Parameter.response_nonce.QNAME));
- try {
- String returnTo = parameters.get(Parameter.return_to.QNAME);
- request.setReturnTo(new URL(returnTo));
- } catch (MalformedURLException e) {
- // TODO
- }
+ request.setReturnTo(parameters.get(Parameter.return_to.QNAME));
request.setSignature(parameters.get(Parameter.sig.QNAME));
String signedFields = parameters.get(Parameter.signed.QNAME);
View
11 src/test/java/edu/internet2/middleware/openid/extensions/ax/FetchRequestTest.java
@@ -17,7 +17,6 @@
package edu.internet2.middleware.openid.extensions.ax;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -43,7 +42,7 @@
private Map<String, Integer> expectedAttributeCount;
/** Expected update URL. */
- private URL expectedUpdateURL;
+ private String expectedUpdateURL;
/**
* Constructor.
@@ -60,7 +59,7 @@ public FetchRequestTest() throws MalformedURLException {
"http://example.com/schema/favourite_movie", });
expectedAttributeCount = new HashMap<String, Integer>();
expectedAttributeCount.put("http://example.com/schema/favourite_movie", 3);
- expectedUpdateURL = new URL("http://idconsumer.com/update?transaction_id=a6b5c41");
+ expectedUpdateURL = "http://idconsumer.com/update?transaction_id=a6b5c41";
}
/** {@inheritDoc} */
@@ -94,9 +93,9 @@ public void testMessageUnmarshall() {
assertEquals("FetchRequest attribute count was " + attributeCount + ", expected " + expectedAttributeCount,
expectedAttributeCount, attributeCount);
- URL updateURL = request.getUpdateURL();
- assertEquals("SimpleRegistrationRequest policyURL was " + updateURL.toString() + ", expected "
- + expectedUpdateURL.toString(), expectedUpdateURL.toString(), updateURL.toString());
+ String updateURL = request.getUpdateURL();
+ assertEquals("SimpleRegistrationRequest policyURL was " + updateURL + ", expected " + expectedUpdateURL,
+ expectedUpdateURL, updateURL);
}
}
View
11 src/test/java/edu/internet2/middleware/openid/extensions/ax/FetchResponseTest.java
@@ -17,7 +17,6 @@
package edu.internet2.middleware.openid.extensions.ax;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -38,7 +37,7 @@
private Map<String, List<String>> expectedAttributes;
/** Expected update URL. */
- private URL expectedUpdateURL;
+ private String expectedUpdateURL;
/**
* Constructor.
@@ -56,7 +55,7 @@ public FetchResponseTest() throws MalformedURLException {
expectedAttributes.put("http://example.com/schema/favourite_movie", Arrays.asList(new String[] { "Movie1",
"Movie2", }));
- expectedUpdateURL = new URL("http://idconsumer.com/update?transaction_id=a6b5c41");
+ expectedUpdateURL = "http://idconsumer.com/update?transaction_id=a6b5c41";
}
/** {@inheritDoc} */
@@ -80,9 +79,9 @@ public void testMessageUnmarshall() {
assertEquals("FetchResponse attributes were " + attributes + ", expected " + expectedAttributes,
expectedAttributes, attributes);
- URL updateURL = response.getUpdateURL();
- assertEquals("FetchResposne updateURL was " + updateURL.toString() + ", expected "
- + expectedUpdateURL.toString(), expectedUpdateURL.toString(), updateURL.toString());
+ String updateURL = response.getUpdateURL();
+ assertEquals("FetchResposne updateURL was " + updateURL + ", expected " + expectedUpdateURL, expectedUpdateURL,
+ updateURL);
}
}
View
11 src/test/java/edu/internet2/middleware/openid/extensions/sreg/SimpleRegistrationRequestTest.java
@@ -17,7 +17,6 @@
package edu.internet2.middleware.openid.extensions.sreg;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.EnumSet;
import edu.internet2.middleware.openid.extensions.BaseMessageExtensionTestCase;
@@ -35,7 +34,7 @@
private EnumSet<Field> expectedOptional;
/** Expected policy URL. */
- private URL expectedPolicyURL;
+ private String expectedPolicyURL;
/**
* Constructor.
@@ -47,7 +46,7 @@ public SimpleRegistrationRequestTest() throws MalformedURLException {
expectedRequired = EnumSet.of(Field.fullname, Field.email);
expectedOptional = EnumSet.of(Field.language, Field.timezone);
- expectedPolicyURL = new URL("http://example.com/sreg.policy");
+ expectedPolicyURL = "http://example.com/sreg.policy";
}
/** {@inheritDoc} */
@@ -73,9 +72,9 @@ public void testMessageUnmarshall() {
assertEquals("SimpleRegistrationRequest optional was " + optional + ", expected " + expectedOptional,
expectedOptional, optional);
- URL policyURL = request.getPolicyURL();
- assertEquals("SimpleRegistrationRequest policyURL was " + policyURL.toString() + ", expected "
- + expectedPolicyURL.toString(), expectedPolicyURL.toString(), policyURL.toString());
+ String policyURL = request.getPolicyURL();
+ assertEquals("SimpleRegistrationRequest policyURL was " + policyURL + ", expected " + expectedPolicyURL,
+ expectedPolicyURL, policyURL);
}
}
View
12 src/test/java/edu/internet2/middleware/openid/message/AuthenticationImmediateRequestTest.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
-
import javax.xml.namespace.QName;
import org.slf4j.Logger;
@@ -47,7 +45,7 @@
private String expectedAssociationHandle;
/** Expected return to URL. */
- private URL expectedReturnTo;
+ private String expectedReturnTo;
/** Expected realm. */
private String expectedRealm;
@@ -65,7 +63,7 @@ public void setUp() throws Exception {
expectedClaimedId = "http://example.org/";
expectedIdentity = "http://example.com/username";
expectedAssociationHandle = "foobar";
- expectedReturnTo = new URL("http://rp.example.com/consumer");
+ expectedReturnTo = "http://rp.example.com/consumer";
expectedRealm = "http://rp.example.com/";
}
@@ -103,9 +101,9 @@ public void testMessageUnmarshall() {
assertEquals("AuthenticationRequest assoc_handle was " + handle + ", expected " + expectedAssociationHandle,
expectedAssociationHandle, handle);
- URL returnTo = request.getReturnTo();
- assertEquals("AuthenticationRequest return_to was " + returnTo.toString() + ", expected "
- + expectedReturnTo.toString(), expectedReturnTo.toString(), returnTo.toString());
+ String returnTo = request.getReturnTo();
+ assertEquals("AuthenticationRequest return_to was " + returnTo + ", expected " + expectedReturnTo,
+ expectedReturnTo, returnTo);
String realm = request.getRealm();
assertEquals("AuthenticationRequest realm was " + realm + ", expected " + expectedRealm, expectedRealm, realm);
View
12 src/test/java/edu/internet2/middleware/openid/message/AuthenticationInteractiveRequestTest.java
@@ -16,8 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
-
import javax.xml.namespace.QName;
import org.slf4j.Logger;
@@ -47,7 +45,7 @@
private String expectedAssociationHandle;
/** Expected return to URL. */
- private URL expectedReturnTo;
+ private String expectedReturnTo;
/** Expected realm. */
private String expectedRealm;
@@ -65,7 +63,7 @@ public void setUp() throws Exception {
expectedClaimedId = "http://example.org/";
expectedIdentity = "http://example.com/username";
expectedAssociationHandle = "foobar";
- expectedReturnTo = new URL("http://rp.example.com/consumer");
+ expectedReturnTo = "http://rp.example.com/consumer";
expectedRealm = "http://rp.example.com/";
}
@@ -103,9 +101,9 @@ public void testMessageUnmarshall() {
assertEquals("AuthenticationRequest assoc_handle was " + handle + ", expected " + expectedAssociationHandle,
expectedAssociationHandle, handle);
- URL returnTo = request.getReturnTo();
- assertEquals("AuthenticationRequest return_to was " + returnTo.toString() + ", expected "
- + expectedReturnTo.toString(), expectedReturnTo.toString(), returnTo.toString());
+ String returnTo = request.getReturnTo();
+ assertEquals("AuthenticationRequest return_to was " + returnTo + ", expected " + expectedReturnTo,
+ expectedReturnTo, returnTo);
String realm = request.getRealm();
assertEquals("AuthenticationRequest realm was " + realm + ", expected " + expectedRealm, expectedRealm, realm);
View
11 src/test/java/edu/internet2/middleware/openid/message/PositiveAssertionTest.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
import java.util.Arrays;
import java.util.List;
@@ -53,7 +52,7 @@
private String expectedAssociationHandle;
/** Expected return to URL. */
- private URL expectedReturnTo;
+ private String expectedReturnTo;
/** Expected response nonce. */
private String expectedNonce;
@@ -80,7 +79,7 @@ public void setUp() throws Exception {
expectedEndpoint = "http://openid.example.com/server";
expectedClaimedId = "http://example.org/";
expectedIdentity = "http://example.com/username";
- expectedReturnTo = new URL("http://rp.example.com/consumer");
+ expectedReturnTo = "http://rp.example.com/consumer";
expectedNonce = "123";
expectedInvalidateHandle = "old-handle";
expectedAssociationHandle = "new-handle";
@@ -126,9 +125,9 @@ public void testMessageUnmarshall() {
assertEquals("PositiveAssertion identity was " + identity + ", expected " + expectedIdentity, expectedIdentity,
identity);
- URL returnTo = response.getReturnTo();
- assertEquals("PositiveAssertion return_to was " + returnTo.toString() + ", expected "
- + expectedReturnTo.toString(), expectedReturnTo.toString(), returnTo.toString());
+ String returnTo = response.getReturnTo();
+ assertEquals("PositiveAssertion return_to was " + returnTo + ", expected " + expectedReturnTo,
+ expectedReturnTo, returnTo);
String nonce = response.getResponseNonce();
assertEquals("PositiveAssertion response_nonce was " + nonce + ", expected " + expectedNonce, expectedNonce,
View
12 src/test/java/edu/internet2/middleware/openid/message/VerifyRequestTest.java
@@ -16,7 +16,6 @@
package edu.internet2.middleware.openid.message;
-import java.net.URL;
import java.util.Arrays;
import java.util.List;
@@ -53,7 +52,7 @@
private String expectedAssociationHandle;
/** Expected return to URL. */
- private URL expectedReturnTo;
+ private String expectedReturnTo;
/** Expected response nonce. */
private String expectedNonce;
@@ -80,7 +79,7 @@ public void setUp() throws Exception {
expectedEndpoint = "http://openid.example.com/server";
expectedClaimedId = "http://example.org/";
expectedIdentity = "http://example.com/username";
- expectedReturnTo = new URL("http://rp.example.com/consumer");
+ expectedReturnTo = "http://rp.example.com/consumer";
expectedNonce = "123";
expectedInvalidateHandle = "old-handle";
expectedAssociationHandle = "new-handle";
@@ -126,10 +125,9 @@ public void testMessageUnmarshall() {
assertEquals("VerifyRequest identity was " + identity + ", expected " + expectedIdentity, expectedIdentity,
identity);
- URL returnTo = request.getReturnTo();
- assertEquals(
- "VerifyRequest return_to was " + returnTo.toString() + ", expected " + expectedReturnTo.toString(),
- expectedReturnTo.toString(), returnTo.toString());
+ String returnTo = request.getReturnTo();
+ assertEquals("VerifyRequest return_to was " + returnTo + ", expected " + expectedReturnTo, expectedReturnTo,
+ returnTo);
String nonce = request.getResponseNonce();
assertEquals("VerifyRequest response_nonce was " + nonce + ", expected " + expectedNonce, expectedNonce, nonce);
View
5 src/test/java/edu/internet2/middleware/openid/security/SecurityUtilsTest.java
@@ -17,7 +17,6 @@
package edu.internet2.middleware.openid.security;
import java.net.MalformedURLException;
-import java.net.URL;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
@@ -75,7 +74,7 @@ public void testMessageSigning() throws SecurityException, MalformedURLException
response.setClaimedId("http://example.org/");
response.setIdentity("http://example.com/username");
response.setResponseNonce("2001-01-01T00:00:00ZUNIQUE");
- response.setReturnTo(new URL("http://rp.example.com/consumer"));
+ response.setReturnTo("http://rp.example.com/consumer");
response.setEndpoint("http://openid.example.com/server");
SecurityUtils.signMessage(response, association);
@@ -92,7 +91,7 @@ public void testSignatureVerification() throws SecurityException {
String messageFile = "/data/edu/internet2/middleware/openid/security/signed-message-1.txt";
PositiveAssertion response = (PositiveAssertion) unmarshallMessage(messageFile);
Association association = getAssociation();
-
+
assertTrue(SecurityUtils.signatureIsValid(response, association));
}
Please sign in to comment.
Something went wrong with that request. Please try again.