I’ve got a problem with Keycloak java adapter. I try to integrate desktop application with Keycloak and enable SSO between a few other web applications. The problem is that when I try to login to Keycloak everything works perfect and smooth, I get information about proper authentication, obtain token and can even parse it without any problem, but there is
Tag: cookies
Do session objects take resources in my application? Won’t garbage collector remove them?
I came across part in Head First JSP and Servlets page:241 where it says that we have to get rid of sessions as shown in this picture: Later on they present methods invalidate() and …
SameSite cookie in Java application
Do you know any Java cookie implementation which allows to set a custom flag for cookie, like SameSite=strict? It seems that javax.servlet.http.Cookie has a strictly limited set of flags which can be added. Answer I am not a JEE expert, but I think that because that cookie property is a somewhat new invention, you cannot expect it to be present
After upgrading to Apache HttpClient 4.4 it does not send cookies with requests
I am using the Apache HttpClient to send requests to our internal API servers. The servers require authentication and need a cookie to be set with an auth token. Up to HttpClient 4.3.6 this has been working fine, but on 4.4 and above it has stopped sending the cookies on requests. My cookie domain is set to .subdomain.mycompany.com, which works
Get cookie value in java
I’ve initialized cooke like this in my JSP, So, all the cookies created will have the same name, but different value for different user access time. At the ending of java servlet I want to deactivate/kill the cookie that has been passed at the beginning of java servlet and say if they are 5 users using the system in parallel
In Java servlet, cookie.getMaxAge() always returns -1
If I set a cookie with a setMaxAge() well into the future, when I read the cookie back into memory in a subsequent request, the getMaxAge() gives me back a -1. I have checked the actual cookie via Chrome’s settings, and inspector, and I can verify that the expiration date is indeed set 60 days in the future. Why does
Write and Read Cookies in different Applications
I have two applications running in Jboss, can I write a cookie in a application and read in another? For example, if I have two Servlets: – WriterCookieServlet on localhost:8080/Application1 – ReaderCookieServlet on localhost:8080/Application2 WriterCookieServlet: Then on ReaderCookieServlet I want read this cookie. Answer I think @galuano1 is right: this should indeed be possible. Make sure the path is correct,
Sharing Cookies Between Sub Domains in java?
I have some cookies stored in http://sub1.myserver.com and I want to be able to see them in http://myserver.com Answer I was able to do it using the following code: