diff --git a/.gitmodules b/.gitmodules index 52e3f3b..9c98ac9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "submodules/client-libs-java-samples"] - path = submodules/client-libs-java-samples - url = https://github.com/Adscore/client-libs-java-samples +[submodule "sample/client-libs-java-samples"] + path = sample/client-libs-java-samples + url = https://github.com/Adscore/client-libs-java-samples.git diff --git a/README.md b/README.md index 76984c9..07ad19d 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,9 @@ The definition of verify function looks as follows: * customers this should be always set to 'customer' * @param key string containing related zone key * @param ipAddresses array of strings containing ip4 or ip6 addresses against which we check - * signature + * signature. Usually, is fulfilled from httpXForwardForIpAddresses or/and remoteIpAddresses + * header. All possible ip addresses may be provided at once, in case of correct result, + * verifier returns list of chosen ip addresses that matched with the signature. * @param expiry number which is time in seconds. IF signatureTime + expiry > CurrentDateInSeconds * THEN result is expired. If null than expiry is not checked. * @param isKeyBase64Encoded boolean defining if passed key is base64 encoded or not @@ -124,6 +126,9 @@ The definition of verify function looks as follows: [Integer expiry (=null),] // optional due existance of overloaded function String... ipAddresses) { ``` +Executable samples you can find on: +https://github.com/Adscore/client-libs-java-samples +
(See section Samples above). Following are few quick examples of how to use verifier, first import the entry point for library: @@ -172,6 +177,8 @@ than you have at least few options of how to verify signatures: "customer", "key_non_base64_encoded", false, // notify that we use non encoded key + + //Multiple ip addresses either from httpXForwardForIpAddresses and remoteIpAddresses header "73.109.57.137", "73.109.57.138", "73.109.57.139", "73.109.57.140", "0:0:0:0:0:ffff:4d73:55d3", "0:0:0:0:0:fffff:4d73:55d4", "0:0:0:0:0:fffff:4d73:55d5", "0:0:0:0:0:fffff:4d73:55d6"); [..] diff --git a/submodules/client-libs-java-samples b/sample/client-libs-java-samples similarity index 100% rename from submodules/client-libs-java-samples rename to sample/client-libs-java-samples diff --git a/src/main/java/com/adscore/signature/SignatureVerifier.java b/src/main/java/com/adscore/signature/SignatureVerifier.java index 184c27a..1a52bca 100644 --- a/src/main/java/com/adscore/signature/SignatureVerifier.java +++ b/src/main/java/com/adscore/signature/SignatureVerifier.java @@ -44,7 +44,9 @@ public class SignatureVerifier { * customers this should be always set to 'customer' * @param key string containing related zone key * @param ipAddresses array of strings containing ip4 or ip6 addresses against which we check - * signature + * signature. Usually, is fulfilled from httpXForwardForIpAddresses or/and remoteIpAddresses + * header. All possible ip addresses may be provided at once, in case of correct result, + * verifier returns list of chosen ip addresses that matched with the signature. * @return VerificationResult */ public static SignatureVerificationResult verify( @@ -61,7 +63,9 @@ public static SignatureVerificationResult verify( * customers this should be always set to 'customer' * @param key string containing related zone key * @param ipAddresses array of strings containing ip4 or ip6 addresses against which we check - * signature + * signature. Usually, is fulfilled from httpXForwardForIpAddresses or/and remoteIpAddresses + * header. All possible ip addresses may be provided at once, in case of correct result, + * verifier returns list of chosen ip addresses that matched with the signature. * @param expiry number which is time in seconds. IF signatureTime + expiry > CurrentDateInSeconds * THEN result is expired * @return VerificationResult @@ -87,7 +91,9 @@ public static SignatureVerificationResult verify( * customers this should be always set to 'customer' * @param key string containing related zone key * @param ipAddresses array of strings containing ip4 or ip6 addresses against which we check - * signature + * signature. Usually, is fulfilled from httpXForwardForIpAddresses or/and remoteIpAddresses + * header. All possible ip addresses may be provided at once, in case of correct result, + * verifier returns list of chosen ip addresses that matched with the signature. * @param isKeyBase64Encoded boolean defining if passed key is base64 encoded or not * @return VerificationResult */ @@ -117,7 +123,9 @@ public static SignatureVerificationResult verify( * customers this should be always set to 'customer' * @param key string containing related zone key * @param ipAddresses array of strings containing ip4 or ip6 addresses against which we check - * signature + * signature. Usually, is fulfilled from httpXForwardForIpAddresses or/and remoteIpAddresses + * header. All possible ip addresses may be provided at once, in case of correct result, + * verifier returns list of chosen ip addresses that matched with the signature. * @param expiry number which is time in seconds. IF signatureTime + expiry > CurrentDateInSeconds * THEN result is expired * @param isKeyBase64Encoded boolean defining if passed key is base64 encoded or not