Permalink
Browse files

cookies - Introduced domain & secure flags on RestxSessionCookieDescr…

…iptor
  • Loading branch information...
fcamblor committed Aug 22, 2017
1 parent 2c0fbbd commit 6529fad40fa17e5081fbbacd53f1cc8db90a8872
Showing with 19 additions and 0 deletions.
  1. +19 −0 restx-core/src/main/java/restx/security/RestxSessionCookieDescriptor.java
@@ -1,5 +1,7 @@
package restx.security;
import com.google.common.base.Optional;
import static restx.http.HTTP.headerTokenCompatible;
/**
@@ -8,10 +10,19 @@
public class RestxSessionCookieDescriptor {
private String cookieName;
private String cookieSignatureName;
private String domain;
private Boolean secure;
public RestxSessionCookieDescriptor(String cookieName, String cookieSignatureName) {
this(cookieName, cookieSignatureName, Optional.<String>absent(), Optional.<Boolean>absent());
}
public RestxSessionCookieDescriptor(String cookieName, String cookieSignatureName,
Optional<String> domain, Optional<Boolean> secure) {
this.cookieName = headerTokenCompatible(cookieName, "_");
this.cookieSignatureName = headerTokenCompatible(cookieSignatureName, "_");
this.domain = domain.orNull();
this.secure = secure.orNull();
}
public String getCookieName() {
@@ -21,4 +32,12 @@ public String getCookieName() {
public String getCookieSignatureName() {
return cookieSignatureName;
}
public Optional<String> getDomain() {
return Optional.fromNullable(domain);
}
public Optional<Boolean> getSecure() {
return Optional.fromNullable(secure);
}
}

0 comments on commit 6529fad

Please sign in to comment.