org.apache.catalina.Context.getPreemptiveAuthentication()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(102)

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

Context.getPreemptiveAuthentication介绍

[英]Determines if a user presents authentication credentials, will the context will process them when the request is for a non-protected resource.
[中]确定用户是否提供身份验证凭据,当请求是针对非保护资源时,上下文将处理这些凭据。

代码示例

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Reject the request that was denied by this valve.
 * <p>If <code>invalidAuthenticationWhenDeny</code> is true
 * and the context has <code>preemptiveAuthentication</code>
 * set, set an invalid authorization header to trigger basic auth.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be processed
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
protected void denyRequest(Request request, Response response)
    throws IOException, ServletException {
  if (invalidAuthenticationWhenDeny) {
    Context context = request.getContext();
    if (context != null && context.getPreemptiveAuthentication()) {
      if (request.getCoyoteRequest().getMimeHeaders().getValue("authorization") == null) {
        request.getCoyoteRequest().getMimeHeaders().addValue("authorization").setString("invalid");
      }
      getNext().invoke(request, response);
      return;
    }
  }
  response.sendError(denyStatus);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Reject the request that was denied by this valve.
 * <p>If <code>invalidAuthenticationWhenDeny</code> is true
 * and the context has <code>preemptiveAuthentication</code>
 * set, set an invalid authorization header to trigger basic auth.
 *
 * @param request The servlet request to be processed
 * @param response The servlet response to be processed
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
protected void denyRequest(Request request, Response response)
    throws IOException, ServletException {
  if (invalidAuthenticationWhenDeny) {
    Context context = request.getContext();
    if (context != null && context.getPreemptiveAuthentication()) {
      if (request.getCoyoteRequest().getMimeHeaders().getValue("authorization") == null) {
        request.getCoyoteRequest().getMimeHeaders().addValue("authorization").setString("invalid");
      }
      getNext().invoke(request, response);
      return;
    }
  }
  response.sendError(denyStatus);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

if (context.getIgnoreAnnotations() &&
    (constraints == null || constraints.length ==0) &&
    !context.getPreemptiveAuthentication())  {
  return;
} else {

代码示例来源:origin: codefollower/Tomcat-Research

if (context.getIgnoreAnnotations() &&
    (constraints == null || constraints.length ==0) &&
    !context.getPreemptiveAuthentication())  {
  return;
} else {

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

if (context.getIgnoreAnnotations() &&
    (constraints == null || constraints.length ==0) &&
    !context.getPreemptiveAuthentication())  {
  return;
} else {

代码示例来源:origin: codefollower/Tomcat-Research

= realm.findSecurityConstraints(request, this.context);
if (constraints == null && !context.getPreemptiveAuthentication()) {
  if (log.isDebugEnabled()) {
    log.debug(" Not subject to any constraint");
if (!authRequired && context.getPreemptiveAuthentication()) {
  authRequired =
    request.getCoyoteRequest().getMimeHeaders().getValue(
if (!authRequired && context.getPreemptiveAuthentication()) {
  X509Certificate[] certs = (X509Certificate[]) request.getAttribute(
      Globals.CERTIFICATES_ATTR);

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

= realm.findSecurityConstraints(request, this.context);
if (constraints == null && !context.getPreemptiveAuthentication()) {
  if (log.isDebugEnabled())
    log.debug(" Not subject to any constraint");
if (!authRequired && context.getPreemptiveAuthentication()) {
  authRequired =
    request.getCoyoteRequest().getMimeHeaders().getValue(
if (!authRequired && context.getPreemptiveAuthentication()) {
  X509Certificate[] certs = (X509Certificate[]) request.getAttribute(
      Globals.CERTIFICATES_ATTR);

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

= realm.findSecurityConstraints(request, this.context);
if (constraints == null && !context.getPreemptiveAuthentication()) {
  if (log.isDebugEnabled())
    log.debug(" Not subject to any constraint");
if (!authRequired && context.getPreemptiveAuthentication()) {
  authRequired =
    request.getCoyoteRequest().getMimeHeaders().getValue(
if (!authRequired && context.getPreemptiveAuthentication()) {
  X509Certificate[] certs = (X509Certificate[]) request.getAttribute(
      Globals.CERTIFICATES_ATTR);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

if (constraints == null && !context.getPreemptiveAuthentication() && !authRequired) {
  if (log.isDebugEnabled()) {
    log.debug(" Not subject to any constraint");
if (!authRequired && context.getPreemptiveAuthentication()) {
  authRequired =
      request.getCoyoteRequest().getMimeHeaders().getValue("authorization") != null;
if (!authRequired && context.getPreemptiveAuthentication()
    && HttpServletRequest.CLIENT_CERT_AUTH.equals(getAuthMethod())) {
  X509Certificate[] certs = getRequestCertificates(request);

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

if (constraints == null && !context.getPreemptiveAuthentication() && !authRequired) {
  if (log.isDebugEnabled()) {
    log.debug(" Not subject to any constraint");
if (!authRequired && context.getPreemptiveAuthentication()) {
  authRequired =
      request.getCoyoteRequest().getMimeHeaders().getValue("authorization") != null;
if (!authRequired && context.getPreemptiveAuthentication()
    && HttpServletRequest.CLIENT_CERT_AUTH.equals(getAuthMethod())) {
  X509Certificate[] certs = getRequestCertificates(request);

相关文章

微信公众号

最新文章

更多

Context类方法