diff --git a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java index 98d6fe7de2..f5c06ca7fc 100644 --- a/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java +++ b/cas/src/test/java/org/springframework/security/cas/authentication/CasAuthenticationProviderTests.java @@ -66,7 +66,7 @@ public class CasAuthenticationProviderTests { private ServiceProperties makeServiceProperties() { final ServiceProperties serviceProperties = new ServiceProperties(); serviceProperties.setSendRenew(false); - serviceProperties.setService("http://test.com"); + serviceProperties.setService("https://localhost"); return serviceProperties; } diff --git a/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy b/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy index 919b73999c..8de33bc278 100644 --- a/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy +++ b/config/src/test/groovy/org/springframework/security/config/http/HttpOpenIDConfigTests.groovy @@ -88,7 +88,7 @@ class OpenIDConfigTests extends AbstractHttpConfigTests { openIDFilter.setConsumer(new OpenIDConsumer() { public String beginConsumption(HttpServletRequest req, String claimedIdentity, String returnToUrl, String realm) throws OpenIDConsumerException { - return "http://testopenid.com?openid.return_to=" + returnToUrl; + return "https://testopenid.com?openid.return_to=" + returnToUrl; } public OpenIDAuthenticationToken endConsumption(HttpServletRequest req) throws OpenIDConsumerException { @@ -118,7 +118,7 @@ class OpenIDConfigTests extends AbstractHttpConfigTests { response.getContentAsString().contains(AbstractRememberMeServices.DEFAULT_PARAMETER) when: "Login is submitted with remember-me selected" request.servletPath = "/login/openid" - request.setParameter(OpenIDAuthenticationFilter.DEFAULT_CLAIMED_IDENTITY_FIELD, "http://ww1.openid.com") + request.setParameter(OpenIDAuthenticationFilter.DEFAULT_CLAIMED_IDENTITY_FIELD, "https://ww1.openid.com") request.setParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "on") response = new MockHttpServletResponse(); fc.doFilter(request, response, new MockFilterChain()); @@ -126,7 +126,7 @@ class OpenIDConfigTests extends AbstractHttpConfigTests { .append(AbstractRememberMeServices.DEFAULT_PARAMETER) .append("=").append("on").toString(); then: "return_to URL contains remember-me choice" - response.getRedirectedUrl() == "http://testopenid.com?openid.return_to=" + expectedReturnTo + response.getRedirectedUrl() == "https://testopenid.com?openid.return_to=" + expectedReturnTo } def openIDWithAttributeExchangeConfigurationIsParsedCorrectly() { @@ -141,7 +141,7 @@ class OpenIDConfigTests extends AbstractHttpConfigTests { } createAppContext() - List attributes = getFilter(OpenIDAuthenticationFilter).consumer.attributesToFetchFactory.createAttributeList('http://someid') + List attributes = getFilter(OpenIDAuthenticationFilter).consumer.attributesToFetchFactory.createAttributeList('https://someid') expect: attributes.size() == 2 diff --git a/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java b/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java index bda10f5d45..91f8388934 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java +++ b/crypto/src/main/java/org/springframework/security/crypto/codec/Base64.java @@ -41,9 +41,8 @@ public final class Base64 { /** * Encode using Base64-like encoding that is URL- and Filename-safe as described in - * Section 4 of RFC3548: https://www.faqs - * .org/rfcs/rfc3548.html. It is important to note that data encoded this way is + * Section 4 of RFC3548: https://tools.ietf.org/html/rfc3548. + * It is important to note that data encoded this way is * not officially valid Base64, or at the very least should not be called * Base64 without also specifying that is was encoded using the URL- and Filename-safe * dialect. @@ -51,9 +50,7 @@ public final class Base64 { public final static int URL_SAFE = 16; /** - * Encode using the special "ordered" dialect of Base64 described here: http://www.faqs.org/qa/rfcc-1940.html. + * Encode using the special "ordered" dialect of Base64. */ public final static int ORDERED = 32; @@ -127,9 +124,8 @@ public final class Base64 { /* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */ /** - * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: http://www.faqs.org/rfcs/rfc3548.html. + * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: + * https://tools.ietf.org/html/rfc3548. * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" * and "slash." */ @@ -189,12 +185,6 @@ public final class Base64 { /* ******** O R D E R E D B A S E 6 4 A L P H A B E T ******** */ - /** - * I don't get the point of this technique, but someone requested it, and it is - * described here: http://www.faqs.org/faqs/ - * qa/rfcc-1940.html. - */ private final static byte[] _ORDERED_ALPHABET = { (byte) '-', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', diff --git a/docs/manual/src/docs/asciidoc/_includes/faq.adoc b/docs/manual/src/docs/asciidoc/_includes/faq.adoc index c0be21c5f2..8642d19aef 100644 --- a/docs/manual/src/docs/asciidoc/_includes/faq.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/faq.adoc @@ -18,7 +18,7 @@ [[appendix-faq-other-concerns]] ==== Will Spring Security take care of all my application security requirements? -Spring Security provides you with a very flexible framework for your authentication and authorization requirements, but there are many other considerations for building a secure application that are outside its scope. Web applications are vulnerable to all kinds of attacks which you should be familiar with, preferably before you start development so you can design and code with them in mind from the beginning. Check out thehttp://www.owasp.org/[OWASP web site] for information on the major issues facing web application developers and the countermeasures you can use against them. +Spring Security provides you with a very flexible framework for your authentication and authorization requirements, but there are many other considerations for building a secure application that are outside its scope. Web applications are vulnerable to all kinds of attacks which you should be familiar with, preferably before you start development so you can design and code with them in mind from the beginning. Check out the https://www.owasp.org/[OWASP web site] for information on the major issues facing web application developers and the countermeasures you can use against them. [[appendix-faq-web-xml]] @@ -280,7 +280,7 @@ The prefix can be changed by setting the `rolePrefix` property of `RoleVoter`. I It will depend on what features you are using and what type of application you are developing. With Spring Security 3.0, the project jars are divided into clearly distinct areas of functionality, so it is straightforward to work out which Spring Security jars you need from your application requirements. All applications will need the `spring-security-core` jar. If you're developing a web application, you need the `spring-security-web` jar. If you're using security namespace configuration you need the `spring-security-config` jar, for LDAP support you need the `spring-security-ldap` jar and so on. -For third-party jars the situation isn't always quite so obvious. A good starting point is to copy those from one of the pre-built sample applications WEB-INF/lib directories. For a basic application, you can start with the tutorial sample. If you want to use LDAP, with an embedded test server, then use the LDAP sample as a starting point. The reference manual also includeshttp://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#appendix-dependencies[an appendix] listing the first-level dependencies for each Spring Security module with some information on whether they are optional and what they are required for. +For third-party jars the situation isn't always quite so obvious. A good starting point is to copy those from one of the pre-built sample applications WEB-INF/lib directories. For a basic application, you can start with the tutorial sample. If you want to use LDAP, with an embedded test server, then use the LDAP sample as a starting point. The reference manual also includes https://docs.spring.io/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#appendix-dependencies[an appendix] listing the first-level dependencies for each Spring Security module with some information on whether they are optional and what they are required for. If you are building your project with maven, then adding the appropriate Spring Security modules as dependencies to your pom.xml will automatically pull in the core jars that the framework requires. Any which are marked as "optional" in the Spring Security POM files will have to be added to your own pom.xml file if you need them. diff --git a/docs/manual/src/docs/asciidoc/index.adoc b/docs/manual/src/docs/asciidoc/index.adoc index bac83e133e..bbad97f481 100644 --- a/docs/manual/src/docs/asciidoc/index.adoc +++ b/docs/manual/src/docs/asciidoc/index.adoc @@ -3534,7 +3534,7 @@ $(document).ajaxSend(function(e, xhr, options) { }); ---- -As an alternative to jQuery, we recommend using http://cujojs.com/[cujoJS's] rest.js. The https://github.com/cujojs/rest[rest.js] module provides advanced support for working with HTTP requests and responses in RESTful ways. A core capability is the ability to contextualize the HTTP client adding behavior as needed by chaining interceptors on to the client. +As an alternative to jQuery, we recommend using https://github.com/cujojs[cujoJS's] rest.js. The https://github.com/cujojs/rest[rest.js] module provides advanced support for working with HTTP requests and responses in RESTful ways. A core capability is the ability to contextualize the HTTP client adding behavior as needed by chaining interceptors on to the client. [source,javascript] ---- diff --git a/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java b/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java index 88b9726c79..47c7f29693 100644 --- a/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java +++ b/openid/src/main/java/org/springframework/security/openid/OpenIDAuthenticationFilter.java @@ -254,8 +254,8 @@ public class OpenIDAuthenticationFilter extends AbstractAuthenticationProcessing * * If no mapping is provided then the returnToUrl will be parsed to extract the * protocol, hostname and port followed by a trailing slash. This means that - * https://www.example.com/login/openid will automatically become - * http://www.example.com:80/ + * https://localhost/login/openid will automatically become + * http://localhost:80/ * * @param realmMapping containing returnToUrl -> realm mappings */ diff --git a/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java b/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java index bb95a2db2c..c0fbe267eb 100644 --- a/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java +++ b/remoting/src/test/java/org/springframework/security/remoting/httpinvoker/AuthenticationSimpleHttpInvokerRequestExecutorTests.java @@ -61,7 +61,7 @@ public class AuthenticationSimpleHttpInvokerRequestExecutorTests { executor.prepareConnection(conn, 10); // Check connection properties - // See http://www.faqs.org/rfcs/rfc1945.html section 11.1 for example + // See https://tools.ietf.org/html/rfc1945 section 11.1 for example // we are comparing against assertThat(conn.getRequestProperty("Authorization")).isEqualTo( "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="); diff --git a/samples/javaconfig/hellojs/src/main/resources/resources/js/jquery-1.8.3.js b/samples/javaconfig/hellojs/src/main/resources/resources/js/jquery-1.8.3.js index 29d7a3efe7..5799710a74 100644 --- a/samples/javaconfig/hellojs/src/main/resources/resources/js/jquery-1.8.3.js +++ b/samples/javaconfig/hellojs/src/main/resources/resources/js/jquery-1.8.3.js @@ -881,7 +881,7 @@ jQuery.ready.promise = function( obj ) { try { // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ + // https://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); @@ -1390,7 +1390,7 @@ jQuery.support = (function() { fragment.appendChild( div ); // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ + // https://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP @@ -1945,7 +1945,7 @@ jQuery.fn.extend({ }); }, // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com + // https://blindsignals.com delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; @@ -6867,7 +6867,7 @@ if ( window.getComputedStyle ) { } // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + // https://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels @@ -9469,4 +9469,4 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } -})( window ); \ No newline at end of file +})( window ); diff --git a/samples/javaconfig/openid/src/main/resources/resources/js/openid-client/jquery.query-2.1.3.js b/samples/javaconfig/openid/src/main/resources/resources/js/openid-client/jquery.query-2.1.3.js index 29611c080b..e4320a7622 100644 --- a/samples/javaconfig/openid/src/main/resources/resources/js/openid-client/jquery.query-2.1.3.js +++ b/samples/javaconfig/openid/src/main/resources/resources/js/openid-client/jquery.query-2.1.3.js @@ -1,220 +1,220 @@ -/** - * jQuery.query - Query String Modification and Creation for jQuery - * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) - * Licensed under the WTFPL (http://www.wtfpl.net/). - * Date: 2009/02/08 - * - * @author Blair Mitchelmore - * @version 2.1.3 - * - **/ -new function(settings) { - // Various Settings - var $separator = settings.separator || '&'; - var $spaces = settings.spaces === false ? false : true; - var $suffix = settings.suffix === false ? '' : '[]'; - var $prefix = settings.prefix === false ? false : true; - var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; - var $numbers = settings.numbers === false ? false : true; - - jQuery.query = new function() { - var is = function(o, t) { - return o != undefined && o !== null && (!!t ? o.constructor == t : true); - }; - var parse = function(path) { - var m, rx = /\[([^[]*)\]/g, match = /^(\S+?)(\[\S*\])?$/.exec(path), base = match[1], tokens = []; - while (m = rx.exec(match[2])) tokens.push(m[1]); - return [base, tokens]; - }; - var set = function(target, tokens, value) { - var o, token = tokens.shift(); - if (typeof target != 'object') target = null; - if (token === "") { - if (!target) target = []; - if (is(target, Array)) { - target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); - } else if (is(target, Object)) { - var i = 0; - while (target[i++] != null); - target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value); - } else { - target = []; - target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); - } - } else if (token && token.match(/^\s*[0-9]+\s*$/)) { - var index = parseInt(token, 10); - if (!target) target = []; - target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); - } else if (token) { - var index = token.replace(/^\s*|\s*$/g, ""); - if (!target) target = {}; - if (is(target, Array)) { - var temp = {}; - for (var i = 0; i < target.length; ++i) { - temp[i] = target[i]; - } - target = temp; - } - target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); - } else { - return value; - } - return target; - }; - - var queryObject = function(a) { - var self = this; - self.keys = {}; - - if (a.queryObject) { - jQuery.each(a.get(), function(key, val) { - self.SET(key, val); - }); - } else { - jQuery.each(arguments, function() { - var q = "" + this; - q = decodeURIComponent(q); - q = q.replace(/^[?#]/,''); // remove any leading ? || # - q = q.replace(/[;&]$/,''); // remove any trailing & || ; - if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces - - jQuery.each(q.split(/[&;]/), function(){ - var key = this.split('=')[0]; - var val = this.split('=')[1]; - - if (!key) return; - - if ($numbers) { - if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) // simple float regex - val = parseFloat(val); - else if (/^[+-]?[0-9]+$/.test(val)) // simple int regex - val = parseInt(val, 10); - } - - val = (!val && val !== 0) ? true : val; - - if (val !== false && val !== true && typeof val != 'number') - val = val; - - self.SET(key, val); - }); - }); - } - return self; - }; - - queryObject.prototype = { - queryObject: true, - has: function(key, type) { - var value = this.get(key); - return is(value, type); - }, - GET: function(key) { - if (!is(key)) return this.keys; - var parsed = parse(key), base = parsed[0], tokens = parsed[1]; - var target = this.keys[base]; - while (target != null && tokens.length != 0) { - target = target[tokens.shift()]; - } - return typeof target == 'number' ? target : target || ""; - }, - get: function(key) { - var target = this.GET(key); - if (is(target, Object)) - return jQuery.extend(true, {}, target); - else if (is(target, Array)) - return target.slice(0); - return target; - }, - SET: function(key, val) { - var value = !is(val) ? null : val; - var parsed = parse(key), base = parsed[0], tokens = parsed[1]; - var target = this.keys[base]; - this.keys[base] = set(target, tokens.slice(0), value); - return this; - }, - set: function(key, val) { - return this.copy().SET(key, val); - }, - REMOVE: function(key) { - return this.SET(key, null).COMPACT(); - }, - remove: function(key) { - return this.copy().REMOVE(key); - }, - EMPTY: function() { - var self = this; - jQuery.each(self.keys, function(key, value) { - delete self.keys[key]; - }); - return self; - }, - load: function(url) { - var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); - var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); - return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash); - }, - empty: function() { - return this.copy().EMPTY(); - }, - copy: function() { - return new queryObject(this); - }, - COMPACT: function() { - function build(orig) { - var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; - if (typeof orig == 'object') { - function add(o, key, value) { - if (is(o, Array)) - o.push(value); - else - o[key] = value; - } - jQuery.each(orig, function(key, value) { - if (!is(value)) return true; - add(obj, key, build(value)); - }); - } - return obj; - } - this.keys = build(this.keys); - return this; - }, - compact: function() { - return this.copy().COMPACT(); - }, - toString: function() { - var i = 0, queryString = [], chunks = [], self = this; - var addFields = function(arr, key, value) { - if (!is(value) || value === false) return; - var o = [encodeURIComponent(key)]; - if (value !== true) { - o.push("="); - o.push(encodeURIComponent(value)); - } - arr.push(o.join("")); - }; - var build = function(obj, base) { - var newKey = function(key) { - return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join(""); - }; - jQuery.each(obj, function(key, value) { - if (typeof value == 'object') - build(value, newKey(key)); - else - addFields(chunks, newKey(key), value); - }); - }; - - build(this.keys); - - if (chunks.length > 0) queryString.push($hash); - queryString.push(chunks.join($separator)); - - return queryString.join(""); - } - }; - - return new queryObject(location.search, location.hash); - }; -}(jQuery.query || {}); // Pass in jQuery.query as settings object +/** + * jQuery.query - Query String Modification and Creation for jQuery + * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) + * Licensed under the WTFPL (https://www.wtfpl.net/). + * Date: 2009/02/08 + * + * @author Blair Mitchelmore + * @version 2.1.3 + * + **/ +new function(settings) { + // Various Settings + var $separator = settings.separator || '&'; + var $spaces = settings.spaces === false ? false : true; + var $suffix = settings.suffix === false ? '' : '[]'; + var $prefix = settings.prefix === false ? false : true; + var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; + var $numbers = settings.numbers === false ? false : true; + + jQuery.query = new function() { + var is = function(o, t) { + return o != undefined && o !== null && (!!t ? o.constructor == t : true); + }; + var parse = function(path) { + var m, rx = /\[([^[]*)\]/g, match = /^(\S+?)(\[\S*\])?$/.exec(path), base = match[1], tokens = []; + while (m = rx.exec(match[2])) tokens.push(m[1]); + return [base, tokens]; + }; + var set = function(target, tokens, value) { + var o, token = tokens.shift(); + if (typeof target != 'object') target = null; + if (token === "") { + if (!target) target = []; + if (is(target, Array)) { + target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); + } else if (is(target, Object)) { + var i = 0; + while (target[i++] != null); + target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value); + } else { + target = []; + target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); + } + } else if (token && token.match(/^\s*[0-9]+\s*$/)) { + var index = parseInt(token, 10); + if (!target) target = []; + target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); + } else if (token) { + var index = token.replace(/^\s*|\s*$/g, ""); + if (!target) target = {}; + if (is(target, Array)) { + var temp = {}; + for (var i = 0; i < target.length; ++i) { + temp[i] = target[i]; + } + target = temp; + } + target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); + } else { + return value; + } + return target; + }; + + var queryObject = function(a) { + var self = this; + self.keys = {}; + + if (a.queryObject) { + jQuery.each(a.get(), function(key, val) { + self.SET(key, val); + }); + } else { + jQuery.each(arguments, function() { + var q = "" + this; + q = decodeURIComponent(q); + q = q.replace(/^[?#]/,''); // remove any leading ? || # + q = q.replace(/[;&]$/,''); // remove any trailing & || ; + if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces + + jQuery.each(q.split(/[&;]/), function(){ + var key = this.split('=')[0]; + var val = this.split('=')[1]; + + if (!key) return; + + if ($numbers) { + if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) // simple float regex + val = parseFloat(val); + else if (/^[+-]?[0-9]+$/.test(val)) // simple int regex + val = parseInt(val, 10); + } + + val = (!val && val !== 0) ? true : val; + + if (val !== false && val !== true && typeof val != 'number') + val = val; + + self.SET(key, val); + }); + }); + } + return self; + }; + + queryObject.prototype = { + queryObject: true, + has: function(key, type) { + var value = this.get(key); + return is(value, type); + }, + GET: function(key) { + if (!is(key)) return this.keys; + var parsed = parse(key), base = parsed[0], tokens = parsed[1]; + var target = this.keys[base]; + while (target != null && tokens.length != 0) { + target = target[tokens.shift()]; + } + return typeof target == 'number' ? target : target || ""; + }, + get: function(key) { + var target = this.GET(key); + if (is(target, Object)) + return jQuery.extend(true, {}, target); + else if (is(target, Array)) + return target.slice(0); + return target; + }, + SET: function(key, val) { + var value = !is(val) ? null : val; + var parsed = parse(key), base = parsed[0], tokens = parsed[1]; + var target = this.keys[base]; + this.keys[base] = set(target, tokens.slice(0), value); + return this; + }, + set: function(key, val) { + return this.copy().SET(key, val); + }, + REMOVE: function(key) { + return this.SET(key, null).COMPACT(); + }, + remove: function(key) { + return this.copy().REMOVE(key); + }, + EMPTY: function() { + var self = this; + jQuery.each(self.keys, function(key, value) { + delete self.keys[key]; + }); + return self; + }, + load: function(url) { + var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); + var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); + return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash); + }, + empty: function() { + return this.copy().EMPTY(); + }, + copy: function() { + return new queryObject(this); + }, + COMPACT: function() { + function build(orig) { + var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; + if (typeof orig == 'object') { + function add(o, key, value) { + if (is(o, Array)) + o.push(value); + else + o[key] = value; + } + jQuery.each(orig, function(key, value) { + if (!is(value)) return true; + add(obj, key, build(value)); + }); + } + return obj; + } + this.keys = build(this.keys); + return this; + }, + compact: function() { + return this.copy().COMPACT(); + }, + toString: function() { + var i = 0, queryString = [], chunks = [], self = this; + var addFields = function(arr, key, value) { + if (!is(value) || value === false) return; + var o = [encodeURIComponent(key)]; + if (value !== true) { + o.push("="); + o.push(encodeURIComponent(value)); + } + arr.push(o.join("")); + }; + var build = function(obj, base) { + var newKey = function(key) { + return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join(""); + }; + jQuery.each(obj, function(key, value) { + if (typeof value == 'object') + build(value, newKey(key)); + else + addFields(chunks, newKey(key), value); + }); + }; + + build(this.keys); + + if (chunks.length > 0) queryString.push($hash); + queryString.push(chunks.join($separator)); + + return queryString.join(""); + } + }; + + return new queryObject(location.search, location.hash); + }; +}(jQuery.query || {}); // Pass in jQuery.query as settings object diff --git a/samples/javaconfig/openid/src/main/resources/views/login.html b/samples/javaconfig/openid/src/main/resources/views/login.html index 0d46e3b163..5b295105f5 100644 --- a/samples/javaconfig/openid/src/main/resources/views/login.html +++ b/samples/javaconfig/openid/src/main/resources/views/login.html @@ -23,7 +23,7 @@