*/
@RequestMapping(method = RequestMethod.GET)
@WSDoc("Get Login information")
@ResponseBody()
public String getLoginInfo(HttpServletRequest request, HttpServletResponse response) throws ResponseException {
SimpleObject obj = new SimpleObject();
if (Context.isAuthenticated()) {
User u = Context.getAuthenticatedUser();
Person p = Context.getPersonService().getPersonByUuid(u.getPerson().getUuid());
Provider provider = Context.getProviderService().getProvidersByPerson(p).iterator().next();
obj.add("personUuid", p.getUuid());
if (provider != null) {
obj.add("providerUuid", provider.getUuid());
ArrayList attributesObj = new ArrayList();
Iterator<ProviderAttribute> attributesIterator = provider.getActiveAttributes().iterator();
while (attributesIterator.hasNext()) {
SimpleObject attributeObj = new SimpleObject();
ProviderAttribute pAttribute = attributesIterator.next();
attributeObj.add("attributeType", pAttribute.getAttributeType().getName());
attributeObj.add("value", pAttribute.getValue());
attributesObj.add(attributeObj);
}
obj.add("providerAttributes", attributesObj);
}
obj.add("display", p.getPersonName().getFullName());