org.openid4java.discovery.yadis
public class YadisResolver extends java.lang.Object
Yadis discovery protocol returns a Yadis Resource Descriptor (XRDS) document associated with a Yadis Identifier (YadisID)
YadisIDs can be any type of identifiers that are resolvable to a URL form, and in addition the URL form uses a HTTP or a HTTPS schema. Such an URL is defined by the Yadis speficification as a YadisURL. This functionality is implemented by the YadisURL helper class.
The discovery of the XRDS document is performed by the discover method on a YadisUrl.
Internal parameters used during the discovery process :
Modifier and Type | Field and Description |
---|---|
private HttpFetcher |
_httpFetcher |
private static org.apache.commons.logging.Log |
_log |
private int |
_maxRedirects
Maximum number of redirects to be followed for the HTTP calls.
|
private static boolean |
DEBUG |
private static XrdsParser |
XRDS_PARSER |
private static java.lang.String |
XRDS_PARSER_CLASS_NAME_KEY |
private static java.lang.String |
YADIS_ACCEPT_HEADER |
private static java.lang.String |
YADIS_CONTENT_TYPE |
private static YadisHtmlParser |
YADIS_HTML_PARSER |
private static java.lang.String |
YADIS_HTML_PARSER_CLASS_NAME_KEY |
static java.lang.String |
YADIS_XRDS_LOCATION |
Constructor and Description |
---|
YadisResolver(HttpFetcher httpFetcher) |
YadisResolver(HttpFetcherFactory httpFetcherFactory) |
Modifier and Type | Method and Description |
---|---|
java.util.List |
discover(java.lang.String url)
Performs Yadis discovery on the YadisURL.
|
java.util.List |
discover(java.lang.String url,
HttpFetcher httpFetcher)
Performs Yadis discovery on the YadisURL.
|
java.util.List |
discover(java.lang.String url,
int maxRedirects)
Performs Yadis discovery on the YadisURL.
|
java.util.List |
discover(java.lang.String url,
int maxRedirects,
HttpFetcher httpFetcher)
Performs Yadis discovery on the YadisURL.
|
YadisResult |
discover(java.lang.String url,
int maxRedirects,
HttpFetcher httpFetcher,
java.util.Set serviceTypes) |
YadisResult |
discover(java.lang.String url,
int maxRedirects,
java.util.Set serviceTypes) |
java.util.List |
discoverRP(java.lang.String url)
Performs Relyin Party discovery on the supplied URL.
|
private java.lang.String |
getHtmlMeta(java.lang.String input)
Parses the HTML input stream and scans for the Yadis XRDS location
in the HTML HEAD Meta tags.
|
HttpFetcher |
getHttpFetcher() |
int |
getMaxRedirects()
Gets the internal limit configured for the maximum number of redirects
to be followed for the HTTP calls.
|
private void |
retrieveXrdsDocument(YadisResult result,
int maxRedirects,
java.util.Set serviceTypes)
Tries to retrieve the XRDS document via a GET call on XRDS location
provided in the result parameter.
|
private YadisResult |
retrieveXrdsLocation(YadisUrl url,
boolean useGet,
int maxRedirects,
java.util.Set serviceTypes)
Tries to retrieve the XRDS location url by performing a cheap HEAD call
on the YadisURL.
|
void |
setMaxRedirects(int maxRedirects)
Sets the maximum number of redirects to be followed for the HTTP calls.
|
private static org.apache.commons.logging.Log _log
private static final boolean DEBUG
public static final java.lang.String YADIS_XRDS_LOCATION
private static final java.lang.String YADIS_CONTENT_TYPE
private static final java.lang.String YADIS_ACCEPT_HEADER
private static final java.lang.String YADIS_HTML_PARSER_CLASS_NAME_KEY
private static final YadisHtmlParser YADIS_HTML_PARSER
private static final java.lang.String XRDS_PARSER_CLASS_NAME_KEY
private static final XrdsParser XRDS_PARSER
private int _maxRedirects
private final HttpFetcher _httpFetcher
@Inject public YadisResolver(HttpFetcherFactory httpFetcherFactory)
public YadisResolver(HttpFetcher httpFetcher)
public int getMaxRedirects()
public void setMaxRedirects(int maxRedirects)
public java.util.List discoverRP(java.lang.String url) throws DiscoveryException
url
- RP's realm or return_to URLDiscoveryException
public java.util.List discover(java.lang.String url) throws DiscoveryException
The maximum number of redirects that are followed is determined by the #_maxRedirects member field.
url
- YadisURL on which discovery will be performedDiscoveryException
#discover(String, int, HttpCache)
public java.util.List discover(java.lang.String url, HttpFetcher httpFetcher) throws DiscoveryException
The maximum number of redirects that are followed is determined by the #_maxRedirects member field.
url
- YadisURL on which discovery will be performedhttpFetcher
- HttpFetcher
object to use for the callDiscoveryException
#discover(String, int, HttpCache)
public java.util.List discover(java.lang.String url, int maxRedirects) throws DiscoveryException
url
- YadisURL on which discovery will be performedmaxRedirects
- The maximum number of redirects to be followed.DiscoveryException
YadisResult
public java.util.List discover(java.lang.String url, int maxRedirects, HttpFetcher httpFetcher) throws DiscoveryException
url
- YadisURL on which discovery will be performedmaxRedirects
- The maximum number of redirects to be followed.httpFetcher
- HttpFetcher
object to use for the call.DiscoveryException
YadisResult
public YadisResult discover(java.lang.String url, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
DiscoveryException
public YadisResult discover(java.lang.String url, int maxRedirects, HttpFetcher httpFetcher, java.util.Set serviceTypes) throws DiscoveryException
DiscoveryException
private void retrieveXrdsDocument(YadisResult result, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
result
- The YadisResult object containing a valid XRDS location.
It will be further populated with the Yadis discovery results.cache
- The HttpClient object to use for placing the callmaxRedirects
- DiscoveryException
private java.lang.String getHtmlMeta(java.lang.String input) throws YadisException
input
- input data streamYadisException
- on parsing errors or Yadis protocal violationsprivate YadisResult retrieveXrdsLocation(YadisUrl url, boolean useGet, int maxRedirects, java.util.Set serviceTypes) throws DiscoveryException
The returned string should be validated before being used as a XRDS-Location URL.
cache
- HttpClient object to use for placing the callmaxRedirects
- url
- The YadisURLresult
- The location of the XRDS document and the normalized
Url will be returned in the YadisResult object.
The location of the XRDS document will be null if:
YadisException
- if:
DiscoveryException
public HttpFetcher getHttpFetcher()
Copyright 2006-2008 Sxip Identity Corporation