Skip to content
Snippets Groups Projects
Commit c6eb2c05 authored by Nicholas Blair's avatar Nicholas Blair
Browse files

fix: correctly nest UwframeSession as "person"

Now matches uw-frame format exactly.
parent 8962d677
No related branches found
No related tags found
1 merge request!10feature: Add uw-frame compatible REST API for /profile
......@@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
import edu.wisc.uwss.UWUserDetails;
import edu.wisc.uwss.web.uwframe.UwframeSession;
......@@ -60,11 +63,13 @@ public class ProfileController {
*/
@RequestMapping(value="/profile/uw-frame", method=RequestMethod.GET)
public @ResponseBody Object uwFrameCompatibleProfile(@AuthenticationPrincipal Object principal) {
Map<String, UwframeSession> response = new HashMap<>();
if(principal instanceof UWUserDetails) {
return new UwframeSession(environment, (UWUserDetails) principal);
response.put("person", new UwframeSession(environment, (UWUserDetails) principal));
} else {
return new UwframeSession(environment);
response.put("person", new UwframeSession(environment));
}
return response;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment