// Path: core/src/main/java/com/softwaremill/session/javadsl/HttpSessionAwareDirectives.java
// public class HttpSessionAwareDirectives<T> extends AllDirectives {
// 
//     private final SessionManager<T> sessionManager;
// 
//     public HttpSessionAwareDirectives(SessionManager<T> sessionManager) {
//         this.sessionManager = sessionManager;
//     }
// 
//     public Route session(SessionContinuity sc, GetSessionTransport st, Function<SessionResult<T>, Route> continuity) {
//         return SessionDirectives$.MODULE$.session(sc, st, continuity);
//     }
// 
//     public Route setSession(SessionContinuity sc, SetSessionTransport st, T session, Supplier<Route> continuity) {
//         return SessionDirectives$.MODULE$.setSession(sc, st, session, continuity);
//     }
// 
//     public Route optionalSession(SessionContinuity sc, SetSessionTransport st, Function<Optional<T>, Route> continuity) {
//         return SessionDirectives$.MODULE$.optionalSession(sc, st, continuity);
//     }
// 
//     public Route requiredSession(SessionContinuity<T> sc, SetSessionTransport st, Function<T, Route> continuity) {
//         return SessionDirectives$.MODULE$.requiredSession(sc, st, continuity);
//     }
// 
//     public Route touchRequiredSession(SessionContinuity<T> sc, SetSessionTransport st, Function<T, Route> continuity) {
//         return SessionDirectives$.MODULE$.touchRequiredSession(sc, st, continuity);
//     }
// 
//     public Route invalidateSession(SessionContinuity<T> sc, SetSessionTransport st, Supplier<Route> continuity) {
//         return SessionDirectives$.MODULE$.invalidateSession(sc, st, continuity);
//     }
// 
//     public Route setNewCsrfToken(CsrfCheckMode<T> checkHeader, Supplier<Route> continuity) {
//         return CsrfDirectives$.MODULE$.setNewCsrfToken(checkHeader, continuity);
//     }
// 
//     public Route randomTokenCsrfProtection(CsrfCheckMode<T> checkHeader, Supplier<Route> continuity) {
//         return CsrfDirectives$.MODULE$.randomTokenCsrfProtection(checkHeader, continuity);
//     }
// 
//     public SessionManager<T> getSessionManager() {
//         return sessionManager;
//     }
// }
// 
// Path: jwt/src/main/java/com/softwaremill/session/javadsl/JwtSessionSerializers.java
// public final class JwtSessionSerializers {
// 
//     public static final DefaultFormats$ DefaultUtcDateFormat = DefaultFormats$.MODULE$;
// 
//     public static final SessionSerializer<String, JValue> StringToJValueSessionSerializer = JValueSessionSerializer$.MODULE$.stringToJValueSessionSerializer();
//     public static final SessionSerializer<Integer, JValue> IntToJValueSessionSerializer = (SessionSerializer<Integer, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.intToJValueSessionSerializer();
//     public static final SessionSerializer<Long, JValue> LongToJValueSessionSerializer = (SessionSerializer<Long, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.longToJValueSessionSerializer();
//     public static final SessionSerializer<Float, JValue> FloatToJValueSessionSerializer = (SessionSerializer<Float, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.floatToJValueSessionSerializer();
//     public static final SessionSerializer<Double, JValue> DoubleToJValueSessionSerializer = (SessionSerializer<Double, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.doubleToJValueSessionSerializer();
// 
//     private JwtSessionSerializers() {
//     }
// 
// }
// 
// Path: core/src/main/java/com/softwaremill/session/javadsl/SessionTransports.java
// public static final SetSessionTransport CookieST = CookieST$.MODULE$;


