List of usage examples for javax.servlet.http HttpServletRequest getAuthType
public String getAuthType();
From source file:org.apache.catalina.valves.ExtendedAccessLogValve.java
/** * Get app specific data./*from www .j a va2 s .c om*/ * @param fieldInfo The field to decode * @param request Where we will pull the data from. * @return The appropriate value */ private String getAppSpecific(FieldInfo fieldInfo, Request request) { ServletRequest sr = request.getRequest(); HttpServletRequest hsr = null; if (sr instanceof HttpServletRequest) hsr = (HttpServletRequest) sr; switch (fieldInfo.xType) { case FieldInfo.X_PARAMETER: return wrap(urlEncode(sr.getParameter(fieldInfo.value))); case FieldInfo.X_REQUEST: return wrap(sr.getAttribute(fieldInfo.value)); case FieldInfo.X_SESSION: HttpSession session = null; if (hsr != null) { session = hsr.getSession(false); if (session != null) return wrap(session.getAttribute(fieldInfo.value)); } break; case FieldInfo.X_COOKIE: Cookie[] c = hsr.getCookies(); for (int i = 0; c != null && i < c.length; i++) { if (fieldInfo.value.equals(c[i].getName())) { return wrap(c[i].getValue()); } } case FieldInfo.X_APP: return wrap(request.getContext().getServletContext().getAttribute(fieldInfo.value)); case FieldInfo.X_SERVLET_REQUEST: if (fieldInfo.location == FieldInfo.X_LOC_AUTHTYPE) { return wrap(hsr.getAuthType()); } else if (fieldInfo.location == FieldInfo.X_LOC_REMOTEUSER) { return wrap(hsr.getRemoteUser()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONID) { return wrap(hsr.getRequestedSessionId()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONIDFROMCOOKIE) { return wrap("" + hsr.isRequestedSessionIdFromCookie()); } else if (fieldInfo.location == FieldInfo.X_LOC_REQUESTEDSESSIONIDVALID) { return wrap("" + hsr.isRequestedSessionIdValid()); } else if (fieldInfo.location == FieldInfo.X_LOC_CONTENTLENGTH) { return wrap("" + hsr.getContentLength()); } else if (fieldInfo.location == FieldInfo.X_LOC_CHARACTERENCODING) { return wrap(hsr.getCharacterEncoding()); } else if (fieldInfo.location == FieldInfo.X_LOC_LOCALE) { return wrap(hsr.getLocale()); } else if (fieldInfo.location == FieldInfo.X_LOC_PROTOCOL) { return wrap(hsr.getProtocol()); } else if (fieldInfo.location == FieldInfo.X_LOC_SCHEME) { return wrap(hsr.getScheme()); } else if (fieldInfo.location == FieldInfo.X_LOC_SECURE) { return wrap("" + hsr.isSecure()); } break; default: ; } return "-"; }
From source file:ro.raisercostin.web.DebuggingFilter.java
public String debug(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, DebuggingPrinter debuggingPrinter, boolean debugAll, boolean debugRequest) { final JspFactory jspFactory = JspFactory.getDefaultFactory(); HttpSession session = request.getSession(); debuggingPrinter.addHeader();// w ww . ja v a 2 s . c om debuggingPrinter.addSection("Request Parameters"); for (Iterator iterator = request.getParameterMap().entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, Object> parameter = (Map.Entry<String, Object>) iterator.next(); addRow(debuggingPrinter, parameter.getKey(), StringUtils.arrayToCommaDelimitedString((Object[]) parameter.getValue())); } debuggingPrinter.endSection(); if (debugRequest) { debuggingPrinter.addSection("Request Header"); for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(request.getHeader(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Attributes"); java.util.Enumeration en = request.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(request.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Session Attributes"); en = session.getAttributeNames(); while (en.hasMoreElements()) { String attrName = (String) en.nextElement(); try { addRow(debuggingPrinter, split(attrName, 50), toString2(session.getAttribute(attrName), 120)); } catch (Exception e) { addRow(debuggingPrinter, split(attrName, 50), toString(e, 120)); } } debuggingPrinter.endSection(); debuggingPrinter.addSection("Request Info"); addRow(debuggingPrinter, "AuthType", request.getAuthType()); addRow(debuggingPrinter, "ContextPath", request.getContextPath()); addRow(debuggingPrinter, "Method", request.getMethod()); addRow(debuggingPrinter, "PathInfo", request.getPathInfo()); addRow(debuggingPrinter, "PathTranslated", request.getPathTranslated()); addRow(debuggingPrinter, "Protocol", request.getProtocol()); addRow(debuggingPrinter, "QueryString", request.getQueryString()); addRow(debuggingPrinter, "RemoteAddr", request.getRemoteAddr()); addRow(debuggingPrinter, "RemoteUser", request.getRemoteUser()); addRow(debuggingPrinter, "RequestedSessionId", request.getRequestedSessionId()); addRow(debuggingPrinter, "RequestURI", request.getRequestURI()); addRow(debuggingPrinter, "RequestURL", request.getRequestURL().toString()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); addRow(debuggingPrinter, "Scheme", request.getScheme()); addRow(debuggingPrinter, "ServletPath", request.getServletPath()); } if (debugAll) { debuggingPrinter.addSection("Server"); addRow(debuggingPrinter, "Server Info", servletContext.getServerInfo()); addRow(debuggingPrinter, "Servlet Engine Version", servletContext.getMajorVersion() + "." + servletContext.getMinorVersion()); addRow(debuggingPrinter, "JSP Version", jspFactory.getEngineInfo().getSpecificationVersion()); debuggingPrinter.endSection(); debuggingPrinter.addSection("JVM Properties"); for (Enumeration e = System.getProperties().propertyNames(); e.hasMoreElements();) { String parameterName = (String) e.nextElement(); addRow(debuggingPrinter, parameterName, debuggingPrinter.transform(System.getProperty(parameterName))); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Environment"); for (Map.Entry<String, String> property : System.getenv().entrySet()) { addRow(debuggingPrinter, property.getKey(), debuggingPrinter.transform(property.getValue())); } debuggingPrinter.endSection(); debuggingPrinter.addSection("Debugger Provided by"); addRow(debuggingPrinter, "provided by", "raisercostin"); debuggingPrinter.addRow("source", "<a target='_blank' href='http://code.google.com/p/raisercostin/wiki/DebuggingFilter'>http://code.google.com/p/raisercostin/wiki/DebuggingFilter</a>"); addRow(debuggingPrinter, "version", "1.0"); addRow(debuggingPrinter, "timestamp", "2008.June.14"); addRow(debuggingPrinter, "license", "<a target='_blank' href='http://www.apache.org/licenses/LICENSE-2.0.html'>Apache License 2.0</a>"); debuggingPrinter.endSection(); } debuggingPrinter.addFooter(); return debuggingPrinter.getString(); }
From source file:org.apache.nifi.processors.standard.HandleHttpRequest.java
@Override public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException { try {//from www.j a va 2 s . co m if (!initialized.get()) { initializeServer(context); } } catch (Exception e) { context.yield(); throw new ProcessException("Failed to initialize the server", e); } final HttpRequestContainer container = containerQueue.poll(); if (container == null) { return; } final long start = System.nanoTime(); final HttpServletRequest request = container.getRequest(); FlowFile flowFile = session.create(); try { flowFile = session.importFrom(request.getInputStream(), flowFile); } catch (final IOException e) { getLogger().error("Failed to receive content from HTTP Request from {} due to {}", new Object[] { request.getRemoteAddr(), e }); session.remove(flowFile); return; } final String charset = request.getCharacterEncoding() == null ? context.getProperty(URL_CHARACTER_SET).getValue() : request.getCharacterEncoding(); final String contextIdentifier = UUID.randomUUID().toString(); final Map<String, String> attributes = new HashMap<>(); try { putAttribute(attributes, HTTPUtils.HTTP_CONTEXT_ID, contextIdentifier); putAttribute(attributes, "mime.type", request.getContentType()); putAttribute(attributes, "http.servlet.path", request.getServletPath()); putAttribute(attributes, "http.context.path", request.getContextPath()); putAttribute(attributes, "http.method", request.getMethod()); putAttribute(attributes, "http.local.addr", request.getLocalAddr()); putAttribute(attributes, HTTPUtils.HTTP_LOCAL_NAME, request.getLocalName()); final String queryString = request.getQueryString(); if (queryString != null) { putAttribute(attributes, "http.query.string", URLDecoder.decode(queryString, charset)); } putAttribute(attributes, HTTPUtils.HTTP_REMOTE_HOST, request.getRemoteHost()); putAttribute(attributes, "http.remote.addr", request.getRemoteAddr()); putAttribute(attributes, "http.remote.user", request.getRemoteUser()); putAttribute(attributes, HTTPUtils.HTTP_REQUEST_URI, request.getRequestURI()); putAttribute(attributes, "http.request.url", request.getRequestURL().toString()); putAttribute(attributes, "http.auth.type", request.getAuthType()); putAttribute(attributes, "http.requested.session.id", request.getRequestedSessionId()); final DispatcherType dispatcherType = request.getDispatcherType(); if (dispatcherType != null) { putAttribute(attributes, "http.dispatcher.type", dispatcherType.name()); } putAttribute(attributes, "http.character.encoding", request.getCharacterEncoding()); putAttribute(attributes, "http.locale", request.getLocale()); putAttribute(attributes, "http.server.name", request.getServerName()); putAttribute(attributes, HTTPUtils.HTTP_PORT, request.getServerPort()); final Enumeration<String> paramEnumeration = request.getParameterNames(); while (paramEnumeration.hasMoreElements()) { final String paramName = paramEnumeration.nextElement(); final String value = request.getParameter(paramName); attributes.put("http.param." + paramName, value); } final Cookie[] cookies = request.getCookies(); if (cookies != null) { for (final Cookie cookie : cookies) { final String name = cookie.getName(); final String cookiePrefix = "http.cookie." + name + "."; attributes.put(cookiePrefix + "value", cookie.getValue()); attributes.put(cookiePrefix + "domain", cookie.getDomain()); attributes.put(cookiePrefix + "path", cookie.getPath()); attributes.put(cookiePrefix + "max.age", String.valueOf(cookie.getMaxAge())); attributes.put(cookiePrefix + "version", String.valueOf(cookie.getVersion())); attributes.put(cookiePrefix + "secure", String.valueOf(cookie.getSecure())); } } if (queryString != null) { final String[] params = URL_QUERY_PARAM_DELIMITER.split(queryString); for (final String keyValueString : params) { final int indexOf = keyValueString.indexOf("="); if (indexOf < 0) { // no =, then it's just a key with no value attributes.put("http.query.param." + URLDecoder.decode(keyValueString, charset), ""); } else { final String key = keyValueString.substring(0, indexOf); final String value; if (indexOf == keyValueString.length() - 1) { value = ""; } else { value = keyValueString.substring(indexOf + 1); } attributes.put("http.query.param." + URLDecoder.decode(key, charset), URLDecoder.decode(value, charset)); } } } } catch (final UnsupportedEncodingException uee) { throw new ProcessException("Invalid character encoding", uee); // won't happen because charset has been validated } final Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { final String headerName = headerNames.nextElement(); final String headerValue = request.getHeader(headerName); putAttribute(attributes, "http.headers." + headerName, headerValue); } final Principal principal = request.getUserPrincipal(); if (principal != null) { putAttribute(attributes, "http.principal.name", principal.getName()); } final X509Certificate certs[] = (X509Certificate[]) request .getAttribute("javax.servlet.request.X509Certificate"); final String subjectDn; if (certs != null && certs.length > 0) { final X509Certificate cert = certs[0]; subjectDn = cert.getSubjectDN().getName(); final String issuerDn = cert.getIssuerDN().getName(); putAttribute(attributes, HTTPUtils.HTTP_SSL_CERT, subjectDn); putAttribute(attributes, "http.issuer.dn", issuerDn); } else { subjectDn = null; } flowFile = session.putAllAttributes(flowFile, attributes); final HttpContextMap contextMap = context.getProperty(HTTP_CONTEXT_MAP) .asControllerService(HttpContextMap.class); final boolean registered = contextMap.register(contextIdentifier, request, container.getResponse(), container.getContext()); if (!registered) { getLogger().warn( "Received request from {} but could not process it because too many requests are already outstanding; responding with SERVICE_UNAVAILABLE", new Object[] { request.getRemoteAddr() }); try { container.getResponse().setStatus(Status.SERVICE_UNAVAILABLE.getStatusCode()); container.getResponse().flushBuffer(); container.getContext().complete(); } catch (final Exception e) { getLogger().warn("Failed to respond with SERVICE_UNAVAILABLE message to {} due to {}", new Object[] { request.getRemoteAddr(), e }); } session.remove(flowFile); return; } final long receiveMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); session.getProvenanceReporter().receive(flowFile, HTTPUtils.getURI(attributes), "Received from " + request.getRemoteAddr() + (subjectDn == null ? "" : " with DN=" + subjectDn), receiveMillis); session.transfer(flowFile, REL_SUCCESS); getLogger().info("Transferring {} to 'success'; received from {}", new Object[] { flowFile, request.getRemoteAddr() }); }
From source file:com.aaasec.sigserv.csspserver.SpServlet.java
/** * Processes requests for both HTTP//ww w .j a v a2 s.c om * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); SpSession session = getSession(request, response); RequestModel req = reqFactory.getRequestModel(request, session); AuthData authdata = req.getAuthData(); // Supporting devmode login if (SpModel.isDevmode()) { authdata = TestIdentities.getTestID(request, req); req.setAuthData(authdata); if (authdata.getAuthType().length() == 0) { authdata.setAuthType("devlogin"); } session.setIdpEntityId(authdata.getIdpEntityID()); session.setSignerAttribute(RequestModelFactory.getAttrOidString(authdata.getIdAttribute())); session.setSignerId(authdata.getId()); } //Terminate if no valid request data if (req == null) { response.setStatus(HttpServletResponse.SC_NO_CONTENT); response.getWriter().write(""); return; } // Handle form post from web page boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (isMultipart) { response.getWriter().write(SpServerLogic.processFileUpload(request, response, req)); return; } // Handle auth data request if (req.getAction().equals("authdata")) { response.setContentType("application/json"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().write(gson.toJson(authdata)); return; } // Get list of serverstored xml documents if (req.getAction().equals("doclist")) { response.setContentType("application/json"); response.getWriter().write(SpServerLogic.getDocList()); return; } // Provide info about the session for logout handling if (req.getAction().equals("logout")) { response.setContentType("application/json"); Logout lo = new Logout(); lo.authType = (request.getAuthType() == null) ? "" : request.getAuthType(); lo.devmode = String.valueOf(SpModel.isDevmode()); response.getWriter().write(gson.toJson(lo)); return; } // Respons to a client alive check to test if the server session is alive if (req.getAction().equals("alive")) { response.setContentType("application/json"); response.getWriter().write("[]"); return; } // Handle sign request and return Xhtml form with post data to the signature server if (req.getAction().equals("sign")) { boolean addSignMessage = (req.getParameter().equals("message")); String xhtml = SpServerLogic.prepareSignRedirect(req, addSignMessage); response.getWriter().write(xhtml); return; } // Get status data about the current session if (req.getAction().equals("status")) { response.setContentType("application/json"); response.getWriter().write(gson.toJson(session.getStatus())); return; } // Handle a declined sign request if (req.getAction().equals("declined")) { if (SpModel.isDevmode()) { response.sendRedirect("index.jsp?declined=true"); return; } response.sendRedirect("https://eid2cssp.3xasecurity.com/sign/index.jsp?declined=true"); return; } // Return Request and response data as a file. if (req.getAction().equalsIgnoreCase("getReqRes")) { response.setContentType("text/xml;charset=UTF-8"); byte[] data = TestCases.getRawData(req); BufferedInputStream fis = new BufferedInputStream(new ByteArrayInputStream(data)); ServletOutputStream output = response.getOutputStream(); if (req.getParameter().equalsIgnoreCase("download")) { response.setHeader("Content-Disposition", "attachment; filename=" + req.getId() + ".xml"); } int readBytes = 0; byte[] buffer = new byte[10000]; while ((readBytes = fis.read(buffer, 0, 10000)) != -1) { output.write(buffer, 0, readBytes); } output.flush(); output.close(); fis.close(); return; } // Return the signed document if (req.getAction().equalsIgnoreCase("getSignedDoc") || req.getAction().equalsIgnoreCase("getUnsignedDoc")) { // If the request if for a plaintext document, or only if the document has a valid signature if (session.getStatus().signedDocValid || req.getAction().equalsIgnoreCase("getUnsignedDoc")) { response.setContentType(session.getDocumentType().getMimeType()); switch (session.getDocumentType()) { case XML: response.getWriter().write(new String(session.getSignedDoc(), Charset.forName("UTF-8"))); return; case PDF: File docFile = session.getDocumentFile(); if (req.getAction().equalsIgnoreCase("getSignedDoc") && session.getStatus().signedDocValid) { docFile = session.getSigFile(); } FileInputStream fis = new FileInputStream(docFile); ServletOutputStream output = response.getOutputStream(); if (req.getParameter().equalsIgnoreCase("download")) { response.setHeader("Content-Disposition", "attachment; filename=" + "signedPdf.pdf"); } int readBytes = 0; byte[] buffer = new byte[10000]; while ((readBytes = fis.read(buffer, 0, 10000)) != -1) { output.write(buffer, 0, readBytes); } output.flush(); output.close(); fis.close(); return; } return; } else { if (SpModel.isDevmode()) { response.sendRedirect("index.jsp"); return; } response.sendRedirect("https://eid2cssp.3xasecurity.com/sign/index.jsp"); return; } } // Process a sign response from the signature server if (req.getSigResponse().length() > 0) { try { byte[] sigResponse = Base64Coder.decode(req.getSigResponse().trim()); // Handle response SpServerLogic.completeSignedDoc(sigResponse, req); } catch (Exception ex) { } if (SpModel.isDevmode()) { response.sendRedirect("index.jsp"); return; } response.sendRedirect("https://eid2cssp.3xasecurity.com/sign/index.jsp"); return; } // Handle testcases if (req.getAction().equals("test")) { boolean addSignMessage = (req.getParameter().equals("message")); String xhtml = TestCases.prepareTestRedirect(request, response, req, addSignMessage); respond(response, xhtml); return; } // Get test data for display such as request data, response data, certificates etc. if (req.getAction().equals("info")) { switch (session.getDocumentType()) { case PDF: File returnFile = null; if (req.getId().equalsIgnoreCase("document")) { respond(response, getDocIframe("getUnsignedDoc", needPdfDownloadButton(request))); } if (req.getId().equalsIgnoreCase("formSigDoc")) { respond(response, getDocIframe("getSignedDoc", needPdfDownloadButton(request))); } respond(response, TestCases.getTestData(req)); return; default: respond(response, TestCases.getTestData(req)); return; } } if (req.getAction().equals("verify")) { response.setContentType("text/xml;charset=UTF-8"); String sigVerifyReport = TestCases.getTestData(req); if (sigVerifyReport != null) { respond(response, sigVerifyReport); return; } } nullResponse(response); }
From source file:org.eclipse.equinox.http.servlet.tests.ServletTest.java
public void testHttpContextSetUser() throws ServletException, NamespaceException, IOException { ExtendedHttpService extendedHttpService = (ExtendedHttpService) getHttpService(); HttpContext testContext = new HttpContext() { @Override/*w w w .j ava2 s .com*/ public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setAttribute(HttpContext.REMOTE_USER, "TEST"); request.setAttribute(HttpContext.AUTHENTICATION_TYPE, "Basic"); return true; } @Override public URL getResource(String name) { return null; } @Override public String getMimeType(String name) { return null; } }; HttpServlet testServlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.print("USER: " + req.getRemoteUser() + " AUTH_TYPE: " + req.getAuthType()); } }; extendedHttpService.registerServlet("/" + getName(), testServlet, null, testContext); String expected = "USER: TEST AUTH_TYPE: Basic"; String actual = requestAdvisor.request(getName()); Assert.assertEquals(expected, actual); }
From source file:com.vmware.identity.SsoController.java
private void setupAuthenticationModel(Model model, Locale locale, String tenant, HttpServletRequest request, AuthnRequestState requestState) { model.addAttribute("spn", StringEscapeUtils.escapeJavaScript(getServerSPN())); model.addAttribute("tenant_brandname", StringEscapeUtils.escapeJavaScript(getBrandName(tenant))); model.addAttribute("username", messageSource.getMessage("LoginForm.UserName", null, locale)); model.addAttribute("username_placeholder", messageSource.getMessage("LoginForm.UserName.Placeholder", null, locale)); model.addAttribute("password", messageSource.getMessage("LoginForm.Password", null, locale)); model.addAttribute("passcode", messageSource.getMessage("LoginForm.Passcode", null, locale)); model.addAttribute("submit", messageSource.getMessage("LoginForm.Submit", null, locale)); model.addAttribute("error", StringEscapeUtils.escapeJavaScript(messageSource.getMessage("LoginForm.Error", null, locale))); model.addAttribute("login", messageSource.getMessage("LoginForm.Login", null, locale)); model.addAttribute("help", messageSource.getMessage("LoginForm.Help", null, locale)); model.addAttribute("winSession", messageSource.getMessage("LoginForm.WinSession", null, locale)); model.addAttribute("downloadCIP", messageSource.getMessage("LoginForm.DownloadCIP", null, locale)); model.addAttribute("unsupportedBrowserWarning", messageSource.getMessage("LoginForm.UnsupportedBrowserWarning", null, locale)); model.addAttribute("searchstring", Shared.PASSWORD_ENTRY); model.addAttribute("replacestring", Shared.PASSWORD_SUPPLIED); model.addAttribute("iAgreeTo", messageSource.getMessage("LoginForm.IAgreeTo", null, locale)); model.addAttribute("logonBannerAlertMessage", messageSource.getMessage("LoginForm.LogonBannerAlertMessage", null, locale)); setLogonBannerModelAttributes(tenant, model); AuthnTypesSupported supportedAuthnTypes; if (requestState != null) { supportedAuthnTypes = requestState.getAuthTypesSupportecd(); } else {/* w w w .j a v a 2 s .c o m*/ supportedAuthnTypes = new AuthnTypesSupported(true, true, false, false); } model.addAttribute("enable_password_auth", supportedAuthnTypes.supportsPasswordProtectTransport()); model.addAttribute("enable_windows_auth", supportedAuthnTypes.supportsWindowsSession()); model.addAttribute("enable_tlsclient_auth", supportedAuthnTypes.supportsTlsClientCert()); model.addAttribute("enable_rsaam_auth", supportedAuthnTypes.supportsRsaSecureID()); model.addAttribute("smartcard", messageSource.getMessage("LoginForm.Smartcard", null, locale)); model.addAttribute("rsaam", messageSource.getMessage("LoginForm.RsaSecurID", null, locale)); String cacEndpoint = request.getAuthType() == SecurityRequestWrapper.VMWARE_CLIENT_CERT_AUTH ? Shared.ssoCACEndpoint : Shared.ssoSmartcardRealmEndpoint; model.addAttribute("cac_endpoint", cacEndpoint); model.addAttribute("sso_endpoint", Shared.ssoEndpoint); if (supportedAuthnTypes.supportsRsaSecureID()) { model.addAttribute("rsaam_reminder", StringEscapeUtils.escapeJavaScript(getRsaSecurIDLoginGuide(tenant))); } }
From source file:org.apache.catalina.servlets.DefaultServlet.java
/** * Show HTTP header information./*from w w w .j a v a 2 s . c o m*/ * * @param req Description of the Parameter */ protected void showRequestInfo(HttpServletRequest req) { System.out.println(); System.out.println("SlideDAV Request Info"); System.out.println(); // Show generic info System.out.println("Encoding : " + req.getCharacterEncoding()); System.out.println("Length : " + req.getContentLength()); System.out.println("Type : " + req.getContentType()); System.out.println(); System.out.println("Parameters"); Enumeration parameters = req.getParameterNames(); while (parameters.hasMoreElements()) { String paramName = (String) parameters.nextElement(); String[] values = req.getParameterValues(paramName); System.out.print(paramName + " : "); for (int i = 0; i < values.length; i++) { System.out.print(values[i] + ", "); } System.out.println(); } System.out.println(); System.out.println("Protocol : " + req.getProtocol()); System.out.println("Address : " + req.getRemoteAddr()); System.out.println("Host : " + req.getRemoteHost()); System.out.println("Scheme : " + req.getScheme()); System.out.println("Server Name : " + req.getServerName()); System.out.println("Server Port : " + req.getServerPort()); System.out.println(); System.out.println("Attributes"); Enumeration attributes = req.getAttributeNames(); while (attributes.hasMoreElements()) { String attributeName = (String) attributes.nextElement(); System.out.print(attributeName + " : "); System.out.println(req.getAttribute(attributeName).toString()); } System.out.println(); // Show HTTP info System.out.println(); System.out.println("HTTP Header Info"); System.out.println(); System.out.println("Authentication Type : " + req.getAuthType()); System.out.println("HTTP Method : " + req.getMethod()); System.out.println("Path Info : " + req.getPathInfo()); System.out.println("Path translated : " + req.getPathTranslated()); System.out.println("Query string : " + req.getQueryString()); System.out.println("Remote user : " + req.getRemoteUser()); System.out.println("Requested session id : " + req.getRequestedSessionId()); System.out.println("Request URI : " + req.getRequestURI()); System.out.println("Context path : " + req.getContextPath()); System.out.println("Servlet path : " + req.getServletPath()); System.out.println("User principal : " + req.getUserPrincipal()); System.out.println(); System.out.println("Headers : "); Enumeration headers = req.getHeaderNames(); while (headers.hasMoreElements()) { String headerName = (String) headers.nextElement(); System.out.print(headerName + " : "); System.out.println(req.getHeader(headerName)); } System.out.println(); System.out.println(); }
From source file:org.sakaiproject.dav.DavServlet.java
/** * Show HTTP header information./*from w w w . j a va 2 s .c o m*/ */ @SuppressWarnings("unchecked") protected void showRequestInfo(HttpServletRequest req) { if (M_log.isDebugEnabled()) M_log.debug("DefaultServlet Request Info"); // Show generic info if (M_log.isDebugEnabled()) M_log.debug("Encoding : " + req.getCharacterEncoding()); if (M_log.isDebugEnabled()) M_log.debug("Length : " + req.getContentLength()); if (M_log.isDebugEnabled()) M_log.debug("Type : " + req.getContentType()); if (M_log.isDebugEnabled()) M_log.debug("Parameters"); Enumeration parameters = req.getParameterNames(); while (parameters.hasMoreElements()) { String paramName = (String) parameters.nextElement(); String[] values = req.getParameterValues(paramName); System.out.print(paramName + " : "); for (int i = 0; i < values.length; i++) { System.out.print(values[i] + ", "); } } if (M_log.isDebugEnabled()) M_log.debug("Protocol : " + req.getProtocol()); if (M_log.isDebugEnabled()) M_log.debug("Address : " + req.getRemoteAddr()); if (M_log.isDebugEnabled()) M_log.debug("Host : " + req.getRemoteHost()); if (M_log.isDebugEnabled()) M_log.debug("Scheme : " + req.getScheme()); if (M_log.isDebugEnabled()) M_log.debug("Server Name : " + req.getServerName()); if (M_log.isDebugEnabled()) M_log.debug("Server Port : " + req.getServerPort()); if (M_log.isDebugEnabled()) M_log.debug("Attributes"); Enumeration attributes = req.getAttributeNames(); while (attributes.hasMoreElements()) { String attributeName = (String) attributes.nextElement(); System.out.print(attributeName + " : "); if (M_log.isDebugEnabled()) M_log.debug(req.getAttribute(attributeName).toString()); } // Show HTTP info if (M_log.isDebugEnabled()) M_log.debug("HTTP Header Info"); if (M_log.isDebugEnabled()) M_log.debug("Authentication Type : " + req.getAuthType()); if (M_log.isDebugEnabled()) M_log.debug("HTTP Method : " + req.getMethod()); if (M_log.isDebugEnabled()) M_log.debug("Path Info : " + req.getPathInfo()); if (M_log.isDebugEnabled()) M_log.debug("Path translated : " + req.getPathTranslated()); if (M_log.isDebugEnabled()) M_log.debug("Query string : " + req.getQueryString()); if (M_log.isDebugEnabled()) M_log.debug("Remote user : " + req.getRemoteUser()); if (M_log.isDebugEnabled()) M_log.debug("Requested session id : " + req.getRequestedSessionId()); if (M_log.isDebugEnabled()) M_log.debug("Request URI : " + req.getRequestURI()); if (M_log.isDebugEnabled()) M_log.debug("Context path : " + req.getContextPath()); if (M_log.isDebugEnabled()) M_log.debug("Servlet path : " + req.getServletPath()); if (M_log.isDebugEnabled()) M_log.debug("User principal : " + req.getUserPrincipal()); if (M_log.isDebugEnabled()) M_log.debug("Headers : "); Enumeration headers = req.getHeaderNames(); while (headers.hasMoreElements()) { String headerName = (String) headers.nextElement(); System.out.print(headerName + " : "); if (M_log.isDebugEnabled()) M_log.debug(req.getHeader(headerName)); } }