hudson.model.Hudson.getCrumbIssuer()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(81)

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

Hudson.getCrumbIssuer介绍

暂无

代码示例

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

/**
 * Because servlet containers generally don't specify the ordering of the initialization
 * (and different implementations indeed do this differently --- See HUDSON-3878),
 * we cannot use Hudson to the CrumbIssuer into CrumbFilter eagerly.
 */
public CrumbIssuer getCrumbIssuer() {
  Hudson h = Hudson.getInstance();
  if(h==null)     return null;    // before Hudson is initialized?
  return h.getCrumbIssuer();
}

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

/**
 * Because servlet containers generally don't specify the ordering of the initialization
 * (and different implementations indeed do this differently --- See HUDSON-3878),
 * we cannot use Hudson to the CrumbIssuer into CrumbFilter eagerly.
 */
public CrumbIssuer getCrumbIssuer() {
  Hudson h = Hudson.getInstance();
  if(h==null)     return null;    // before Hudson is initialized?
  return h.getCrumbIssuer();
}

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

/**
 * Because servlet containers generally don't specify the ordering of the initialization
 * (and different implementations indeed do this differently --- See HUDSON-3878),
 * we cannot use Hudson to the CrumbIssuer into CrumbFilter eagerly.
 */
public CrumbIssuer getCrumbIssuer() {
  Hudson h = Hudson.getInstance();
  if(h==null)     return null;    // before Hudson is initialized?
  return h.getCrumbIssuer();
}

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

/**
 * Because servlet containers generally don't specify the ordering of the
 * initialization (and different implementations indeed do this differently
 * --- See HUDSON-3878), we cannot use Hudson to the CrumbIssuer into
 * CrumbFilter eagerly.
 */
public CrumbIssuer getCrumbIssuer() {
  Hudson h = Hudson.getInstance();
  if (h == null) {
    return null;    // before Hudson is initialized?
  }
  return h.getCrumbIssuer();
}

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

public static String getCrumb(StaplerRequest req) {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getCrumb(req) : "";
}

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

public static String getCrumb(StaplerRequest req) {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getCrumb(req) : "";
}

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

public static String getCrumb(StaplerRequest req) {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getCrumb(req) : "";
}

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

public static String getCrumb(StaplerRequest req) {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getCrumb(req) : "";
}

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

public static String getCrumbRequestField() {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}

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

/**
 * Creates a URL with crumb parameters relative to {{@link #getContextPath()}
 */
public URL createCrumbedUrl(String relativePath) throws IOException {
  CrumbIssuer issuer = hudson.getCrumbIssuer();
  String crumbName = issuer.getDescriptor().getCrumbRequestField();
  String crumb = issuer.getCrumb(null);
  
  return new URL(getContextPath()+relativePath+"?"+crumbName+"="+crumb);
}

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

public static String getCrumbRequestField() {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}

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

public static String getCrumbRequestField() {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}

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

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = { new NameValuePair() };
  
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null ));
  
  req.setRequestParameters(Arrays.asList( crumb ));
  return req;
}

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

/**
 * Creates a URL with crumb parameters relative to {{@link #getContextPath()}
 */
public URL createCrumbedUrl(String relativePath) throws IOException {
  CrumbIssuer issuer = hudson.getCrumbIssuer();
  String crumbName = issuer.getDescriptor().getCrumbRequestField();
  String crumb = issuer.getCrumb(null);
  
  return new URL(getContextPath()+relativePath+"?"+crumbName+"="+crumb);
}

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

public static String getCrumbRequestField() {
  Hudson h = Hudson.getInstance();
  CrumbIssuer issuer = h != null ? h.getCrumbIssuer() : null;
  return issuer != null ? issuer.getDescriptor().getCrumbRequestField() : "";
}

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

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = {new NameValuePair()};
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb(null));
  req.setRequestParameters(Arrays.asList(crumb));
  return req;
}

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

/**
 * Creates a URL with crumb parameters relative to
 * {{@link #getContextPath()}
 */
public URL createCrumbedUrl(String relativePath) throws IOException {
  CrumbIssuer issuer = hudson.getCrumbIssuer();
  String crumbName = issuer.getDescriptor().getCrumbRequestField();
  String crumb = issuer.getCrumb(null);
  return new URL(getContextPath() + relativePath + "?" + crumbName + "=" + crumb);
}

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

/**
 * Adds a security crumb to the quest
 */
public WebRequestSettings addCrumb(WebRequestSettings req) {
  NameValuePair crumb[] = { new NameValuePair() };
  
  crumb[0].setName(hudson.getCrumbIssuer().getDescriptor().getCrumbRequestField());
  crumb[0].setValue(hudson.getCrumbIssuer().getCrumb( null ));
  
  req.setRequestParameters(Arrays.asList( crumb ));
  return req;
}

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

/**
 * Do a finger-print check.
 */
public void doDoFingerprintCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  // Parse the request
  MultipartFormDataParser p = new MultipartFormDataParser(req);
  if (Hudson.getInstance().isUseCrumbs() && !Hudson.getInstance().getCrumbIssuer().validateCrumb(req, p)) {
    rsp.sendError(HttpServletResponse.SC_FORBIDDEN, "No crumb found");
  }
  try {
    rsp.sendRedirect2(req.getContextPath() + "/fingerprint/"
        + Util.getDigestOf(p.getFileItem("name").getInputStream()) + '/');
  } finally {
    p.cleanUp();
  }
}

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

/**
 * Do a finger-print check.
 */
public void doDoFingerprintCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  // Parse the request
  MultipartFormDataParser p = new MultipartFormDataParser(req);
  if (Hudson.getInstance().isUseCrumbs() && !Hudson.getInstance().getCrumbIssuer().validateCrumb(req, p)) {
    rsp.sendError(HttpServletResponse.SC_FORBIDDEN, "No crumb found");
  }
  try {
    rsp.sendRedirect2(req.getContextPath() + "/fingerprint/"
        + Util.getDigestOf(p.getFileItem("name").getInputStream()) + '/');
  } finally {
    p.cleanUp();
  }
}

相关文章

微信公众号

最新文章

更多

Hudson类方法