Пример #1
0
 @Override
 protected void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   try {
     HttpServletRequest servletRequest =
         this.policyContextTestBean.getHttpServletRequestFromPolicyContext();
     if (servletRequest != null)
       response
           .getWriter()
           .write("EJB successfully retrieved HttpServletRequest reference from PolicyContext");
   } catch (PolicyContextException e) {
     throw new ServletException("Error retrieving request: " + e.getMessage(), e);
   }
 }
  public void validateCertificateChain(List<X509Certificate> certificateChain)
      throws SecurityException {
    LOG.debug("validate certificate chain: " + certificateChain);

    HttpServletRequest httpServletRequest;
    try {
      httpServletRequest =
          (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
    } catch (PolicyContextException e) {
      throw new RuntimeException("JACC error: " + e.getMessage());
    }

    HttpSession httpSession = httpServletRequest.getSession();
    httpSession.setAttribute("authenticationCertificateChain", certificateChain);
  }
  public void checkNationalRegistrationCertificate(List<X509Certificate> certificateChain)
      throws SecurityException {
    LOG.debug("checking national registry certificate...");

    HttpServletRequest httpServletRequest;
    try {
      httpServletRequest =
          (HttpServletRequest) PolicyContext.getContext("javax.servlet.http.HttpServletRequest");
    } catch (PolicyContextException e) {
      throw new RuntimeException("JACC error: " + e.getMessage());
    }

    HttpSession httpSession = httpServletRequest.getSession();
    X509Certificate certificate = certificateChain.get(0);
    httpSession.setAttribute("NationalRegistryCertificate", certificate);
  }