com.github.lontime.extpac4j.impl.LocalSimpleJEESessionStore Maven / Gradle / Ivy
The newest version!
package com.github.lontime.extpac4j.impl;
import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import com.github.lontime.base.logging.GLogger;
import com.github.lontime.shaded.com.github.benmanes.caffeine.cache.Cache;
import com.github.lontime.shaded.com.github.benmanes.caffeine.cache.Caffeine;
import org.pac4j.core.context.JEEContext;
import org.pac4j.core.context.session.JEESessionStore;
import org.pac4j.core.context.session.SessionStore;
/**
* LocalJEESessionStore.
* @author lontime
* @since 1.0
*/
public class LocalSimpleJEESessionStore implements SessionStore {
public static final LocalSimpleJEESessionStore INSTANCE = new LocalSimpleJEESessionStore();
private static final int MAP_SIZE = 16;
protected JEESessionStore delegate;
protected Cache> cache;
public LocalSimpleJEESessionStore() {
this.delegate = new JEESessionStore();
this.cache = Caffeine.newBuilder().expireAfterAccess(Duration.ofMinutes(5)).build();
}
protected boolean check(JEEContext context) {
return false;
}
@Override
public String getOrCreateSessionId(JEEContext context) {
return delegate.getOrCreateSessionId(context);
}
@Override
public Optional
© 2015 - 2024 Weber Informatics LLC | Privacy Policy