SAML-Toolkits / java-saml

Java SAML toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description states support for Java6

tonysgi opened this issue · comments

I was looking at upgrading from the 1.1.2 since I saw the following in the description:

"This is version 2.0.0, compatible with java6 / java7 / java8"

But after importing the projects into eclipse I saw an error that java.util.Objects was not found due to it being part of java7+.

Is there indeed support for java6 or does this warrant a correction in the description?

Hi @tonysgi

The toolkit tried to be compatible with java6 too.

It seems that we introduced a java7 dependency when used java.util.Objects to compare objects.

We should fix that and replace it with a solution that uses java.util.Objects when available, or a custom compare method.

Can you remove the imports and its use, instead of:

!Objects.equals(responseInResponseTo, requestId)

use

!responseInResponseTo.equals(requestId)

and let me know if there are more Java 7 dependencies?

Thanks.

So I made the changes and the items that are left are:

HttpRequest.java

HttpRequest that = (HttpRequest) o; return Objects.equals(requestURL, that.requestURL) && Objects.equals(parameters, that.parameters);

and

public int hashCode() { return Objects.hash(requestURL, parameters); }

In Util.java in the validateXML method:

validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");

The above has errors:

ACCESS_EXTERNAL_DTD cannot be resolved or is not a field
ACCESS_EXTERNAL_SCHEMA cannot be resolved or is not a field

On HttpRequest.java you will need to replace the way requestURL is compared.

Related to the Objects.hash, maybe replace it by String.hashCode ?

Ty, it seems ACCESS_EXTERNAL_DTD and ACCESS_EXTERNAL_SCHEMA were introduced in Java 7.0 also.

Hi tonysgi,

do you have the updated java 1.6 compatible java-saml library ? did you face any other issues? could you please share so that i can also use? thank you.

Hello everyone,

Was anyone able to make a saml compatible with Java 1.6 by any chance?

Thanks

@pitbulk Are you still willing to accept a PR that removes the Java 1.7 language features? If so, I'd like to finish this out.

Just in case someone is interested, I had to compile java-saml under JDK 6 for an old WebSphere instance.

Fork is available at:
https://github.com/mguessan/java-saml