gpt4 book ai didi

org.openid4java.discovery.yadis.YadisResult类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 10:29:31 30 4
gpt4 key购买 nike

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

YadisResult介绍

[英]The results of Yadis discovery performed on a YadisURL, represented through a stripped-down XRDS model, containing only the those discovery information pieces that are relevant for OpenID.

The payload is represented by the XRDS document. Along with it other meta-information is contained, which can be useful while consuming the results of Yadis discoveries.
[中]在YadisURL上执行的Yadis发现结果,通过一个精简的XRDS模型表示,只包含与OpenID相关的发现信息片段。
有效负载由XRDS文档表示。除此之外,还包含其他元信息,这些信息在使用Yadis发现的结果时非常有用。

代码示例

代码示例来源:origin: org.wso2.org.openid4java/openid4java-nodeps

/**
 * Performs Relyin Party discovery on the supplied URL.
 *
 * @param url RP's realm or return_to URL
 * @return List of DiscoveryInformation entries discovered
 * from the RP's endpoints
 */
public List discoverRP(String url) throws DiscoveryException {
  return discover(url, 0,
          Collections.singleton(DiscoveryInformation.OPENID2_RP))
      .getDiscoveredInformation(Collections.singleton(DiscoveryInformation.OPENID2_RP));
}

代码示例来源:origin: org.wso2.org.openid4java/openid4java-nodeps

public YadisResult discover(String url, int maxRedirects, HttpFetcher httpFetcher, Set serviceTypes)
    throws DiscoveryException {
  YadisUrl yadisUrl = new YadisUrl(url);
  // try to retrieve the Yadis Descriptor URL with a HEAD call first
  YadisResult result = retrieveXrdsLocation(yadisUrl, false, maxRedirects, serviceTypes);
  // try GET 
  if (result.getXrdsLocation() == null) {
    result = retrieveXrdsLocation(yadisUrl, true, maxRedirects, serviceTypes);
  }
  if (result.getXrdsLocation() != null) {
    retrieveXrdsDocument(result, maxRedirects, serviceTypes);
  } else if (result.hasEndpoints()) {
    // report the yadis url as the xrds location
    result.setXrdsLocation(url, OpenIDException.YADIS_INVALID_URL);
  }
  _log.info("Yadis discovered " + result.getEndpointCount() + " endpoints from: " + url);
  return result;
}

代码示例来源:origin: org.openid4java/openid4java

YadisResult result = new YadisResult();
    result.setYadisUrl(url);
      result.setXrdsLocation(locationHeaders[0].getValue(),
        useGet ? OpenIDException.YADIS_GET_INVALID_RESPONSE :
          OpenIDException.YADIS_HEAD_INVALID_RESPONSE);
      result.setNormalizedUrl(resp.getFinalUri());
      result.setNormalizedUrl(resp.getFinalUri());
      result.setContentType(contentType.getValue());
      if (resp.isBodySizeExceeded())
        throw new YadisException(
          " bytes in HTTP response body from " + url,
          OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
      result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
      if (xrdsLocation != null)
        result.setNormalizedUrl(resp.getFinalUri());
        result.setXrdsLocation(xrdsLocation,
          OpenIDException.YADIS_GET_INVALID_RESPONSE);

代码示例来源:origin: org.openid4java/openid4java

HttpResponse resp = _httpFetcher.get(result.getXrdsLocation().toString());
  throw new YadisException("GET failed on " + result.getXrdsLocation(),
      OpenIDException.YADIS_GET_ERROR);
result.setXrdsLocation(resp.getFinalUri(), OpenIDException.YADIS_GET_INVALID_RESPONSE);
  result.setContentType(contentType.getValue());
    " bytes in HTTP response body from " + result.getXrdsLocation(),
    OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));

代码示例来源:origin: org.wso2.org.openid4java/openid4java-nodeps

