hudson.model.Messages.BuildAuthorizationToken_InvalidTokenProvided()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(120)

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

Messages.BuildAuthorizationToken_InvalidTokenProvided介绍

[英]Invalid token provided.
[中]提供的令牌无效。

代码示例

代码示例来源:origin: jenkinsci/jenkins

public static void checkPermission(Job<?,?> project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!Jenkins.getInstance().isUseSecurity())
    return;    // everyone is authorized
  if(token!=null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token))
      return;
    if (providedToken != null)
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
  }
  project.checkPermission(Item.BUILD);
  if (req.getMethod().equals("POST")) {
    return;
  }
  if (req.getAttribute(ApiTokenProperty.class.getName()) instanceof User) {
    return;
  }
  rsp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
  rsp.addHeader("Allow", "POST");
  throw HttpResponses.forwardToView(project, "requirePOST.jelly");
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public static void checkPermission(AbstractProject project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!Hudson.getInstance().isUseSecurity())
    return;    // everyone is authorized
  if(token!=null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token))
      return;
    if (providedToken != null)
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
  }
  project.checkPermission(AbstractProject.BUILD);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public static void checkPermission(AbstractProject project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!Hudson.getInstance().isUseSecurity())
    return;    // everyone is authorized
  if(token!=null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token))
      return;
    if (providedToken != null)
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
  }
  project.checkPermission(AbstractProject.BUILD);
}

代码示例来源:origin: hudson/hudson-2.x

public static void checkPermission(AbstractProject project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!Hudson.getInstance().isUseSecurity())
    return;    // everyone is authorized
  if(token!=null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token))
      return;
    if (providedToken != null)
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
  }
  project.checkPermission(AbstractProject.BUILD);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public static void checkPermission(AbstractProject project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!HudsonSecurityEntitiesHolder.getHudsonSecurityManager().isUseSecurity()) {
    return;    // everyone is authorized
  }
  if (token != null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token)) {
      return;
    }
    if (providedToken != null) {
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
    }
  }
  project.checkPermission(AbstractProject.BUILD);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public static void checkPermission(Job<?,?> project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
  if (!Jenkins.getInstance().isUseSecurity())
    return;    // everyone is authorized
  if(token!=null && token.token != null) {
    //check the provided token
    String providedToken = req.getParameter("token");
    if (providedToken != null && providedToken.equals(token.token))
      return;
    if (providedToken != null)
      throw new AccessDeniedException(Messages.BuildAuthorizationToken_InvalidTokenProvided());
  }
  project.checkPermission(Item.BUILD);
  if (req.getMethod().equals("POST")) {
    return;
  }
  if (req.getAttribute(ApiTokenProperty.class.getName()) instanceof User) {
    return;
  }
  rsp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
  rsp.addHeader("Allow", "POST");
  throw HttpResponses.forwardToView(project, "requirePOST.jelly");
}

相关文章

Messages类方法