List<Link> services = entry.getLinks().get("service");
if (services==null) {
getLogger().warning("Missing 'service' relation link on realm "+name);
} else {
URI service = services.get(0).getLink();
AuthProtocolService auth = (AuthProtocolService)autoServices.get(name);
if (auth!=null) {
if (!auth.getServiceURI().equals(service)) {
// The service URI has changed
autoServices.remove(name);
auth = null;
changedAuth.put(name,Boolean.TRUE);
}
}
if (auth==null) {
getLogger().info("Adding realm "+name+" from service "+service);
auth = new AuthProtocolService();
Properties props = new Properties();
props.setProperty("href",service.toString());
try {
auth.init(props);
autoServices.put(name,auth);
currentAuthList.put(name,Boolean.TRUE);
} catch (AuthException ex) {
getLogger().log(Level.SEVERE,"Cannot initialize auth service for realm "+name,ex);
}