org.apache.catalina.connector.Request.getSessionInternal()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中org.apache.catalina.connector.Request.getSessionInternal方法的一些代码示例,展示了Request.getSessionInternal的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.getSessionInternal方法的具体详情如下:
包路径:org.apache.catalina.connector.Request
类名称:Request
方法名:getSessionInternal

Request.getSessionInternal介绍

[英]Return the session associated with this Request, creating one if necessary.
[中]返回与此请求关联的会话,必要时创建一个会话。

代码示例

代码示例来源:origin: stackoverflow.com

public class MyFormAuthenticator extends FormAuthenticator{

@Override
public boolean  authenticate(Request request,HttpServletResponse response,LoginConfig config){
  boolean success = super.authenticate(request,response,config);
  if(success){
   Session session = request.getSessionInternal(false); // Use the existing session
   session.put .... // the action which you want to do
  }
  return success;
}

代码示例来源:origin: stackoverflow.com

@Override
public void invoke(Request request, Response response) 
    throws IOException, ServletException {
  getNext().invoke(request, response);
  Session session = request.getSessionInternal();        
  HttpSession deltaSession = (HttpSession) session;
  for (Enumeration<String> names = deltaSession.getAttributeNames(); 
      names.hasMoreElements(); ) {
    String name = names.nextElement();
    deltaSession.setAttribute(name, deltaSession.getAttribute(name));
  }
}

代码示例来源:origin: org.keycloak/keycloak-saml-tomcat-adapter-core

protected HttpSession getSession(boolean create) {
    Session session = request.getSessionInternal(create);
    if (session == null) return null;
    return session.getSession();
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

/** 
 * unlock the session associated with this request
 */
@Override
public void unlockSession() {
  Session sess = getSessionInternal(false);
  // Now unlock the session
  if (sess != null) {
    sess.unlockForeground();
  }        
}

代码示例来源:origin: org.keycloak/keycloak-tomcat-core-adapter

@Override
public void logout() {
  Session session = request.getSessionInternal(false);
  if (session != null) {
    cleanSession(session);
  }
}

代码示例来源:origin: org.keycloak/spring-boot-container-bundle

public boolean keycloakRestoreRequest(Request request) {
  try {
    return restoreRequest(request, request.getSessionInternal());
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.keycloak/spring-boot-container-bundle

@Override
public void logout() {
  Session session = request.getSessionInternal(false);
  if (session != null) {
    cleanSession(session);
  }
}

代码示例来源:origin: org.keycloak/keycloak-saml-tomcat-adapter-core

public boolean keycloakRestoreRequest(Request request) {
  try {
    return restoreRequest(request, request.getSessionInternal());
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.jboss.resteasy/skeleton-key-as7

protected GenericPrincipal checkLoggedIn(Request request, HttpServletResponse response)
{
 if (request.getPrincipal() != null)
 {
   return (GenericPrincipal) request.getPrincipal();
 }
 else if (request.getSessionInternal() != null && request.getSessionInternal().getPrincipal() != null)
 {
   return (GenericPrincipal) request.getSessionInternal().getPrincipal();
 }
 return null;
}

代码示例来源:origin: org.picketlink/picketlink-consolidated-social

private boolean dealWithFacebookPrincipal(Request request, Response response, Principal principal) throws IOException {
  String userName = principal.getName();
  request.getSessionInternal().setNote(Constants.SESS_USERNAME_NOTE, userName);
  request.getSessionInternal().setNote(Constants.SESS_PASSWORD_NOTE, "");
  request.setUserPrincipal(principal);
  if (saveRestoreRequest) {
    this.restoreRequest(request, request.getSessionInternal());
  }
  registerWithAuthenticatorBase(request, response, principal, userName);
  request.getSession().setAttribute("STATE", STATES.FINISH.name());
  return true;
}

代码示例来源:origin: org.graniteds/granite-server

protected Principal getPrincipal(HttpServletRequest httpRequest) {
  Request request = getRequest(httpRequest);
  Session session = request.getSessionInternal(false);
  return (session != null ? session.getPrincipal() : null);
}

代码示例来源:origin: org.picketlink/picketlink-tomcat-common

private boolean isUserAuthenticated(Request request) {
  Session sessionInternal = request.getSessionInternal(false);
  String authMethod = getContext().getLoginConfig().getAuthMethod();
  return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null;
}

代码示例来源:origin: org.picketlink.distribution/picketlink-jbas5

private boolean isUserAuthenticated(Request request) {
  Session sessionInternal = request.getSessionInternal(false);
  String authMethod = getContext().getLoginConfig().getAuthMethod();
  return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat7

@Override
  protected boolean signout(HttpServletRequest req, HttpServletResponse resp) {
    // Direct Logout
    Session session = request.getSessionInternal();
    session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
    session.setPrincipal(null);
    return super.signout(req, resp);
  }
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat8

@Override
  protected boolean signout(HttpServletRequest req, HttpServletResponse resp) {
    // Direct Logout
    Session session = request.getSessionInternal();
    session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
    session.setPrincipal(null);
    return super.signout(req, resp);
  }
}

代码示例来源:origin: org.picketlink.distribution/picketlink-jbas7

private boolean isUserAuthenticated(Request request) {
  Session sessionInternal = request.getSessionInternal(false);
  String authMethod = getContext().getLoginConfig().getAuthMethod();
  return (authMethod != null && "FORM".equals(authMethod)) && sessionInternal != null && sessionInternal.getNote(Constants.FORM_PRINCIPAL_NOTE) != null;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat7

@Override
protected boolean signoutCleanup(HttpServletRequest req, HttpServletResponse resp) {
  // Cleanup session internal
  Session session = request.getSessionInternal();
  session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
  session.setPrincipal(null);
  super.signoutCleanup(req, resp);
  request.clearCookies();
  return true;
}

代码示例来源:origin: org.apache.cxf.fediz/fediz-tomcat8

@Override
protected boolean signoutCleanup(HttpServletRequest req, HttpServletResponse resp) {
  // Cleanup session internal
  Session session = request.getSessionInternal();
  session.removeNote(FederationAuthenticator.FEDERATION_NOTE);
  session.setPrincipal(null);
  super.signoutCleanup(req, resp);
  request.clearCookies();
  return true;
}

代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib

/*      */   public String encodeRedirectURL(String url)
/*      */   {
/* 1080 */     if (isEncodeable(toAbsolute(url))) {
/* 1081 */       return toEncoded(url, this.request.getSessionInternal().getIdInternal());
/*      */     }
/* 1083 */     return url;
/*      */   }
/*      */

代码示例来源:origin: pivotalsoftware/session-managers

@Test
public void invokeInvalidSession() throws IOException, ServletException {
  when(this.request.getSessionInternal(false)).thenReturn(this.session);
  when(this.session.isValid()).thenReturn(false);
  this.valve.invoke(this.request, this.response);
  verify(this.next).invoke(this.request, this.response);
  verifyZeroInteractions(this.store);
}

相关文章

Request类方法