import akka.NotUsed;
import akka.actor.ActorSystem;
import akka.dispatch.MessageDispatcher;
import akka.http.javadsl.ConnectHttp;
import akka.http.javadsl.Http;
import akka.http.javadsl.ServerBinding;
import akka.http.javadsl.model.HttpRequest;
import akka.http.javadsl.model.HttpResponse;
import akka.http.javadsl.model.StatusCodes;
import akka.http.javadsl.model.Uri;
import akka.http.javadsl.server.Route;
import akka.http.javadsl.unmarshalling.Unmarshaller;
import akka.stream.ActorMaterializer;
import akka.stream.javadsl.Flow;
import com.softwaremill.session.CheckHeader;
import com.softwaremill.session.JwtSessionEncoder;
import com.softwaremill.session.RefreshTokenStorage;
import com.softwaremill.session.Refreshable;
import com.softwaremill.session.SessionConfig;
import com.softwaremill.session.SessionEncoder;
import com.softwaremill.session.SessionManager;
import com.softwaremill.session.SetSessionTransport;
import com.softwaremill.session.javadsl.HttpSessionAwareDirectives;
import com.softwaremill.session.javadsl.InMemoryRefreshTokenStorage;
import com.softwaremill.session.javadsl.JwtSessionSerializers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.CompletionStage;
import static com.softwaremill.session.javadsl.SessionTransports.CookieST;
package com.softwaremill.example.jwt;





public class JavaJwtExample extends HttpSessionAwareDirectives<String> {

    private static final Logger LOGGER = LoggerFactory.getLogger(JavaJwtExample.class);
    private static final String SECRET = "c05ll3lesrinf39t7mc5h6un6r0c69lgfno69dsak3vabeqamouq4328cuaekros401ajdpkh60rrtpd8ro24rbuqmgtnd1ebag6ljnb65i8a55d482ok7o0nch0bfbe";
    private static final SessionEncoder<String> JWT_ENCODER = new JwtSessionEncoder<>(JwtSessionSerializers.StringToJValueSessionSerializer, JwtSessionSerializers.DefaultUtcDateFormat);

    // in-memory refresh token storage
    private static final RefreshTokenStorage<String> REFRESH_TOKEN_STORAGE = new InMemoryRefreshTokenStorage<String>() {
        @Override
        public void log(String msg) {
            LOGGER.info(msg);
        }
    };

