Remove deprecated Cookie usage
Remove usage of comment and verison usage Signed-off-by: M-Faheem-Khan <faheem5948@gmail.com>
This commit is contained in:
@@ -372,9 +372,6 @@ public abstract class AbstractRememberMeServices
|
||||
if (this.cookieDomain != null) {
|
||||
cookie.setDomain(this.cookieDomain);
|
||||
}
|
||||
if (maxAge < 1) {
|
||||
cookie.setVersion(1);
|
||||
}
|
||||
cookie.setSecure((this.useSecureCookie != null) ? this.useSecureCookie : request.isSecure());
|
||||
cookie.setHttpOnly(true);
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ class FirewalledResponse extends HttpServletResponseWrapper {
|
||||
validateCrlf(SET_COOKIE_HEADER, cookie.getValue());
|
||||
validateCrlf(SET_COOKIE_HEADER, cookie.getPath());
|
||||
validateCrlf(SET_COOKIE_HEADER, cookie.getDomain());
|
||||
validateCrlf(SET_COOKIE_HEADER, cookie.getComment());
|
||||
}
|
||||
super.addCookie(cookie);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,9 @@ class CookieDeserializer extends JsonDeserializer<Cookie> {
|
||||
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
|
||||
JsonNode jsonNode = mapper.readTree(jp);
|
||||
Cookie cookie = new Cookie(readJsonNode(jsonNode, "name").asText(), readJsonNode(jsonNode, "value").asText());
|
||||
cookie.setComment(readJsonNode(jsonNode, "comment").asText());
|
||||
cookie.setDomain(readJsonNode(jsonNode, "domain").asText());
|
||||
cookie.setMaxAge(readJsonNode(jsonNode, "maxAge").asInt(-1));
|
||||
cookie.setSecure(readJsonNode(jsonNode, "secure").asBoolean());
|
||||
cookie.setVersion(readJsonNode(jsonNode, "version").asInt());
|
||||
cookie.setPath(readJsonNode(jsonNode, "path").asText());
|
||||
JsonNode attributes = readJsonNode(jsonNode, "attributes");
|
||||
cookie.setHttpOnly(readJsonNode(attributes, "HttpOnly") != null);
|
||||
|
||||
@@ -44,10 +44,8 @@ abstract class SavedCookieMixin {
|
||||
|
||||
@JsonCreator
|
||||
SavedCookieMixin(@JsonProperty("name") String name, @JsonProperty("value") String value,
|
||||
@JsonProperty("comment") String comment, @JsonProperty("domain") String domain,
|
||||
@JsonProperty("maxAge") int maxAge, @JsonProperty("path") String path,
|
||||
@JsonProperty("secure") boolean secure, @JsonProperty("version") int version) {
|
||||
|
||||
@JsonProperty("domain") String domain, @JsonProperty("maxAge") int maxAge,
|
||||
@JsonProperty("path") String path, @JsonProperty("secure") boolean secure) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ public class SavedCookie implements Serializable {
|
||||
|
||||
private final String value;
|
||||
|
||||
private final String comment;
|
||||
|
||||
private final String domain;
|
||||
|
||||
private final int maxAge;
|
||||
@@ -45,28 +43,13 @@ public class SavedCookie implements Serializable {
|
||||
|
||||
private final boolean secure;
|
||||
|
||||
private final int version;
|
||||
|
||||
/**
|
||||
* @deprecated use
|
||||
* {@link org.springframework.security.web.savedrequest.SavedCookie#SavedCookie(String, String, String, int, String, boolean)}
|
||||
* instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.1")
|
||||
public SavedCookie(String name, String value, String comment, String domain, int maxAge, String path,
|
||||
boolean secure, int version) {
|
||||
public SavedCookie(String name, String value, String domain, int maxAge, String path, boolean secure) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.comment = comment;
|
||||
this.domain = domain;
|
||||
this.maxAge = maxAge;
|
||||
this.path = path;
|
||||
this.secure = secure;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public SavedCookie(String name, String value, String domain, int maxAge, String path, boolean secure) {
|
||||
this(name, value, null, domain, maxAge, path, secure, 0);
|
||||
}
|
||||
|
||||
public SavedCookie(Cookie cookie) {
|
||||
@@ -82,11 +65,6 @@ public class SavedCookie implements Serializable {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true, since = "6.1")
|
||||
public String getComment() {
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
return this.domain;
|
||||
}
|
||||
@@ -103,23 +81,14 @@ public class SavedCookie implements Serializable {
|
||||
return this.secure;
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true, since = "6.1")
|
||||
public int getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public Cookie getCookie() {
|
||||
Cookie cookie = new Cookie(getName(), getValue());
|
||||
if (getComment() != null) {
|
||||
cookie.setComment(getComment());
|
||||
}
|
||||
if (getDomain() != null) {
|
||||
cookie.setDomain(getDomain());
|
||||
}
|
||||
if (getPath() != null) {
|
||||
cookie.setPath(getPath());
|
||||
}
|
||||
cookie.setVersion(getVersion());
|
||||
cookie.setMaxAge(getMaxAge());
|
||||
cookie.setSecure(isSecure());
|
||||
return cookie;
|
||||
|
||||
Reference in New Issue
Block a user