protected Optional<HttpSession> getNativeSession(final WebContext context, final boolean createSession) {
        if (httpSession != null) {
            LOGGER.debug("Provided session: {}", httpSession);
            return Optional.of(httpSession);
        } else {
            val jeeContext = (JEEContext) context;
            val session = jeeContext.getNativeRequest().getSession(createSession);
            LOGGER.debug("createSession: {}, retrieved session: {}", createSession, session);
            return Optional.ofNullable(session);
        }
    }
<p>getNativeSession.</p>

@param context a {@link WebContext} object
@param createSession a boolean
@return a {@link Optional} object
pac4j-javaee/src/main/java/org/pac4j/jee/context/session/JEESessionStore.java