Java Code Examples for io.undertow.server.session.Session#changeSessionId()

The following examples show how to use io.undertow.server.session.Session#changeSessionId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpServletRequestImpl.java    From quarkus-http with Apache License 2.0 6 votes vote down vote up
@Override
public String changeSessionId() {
    HttpSessionImpl session = servletContext.getSession(originalServletContext, exchange, false);
    if (session == null) {
        throw UndertowServletMessages.MESSAGES.noSession();
    }
    String oldId = session.getId();
    Session underlyingSession;
    if (System.getSecurityManager() == null) {
        underlyingSession = session.getSession();
    } else {
        underlyingSession = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(session));
    }
    String newId = underlyingSession.changeSessionId(exchange, originalServletContext.getSessionConfig());
    servletContext.getDeployment().getApplicationListeners().httpSessionIdChanged(session, oldId);
    return newId;
}
 
Example 2
Source File: HttpServletRequestImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String changeSessionId() {
    HttpSessionImpl session = servletContext.getSession(originalServletContext, exchange, false);
    if (session == null) {
        throw UndertowServletMessages.MESSAGES.noSession();
    }
    String oldId = session.getId();
    Session underlyingSession;
    if(System.getSecurityManager() == null) {
        underlyingSession = session.getSession();
    } else {
        underlyingSession = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(session));
    }
    String newId = underlyingSession.changeSessionId(exchange, originalServletContext.getSessionConfig());
    servletContext.getDeployment().getApplicationListeners().httpSessionIdChanged(session, oldId);
    return newId;
}
 
Example 3
Source File: ChangeSessionId.java    From keycloak with Apache License 2.0 6 votes vote down vote up
public static String changeSessionId(HttpServerExchange exchange, boolean create) {
    final ServletRequestContext sc = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
    ServletContextImpl currentServletContext = sc.getCurrentServletContext();
    HttpSessionImpl session = currentServletContext.getSession(exchange, create);
    if (session == null) {
        return null;
    }
    Session underlyingSession;
    if(System.getSecurityManager() == null) {
        underlyingSession = session.getSession();
    } else {
        underlyingSession = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(session));
    }


    return underlyingSession.changeSessionId(exchange, currentServletContext.getSessionConfig());
}