[java-shib-shared] branch main updated: Add getters and additional features to CookieManager for subclassing.
Scott Cantor
cantor.2 at osu.edu
Wed Dec 13 18:18:42 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=c638871c917a79157df4e3bab13514f67632c9bc
The following commit(s) were added to refs/heads/main by this push:
new c638871c Add getters and additional features to CookieManager for subclassing.
c638871c is described below
commit c638871c917a79157df4e3bab13514f67632c9bc
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 13 13:18:39 2023 -0500
Add getters and additional features to CookieManager for subclassing.
---
.../net/shibboleth/shared/net/CookieManager.java | 42 ++++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/shib-networking/src/main/java/net/shibboleth/shared/net/CookieManager.java b/shib-networking/src/main/java/net/shibboleth/shared/net/CookieManager.java
index 7d4da3f4..0d451377 100644
--- a/shib-networking/src/main/java/net/shibboleth/shared/net/CookieManager.java
+++ b/shib-networking/src/main/java/net/shibboleth/shared/net/CookieManager.java
@@ -68,7 +68,18 @@ public class CookieManager extends AbstractInitializableComponent {
}
/**
- * Set the cookie path to use for session tracking.
+ * Get the cookie path to use.
+ *
+ * @return cookie path
+ *
+ * @since 9.1.0
+ */
+ @Nullable public String getCookiePath() {
+ return cookiePath;
+ }
+
+ /**
+ * Set the cookie path to use.
*
* <p>Defaults to the servlet context path.</p>
*
@@ -81,7 +92,18 @@ public class CookieManager extends AbstractInitializableComponent {
}
/**
- * Set the cookie domain to use for session tracking.
+ * Get the cookie domain to use.
+ *
+ * @return cookie domain
+ *
+ * @since 9.1.0
+ */
+ @Nullable public String getCookieDomain() {
+ return cookieDomain;
+ }
+
+ /**
+ * Set the cookie domain to use.
*
* @param domain the cookie domain to use, or null for the default
*/
@@ -213,6 +235,20 @@ public class CookieManager extends AbstractInitializableComponent {
* @param value value of cookie
*/
public void addCookie(@Nonnull @NotEmpty final String name, @Nonnull @NotEmpty final String value) {
+ addCookie(name, value, maxAge);
+ }
+
+ /**
+ * Add a cookie with the specified name and value.
+ *
+ * @param name name of cookie
+ * @param value value of cookie
+ * @param overrideMaxAge max-age value to use
+ *
+ * @since 9.1.0
+ */
+ protected void addCookie(@Nonnull @NotEmpty final String name, @Nonnull @NotEmpty final String value,
+ final int overrideMaxAge) {
checkComponentActive();
final Cookie cookie = new Cookie(name, value);
@@ -222,7 +258,7 @@ public class CookieManager extends AbstractInitializableComponent {
}
cookie.setSecure(secure);
cookie.setHttpOnly(httpOnly);
- cookie.setMaxAge(maxAge);
+ cookie.setMaxAge(overrideMaxAge);
getHttpServletResponse().addCookie(cookie);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list