IdpIdentifier host = new IdpIdentifier(claimedId.getUrl().getHost());
// find the <Service> element with type '.../describedby'
Service service = getServiceForType(siteXrd.getXrd(), URI_TEMPLATE_TYPE);
if (service == null) {
throw new DiscoveryException("could not find service of type " +
URI_TEMPLATE_TYPE + " in XRDS at location " +
claimedId.getIdentifier());
}
// is there a NextAuthority? We only trust the next authority element
// if the document is properly signed.
String nextAuthority = checkSecurity(siteXrd, host, null)
? getTagValue(service, NEXT_AUTHORITY_TAG) // might still be null
: null; // must be null if unsigned
// find the <URITemplate> tag inside the <Service> element
String uriTemplate = getTagValue(service, URI_TEMPLATE_TAG);
if (uriTemplate == null) {
throw new DiscoveryException("missing " + URI_TEMPLATE_TAG + " in " +
"service specification in XRDS at location " +
claimedId.getIdentifier());
}
// now, apply the mapping: