X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.security.mvc%2Fsrc%2Forg%2Fargeo%2Fsecurity%2Fmvc%2FArgeoRememberMeServices.java;fp=org.argeo.security.mvc%2Fsrc%2Forg%2Fargeo%2Fsecurity%2Fmvc%2FArgeoRememberMeServices.java;h=0000000000000000000000000000000000000000;hb=b51d4215cb90b66e3eaf39b00437075e4742acd6;hp=bf73e073baf479c53d38cd1204f6d6a0e85d2319;hpb=94639faebab4cad06d8c8845a530f3fcdc36ca5c;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.security.mvc/src/org/argeo/security/mvc/ArgeoRememberMeServices.java b/org.argeo.security.mvc/src/org/argeo/security/mvc/ArgeoRememberMeServices.java deleted file mode 100644 index bf73e073b..000000000 --- a/org.argeo.security.mvc/src/org/argeo/security/mvc/ArgeoRememberMeServices.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2007-2012 Mathieu Baudier - * - * 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.argeo.security.mvc; - -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices; - -public class ArgeoRememberMeServices extends TokenBasedRememberMeServices { - public final static String DEFAULT_COOKIE_NAME = "ARGEO_SECURITY"; - - public ArgeoRememberMeServices() { - setCookieName(DEFAULT_COOKIE_NAME); - } - - /** - * Sets a "cancel cookie" (with maxAge = 0) on the response to disable - * persistent logins. - * - * @param request - * @param response - */ - protected void cancelCookie(HttpServletRequest request, - HttpServletResponse response) { - Cookie cookie = new Cookie(getCookieName(), null); - cookie.setMaxAge(0); - cookie.setPath("/"); - - response.addCookie(cookie); - } - - /** - * Sets the cookie on the response - * - * @param tokens - * the tokens which will be encoded to make the cookie value. - * @param maxAge - * the value passed to {@link Cookie#setMaxAge(int)} - * @param request - * the request - * @param response - * the response to add the cookie to. - */ - protected void setCookie(String[] tokens, int maxAge, - HttpServletRequest request, HttpServletResponse response) { - String cookieValue = encodeCookie(tokens); - Cookie cookie = new Cookie(getCookieName(), cookieValue); - cookie.setMaxAge(maxAge); - cookie.setPath("/"); - response.addCookie(cookie); - } - -}