public List getDiscoveredInformation(Set targetTypes) throws DiscoveryException {
  List result = new ArrayList();
  if (hasEndpoints()) {
    XrdsServiceEndpoint endpoint;
    Iterator endpointsIter = _endpoints.iterator();
    while (endpointsIter.hasNext()) {
      endpoint = (XrdsServiceEndpoint) endpointsIter.next();
      Iterator typesIter = endpoint.getTypes().iterator();
      while (typesIter.hasNext()) {
        String type = (String) typesIter.next();
        if (!targetTypes.contains(type)) {
          continue;
        }
        try {
          result.add(new DiscoveryInformation(
              new URL(endpoint.getUri()),
              DiscoveryInformation.OPENID_SIGNON_TYPES.contains(type) ?
              new UrlIdentifier(_normalizedUrl) : null,
              DiscoveryInformation.OPENID2.equals(type) ? endpoint.getLocalId() :
              DiscoveryInformation.OPENID1_SIGNON_TYPES.contains(type) ? endpoint.getDelegate() : null,
              type,
              endpoint.getTypes()));
        } catch (MalformedURLException e) {
          throw new YadisException("Invalid endpoint URL discovered: " + endpoint.getUri(), OpenIDException.YADIS_INVALID_URL);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: org.wso2.org.openid4java/openid4java-nodeps

YadisResult result = new YadisResult();
    result.setYadisUrl(url);
    } else if (locationHeaders != null && locationHeaders.length > 0) {
      result.setXrdsLocation(locationHeaders[0].getValue(),
                  useGet ? OpenIDException.YADIS_GET_INVALID_RESPONSE :
                  OpenIDException.YADIS_HEAD_INVALID_RESPONSE);
      result.setNormalizedUrl(resp.getFinalUri());
    } else if (contentType != null && contentType.getValue() != null &&
          contentType.getValue().split(";")[0].equalsIgnoreCase(YADIS_CONTENT_TYPE) &&
          resp.getBody() != null) {
      result.setNormalizedUrl(resp.getFinalUri());
      result.setContentType(contentType.getValue());
      if (resp.isBodySizeExceeded()) {
        throw new YadisException(
            OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
      result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
    } else if (resp.getBody() != null) {
        result.setNormalizedUrl(resp.getFinalUri());
        result.setXrdsLocation(xrdsLocation,
                    OpenIDException.YADIS_GET_INVALID_RESPONSE);

代码示例来源:origin: org.openid4java/openid4java-nodeps

HttpResponse resp = _httpFetcher.get(result.getXrdsLocation().toString());
  throw new YadisException("GET failed on " + result.getXrdsLocation(),
      OpenIDException.YADIS_GET_ERROR);
result.setXrdsLocation(resp.getFinalUri(), OpenIDException.YADIS_GET_INVALID_RESPONSE);
  result.setContentType(contentType.getValue());
    " bytes in HTTP response body from " + result.getXrdsLocation(),
    OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));

代码示例来源:origin: org.openid4java/openid4java-nodeps

public List getDiscoveredInformation(Set targetTypes) throws DiscoveryException
{
  List result = new ArrayList();
  if (hasEndpoints()) 
  {
    XrdsServiceEndpoint endpoint;
    Iterator endpointsIter = _endpoints.iterator();
    while (endpointsIter.hasNext()) {
      endpoint = (XrdsServiceEndpoint) endpointsIter.next();
      Iterator typesIter = endpoint.getTypes().iterator();
      while (typesIter.hasNext()) {
        String type = (String) typesIter.next();
        if (!targetTypes.contains(type)) continue;
        try {
          result.add(new DiscoveryInformation(
            new URL(endpoint.getUri()),
            DiscoveryInformation.OPENID_SIGNON_TYPES.contains(type) ?
              new UrlIdentifier(_normalizedUrl) : null,
            DiscoveryInformation.OPENID2.equals(type) ? endpoint.getLocalId() :
            DiscoveryInformation.OPENID1_SIGNON_TYPES.contains(type) ? endpoint.getDelegate() : null,
            type,
            endpoint.getTypes()));
        } catch (MalformedURLException e) {
          throw new YadisException("Invalid endpoint URL discovered: " + endpoint.getUri(), OpenIDException.YADIS_INVALID_URL);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: jbufu/openid4java

YadisResult result = new YadisResult();
    result.setYadisUrl(url);
      result.setXrdsLocation(locationHeaders[0].getValue(),
        useGet ? OpenIDException.YADIS_GET_INVALID_RESPONSE :
          OpenIDException.YADIS_HEAD_INVALID_RESPONSE);
      result.setNormalizedUrl(resp.getFinalUri());
      result.setNormalizedUrl(resp.getFinalUri());
      result.setContentType(contentType.getValue());
      if (resp.isBodySizeExceeded())
        throw new YadisException(
          " bytes in HTTP response body from " + url,
          OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
      result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
      if (xrdsLocation != null)
        result.setNormalizedUrl(resp.getFinalUri());
        result.setXrdsLocation(xrdsLocation,
          OpenIDException.YADIS_GET_INVALID_RESPONSE);

代码示例来源:origin: org.openid4java/openid4java-nodeps

public YadisResult discover(String url, int maxRedirects, HttpFetcher httpFetcher, Set serviceTypes)
  throws DiscoveryException
{
  YadisUrl yadisUrl = new YadisUrl(url);
  // try to retrieve the Yadis Descriptor URL with a HEAD call first
  YadisResult result = retrieveXrdsLocation(yadisUrl, false, maxRedirects, serviceTypes);
  // try GET 
  if (result.getXrdsLocation() == null)
    result = retrieveXrdsLocation(yadisUrl, true, maxRedirects, serviceTypes);
  if (result.getXrdsLocation() != null)
  {
    retrieveXrdsDocument(result, maxRedirects, serviceTypes);
  }
  else if (result.hasEndpoints())
  {
    // report the yadis url as the xrds location
    result.setXrdsLocation(url, OpenIDException.YADIS_INVALID_URL);
  }
  _log.info("Yadis discovered " + result.getEndpointCount() + " endpoints from: " + url);
  return result;
}

代码示例来源:origin: jbufu/openid4java

HttpResponse resp = _httpFetcher.get(result.getXrdsLocation().toString());
  throw new YadisException("GET failed on " + result.getXrdsLocation(),
      OpenIDException.YADIS_GET_ERROR);
result.setXrdsLocation(resp.getFinalUri(), OpenIDException.YADIS_GET_INVALID_RESPONSE);
  result.setContentType(contentType.getValue());
    " bytes in HTTP response body from " + result.getXrdsLocation(),
    OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));

代码示例来源:origin: org.openid4java/openid4java

/**
 * Performs Relyin Party discovery on the supplied URL.
 *
 * @param url   RP's realm or return_to URL
 * @return      List of DiscoveryInformation entries discovered
 *              from the RP's endpoints
 */
public List discoverRP(String url) throws DiscoveryException
{
  return discover(url, 0,
    Collections.singleton(DiscoveryInformation.OPENID2_RP))
    .getDiscoveredInformation(Collections.singleton(DiscoveryInformation.OPENID2_RP));
}

代码示例来源:origin: org.openid4java/openid4java

public List getDiscoveredInformation(Set targetTypes) throws DiscoveryException
{
  List result = new ArrayList();
  if (hasEndpoints()) 
  {
    XrdsServiceEndpoint endpoint;
    Iterator endpointsIter = _endpoints.iterator();
    while (endpointsIter.hasNext()) {
      endpoint = (XrdsServiceEndpoint) endpointsIter.next();
      Iterator typesIter = endpoint.getTypes().iterator();
      while (typesIter.hasNext()) {
        String type = (String) typesIter.next();
        if (!targetTypes.contains(type)) continue;
        try {
          result.add(new DiscoveryInformation(
            new URL(endpoint.getUri()),
            DiscoveryInformation.OPENID_SIGNON_TYPES.contains(type) ?
              new UrlIdentifier(_normalizedUrl) : null,
            DiscoveryInformation.OPENID2.equals(type) ? endpoint.getLocalId() :
            DiscoveryInformation.OPENID1_SIGNON_TYPES.contains(type) ? endpoint.getDelegate() : null,
            type,
            endpoint.getTypes()));
        } catch (MalformedURLException e) {
          throw new YadisException("Invalid endpoint URL discovered: " + endpoint.getUri(), OpenIDException.YADIS_INVALID_URL);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: org.openid4java/openid4java-nodeps

YadisResult result = new YadisResult();
    result.setYadisUrl(url);
      result.setXrdsLocation(locationHeaders[0].getValue(),
        useGet ? OpenIDException.YADIS_GET_INVALID_RESPONSE :
          OpenIDException.YADIS_HEAD_INVALID_RESPONSE);
      result.setNormalizedUrl(resp.getFinalUri());
      result.setNormalizedUrl(resp.getFinalUri());
      result.setContentType(contentType.getValue());
      if (resp.isBodySizeExceeded())
        throw new YadisException(
          " bytes in HTTP response body from " + url,
          OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
      result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
      if (xrdsLocation != null)
        result.setNormalizedUrl(resp.getFinalUri());
        result.setXrdsLocation(xrdsLocation,
          OpenIDException.YADIS_GET_INVALID_RESPONSE);

代码示例来源:origin: com.cloudbees/openid4java-shaded

public YadisResult discover(String url, int maxRedirects, HttpFetcher httpFetcher, Set serviceTypes)
  throws DiscoveryException
{
  YadisUrl yadisUrl = new YadisUrl(url);
  // try to retrieve the Yadis Descriptor URL with a HEAD call first
  YadisResult result = retrieveXrdsLocation(yadisUrl, false, maxRedirects, serviceTypes);
  // try GET 
  if (result.getXrdsLocation() == null)
    result = retrieveXrdsLocation(yadisUrl, true, maxRedirects, serviceTypes);
  if (result.getXrdsLocation() != null)
  {
    retrieveXrdsDocument(result, maxRedirects, serviceTypes);
  }
  else if (result.hasEndpoints())
  {
    // report the yadis url as the xrds location
    result.setXrdsLocation(url, OpenIDException.YADIS_INVALID_URL);
  }
  _log.info("Yadis discovered " + result.getEndpointCount() + " endpoints from: " + url);
  return result;
}

代码示例来源:origin: org.wso2.org.openid4java/openid4java-nodeps

HttpResponse resp = _httpFetcher.get(result.getXrdsLocation().toString());
  throw new YadisException("GET failed on " + result.getXrdsLocation(),
               OpenIDException.YADIS_GET_ERROR);
result.setXrdsLocation(resp.getFinalUri(), OpenIDException.YADIS_GET_INVALID_RESPONSE);
  result.setContentType(contentType.getValue());
  throw new YadisException(
      "More than " + _httpFetcher.getRequestOptions().getMaxBodySize() +
      " bytes in HTTP response body from " + result.getXrdsLocation(),
      OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));

代码示例来源:origin: com.cloudbees/openid4java-shaded

/**
 * Performs Relyin Party discovery on the supplied URL.
 *
 * @param url   RP's realm or return_to URL
 * @return      List of DiscoveryInformation entries discovered
 *              from the RP's endpoints
 */
public List discoverRP(String url) throws DiscoveryException
{
  return discover(url, 0,
    Collections.singleton(DiscoveryInformation.OPENID2_RP))
    .getDiscoveredInformation(Collections.singleton(DiscoveryInformation.OPENID2_RP));
}

代码示例来源:origin: com.cloudbees/openid4java-shaded

public List getDiscoveredInformation(Set targetTypes) throws DiscoveryException
{
  List result = new ArrayList();
  if (hasEndpoints()) 
  {
    XrdsServiceEndpoint endpoint;
    Iterator endpointsIter = _endpoints.iterator();
    while (endpointsIter.hasNext()) {
      endpoint = (XrdsServiceEndpoint) endpointsIter.next();
      Iterator typesIter = endpoint.getTypes().iterator();
      while (typesIter.hasNext()) {
        String type = (String) typesIter.next();
        if (!targetTypes.contains(type)) continue;
        try {
          result.add(new DiscoveryInformation(
            new URL(endpoint.getUri()),
            DiscoveryInformation.OPENID_SIGNON_TYPES.contains(type) ?
              new UrlIdentifier(_normalizedUrl) : null,
            DiscoveryInformation.OPENID2.equals(type) ? endpoint.getLocalId() :
            DiscoveryInformation.OPENID1_SIGNON_TYPES.contains(type) ? endpoint.getDelegate() : null,
            type,
            endpoint.getTypes()));
        } catch (MalformedURLException e) {
          throw new YadisException("Invalid endpoint URL discovered: " + endpoint.getUri(), OpenIDException.YADIS_INVALID_URL);
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: com.cloudbees/openid4java-shaded

YadisResult result = new YadisResult();
    result.setYadisUrl(url);
      result.setXrdsLocation(locationHeaders[0].getValue(),
        useGet ? OpenIDException.YADIS_GET_INVALID_RESPONSE :
          OpenIDException.YADIS_HEAD_INVALID_RESPONSE);
      result.setNormalizedUrl(resp.getFinalUri());
      result.setNormalizedUrl(resp.getFinalUri());
      result.setContentType(contentType.getValue());
      if (resp.isBodySizeExceeded())
        throw new YadisException(
          " bytes in HTTP response body from " + url,
          OpenIDException.YADIS_XRDS_SIZE_EXCEEDED);
      result.setEndpoints(XRDS_PARSER.parseXrds(resp.getBody(), serviceTypes));
      if (xrdsLocation != null)
        result.setNormalizedUrl(resp.getFinalUri());
        result.setXrdsLocation(xrdsLocation,
          OpenIDException.YADIS_GET_INVALID_RESPONSE);

代码示例来源:origin: org.openid4java/openid4java

public YadisResult discover(String url, int maxRedirects, HttpFetcher httpFetcher, Set serviceTypes)
  throws DiscoveryException
{
  YadisUrl yadisUrl = new YadisUrl(url);
  // try to retrieve the Yadis Descriptor URL with a HEAD call first
  YadisResult result = retrieveXrdsLocation(yadisUrl, false, maxRedirects, serviceTypes);
  // try GET 
  if (result.getXrdsLocation() == null)
    result = retrieveXrdsLocation(yadisUrl, true, maxRedirects, serviceTypes);
  if (result.getXrdsLocation() != null)
  {
    retrieveXrdsDocument(result, maxRedirects, serviceTypes);
  }
  else if (result.hasEndpoints())
  {
    // report the yadis url as the xrds location
    result.setXrdsLocation(url, OpenIDException.YADIS_INVALID_URL);
  }
  _log.info("Yadis discovered " + result.getEndpointCount() + " endpoints from: " + url);
  return result;
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com