if (response instanceof DirectError) {
return directResponse(httpResp, response.keyValueFormEncoding());
} else {
if (authReq.hasExtension(AxMessage.OPENID_NS_AX)) {
MessageExtension ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
if (ext instanceof FetchRequest) {
FetchRequest fetchReq = (FetchRequest) ext;
Map<?, ?> required = fetchReq.getAttributes(true);
//Map optional = fetchReq.getAttributes(false);
if (required.containsKey("email")) {
Map<Object, Object> userDataExt = new HashMap<>();
//userDataExt.put("email", userData.get(3));
FetchResponse fetchResp = FetchResponse.createFetchResponse(fetchReq, userDataExt);
// (alternatively) manually add attribute values
fetchResp.addAttribute("email", "http://schema.openid.net/contact/email", email);
response.addExtension(fetchResp);
}
} else {
throw new UnsupportedOperationException("TODO");
}
}
if (authReq.hasExtension(SRegMessage.OPENID_NS_SREG)) {
MessageExtension ext = authReq.getExtension(SRegMessage.OPENID_NS_SREG);
if (ext instanceof SRegRequest) {
SRegRequest sregReq = (SRegRequest) ext;
List<?> required = sregReq.getAttributes(true);
//List optional = sregReq.getAttributes(false);
if (required.contains("email")) {