@Override
public void set(WebContext context, String key, Object value) {
logger.debug("Save in session: {} = {}", key, value);
final Cookie cookie = new Cookie(PAC4J_SESSION_PREFIX + key, compressEncryptBase64(value));
try {
String domain = Urls.getDomainName(context.getFullRequestURL(), this.domainSuffix);
if (domain == null) {
domain = context.getServerName();
}
cookie.setDomain(domain);
} catch (final Exception e) {
throw new TechnicalException(e);
}
cookie.setHttpOnly(true);
cookie.setSecure(ContextHelper.isHttpsOrSecure(context));
context.addResponseCookie(cookie);
}