// authReq.setRealm(getReference().getHostIdentifier().toString());
log.info("OpenID - REALM = " + getReference().getBaseRef());
authReq.setRealm(getReference().getBaseRef().toString());
// Attribute Exchange - getting optional and required
FetchRequest fetch = null;
String[] optional = params.getValuesArray("ax_optional", true);
for (String o : optional) {
if (!ax.containsKey(o)) {
log.warning("Not supported AX extension : " + o);
continue;
}
if (fetch == null)
fetch = FetchRequest.createFetchRequest();
fetch.addAttribute(o, ax.get(o), false);
}
String[] required = params.getValuesArray("ax_required", true);
for (String r : required) {
if (!ax.containsKey(r)) {
log.warning("Not supported AX extension : " + r);
continue;
}
if (fetch == null)
fetch = FetchRequest.createFetchRequest();
fetch.addAttribute(r, ax.get(r), true);
}
if (fetch != null) {
authReq.addExtension(fetch);
}