    private Refreshable<String> refreshable;
// Path: core/src/main/java/com/softwaremill/session/javadsl/HttpSessionAwareDirectives.java
// public class HttpSessionAwareDirectives<T> extends AllDirectives {
// 
//     private final SessionManager<T> sessionManager;
// 
//     public HttpSessionAwareDirectives(SessionManager<T> sessionManager) {
//         this.sessionManager = sessionManager;
//     }
// 
//     public Route session(SessionContinuity sc, GetSessionTransport st, Function<SessionResult<T>, Route> continuity) {
//         return SessionDirectives$.MODULE$.session(sc, st, continuity);
//     }
// 
//     public Route setSession(SessionContinuity sc, SetSessionTransport st, T session, Supplier<Route> continuity) {
//         return SessionDirectives$.MODULE$.setSession(sc, st, session, continuity);
//     }
// 
//     public Route optionalSession(SessionContinuity sc, SetSessionTransport st, Function<Optional<T>, Route> continuity) {
//         return SessionDirectives$.MODULE$.optionalSession(sc, st, continuity);
//     }
// 
//     public Route requiredSession(SessionContinuity<T> sc, SetSessionTransport st, Function<T, Route> continuity) {
//         return SessionDirectives$.MODULE$.requiredSession(sc, st, continuity);
//     }
// 
//     public Route touchRequiredSession(SessionContinuity<T> sc, SetSessionTransport st, Function<T, Route> continuity) {
//         return SessionDirectives$.MODULE$.touchRequiredSession(sc, st, continuity);
//     }
// 
//     public Route invalidateSession(SessionContinuity<T> sc, SetSessionTransport st, Supplier<Route> continuity) {
//         return SessionDirectives$.MODULE$.invalidateSession(sc, st, continuity);
//     }
// 
//     public Route setNewCsrfToken(CsrfCheckMode<T> checkHeader, Supplier<Route> continuity) {
//         return CsrfDirectives$.MODULE$.setNewCsrfToken(checkHeader, continuity);
//     }
// 
//     public Route randomTokenCsrfProtection(CsrfCheckMode<T> checkHeader, Supplier<Route> continuity) {
//         return CsrfDirectives$.MODULE$.randomTokenCsrfProtection(checkHeader, continuity);
//     }
// 
//     public SessionManager<T> getSessionManager() {
//         return sessionManager;
//     }
// }
// 
// Path: jwt/src/main/java/com/softwaremill/session/javadsl/JwtSessionSerializers.java
// public final class JwtSessionSerializers {
// 
//     public static final DefaultFormats$ DefaultUtcDateFormat = DefaultFormats$.MODULE$;
// 
//     public static final SessionSerializer<String, JValue> StringToJValueSessionSerializer = JValueSessionSerializer$.MODULE$.stringToJValueSessionSerializer();
//     public static final SessionSerializer<Integer, JValue> IntToJValueSessionSerializer = (SessionSerializer<Integer, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.intToJValueSessionSerializer();
//     public static final SessionSerializer<Long, JValue> LongToJValueSessionSerializer = (SessionSerializer<Long, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.longToJValueSessionSerializer();
//     public static final SessionSerializer<Float, JValue> FloatToJValueSessionSerializer = (SessionSerializer<Float, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.floatToJValueSessionSerializer();
//     public static final SessionSerializer<Double, JValue> DoubleToJValueSessionSerializer = (SessionSerializer<Double, JValue>) (SessionSerializer) JValueSessionSerializer$.MODULE$.doubleToJValueSessionSerializer();
// 
//     private JwtSessionSerializers() {
//     }
// 
// }
// 
// Path: core/src/main/java/com/softwaremill/session/javadsl/SessionTransports.java
// public static final SetSessionTransport CookieST = CookieST$.MODULE$;


// Path: example/src/main/java/com/softwaremill/example/jwt/JavaJwtExample.java
import akka.NotUsed;
import akka.actor.ActorSystem;
import akka.dispatch.MessageDispatcher;
import akka.http.javadsl.ConnectHttp;
import akka.http.javadsl.Http;
import akka.http.javadsl.ServerBinding;
import akka.http.javadsl.model.HttpRequest;
import akka.http.javadsl.model.HttpResponse;
import akka.http.javadsl.model.StatusCodes;
import akka.http.javadsl.model.Uri;
import akka.http.javadsl.server.Route;
import akka.http.javadsl.unmarshalling.Unmarshaller;
import akka.stream.ActorMaterializer;
import akka.stream.javadsl.Flow;
import com.softwaremill.session.CheckHeader;
import com.softwaremill.session.JwtSessionEncoder;
import com.softwaremill.session.RefreshTokenStorage;
import com.softwaremill.session.Refreshable;
import com.softwaremill.session.SessionConfig;
import com.softwaremill.session.SessionEncoder;
import com.softwaremill.session.SessionManager;
import com.softwaremill.session.SetSessionTransport;
import com.softwaremill.session.javadsl.HttpSessionAwareDirectives;
import com.softwaremill.session.javadsl.InMemoryRefreshTokenStorage;
import com.softwaremill.session.javadsl.JwtSessionSerializers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.CompletionStage;
import static com.softwaremill.session.javadsl.SessionTransports.CookieST;

package com.softwaremill.example.jwt;





public class JavaJwtExample extends HttpSessionAwareDirectives<String> {

    private static final Logger LOGGER = LoggerFactory.getLogger(JavaJwtExample.class);
    private static final String SECRET = "c05ll3lesrinf39t7mc5h6un6r0c69lgfno69dsak3vabeqamouq4328cuaekros401ajdpkh60rrtpd8ro24rbuqmgtnd1ebag6ljnb65i8a55d482ok7o0nch0bfbe";
    private static final SessionEncoder<String> JWT_ENCODER = new JwtSessionEncoder<>(JwtSessionSerializers.StringToJValueSessionSerializer, JwtSessionSerializers.DefaultUtcDateFormat);

    // in-memory refresh token storage
    private static final RefreshTokenStorage<String> REFRESH_TOKEN_STORAGE = new InMemoryRefreshTokenStorage<String>() {
        @Override
        public void log(String msg) {
            LOGGER.info(msg);
        }
    };

    private Refreshable<String> refreshable;
    private SetSessionTransport sessionTransport;