use of net.osmand.server.WebSecurityConfiguration.OsmAndProUser in project OsmAnd-tools by osmandapp.
the class MapApiController method userInfo.
@GetMapping(path = { "/auth/info" }, produces = "application/json")
@ResponseBody
public String userInfo(java.security.Principal user) {
if (user == null) {
return gson.toJson(user);
}
if (user instanceof Authentication) {
Object obj = ((Authentication) user).getPrincipal();
// hide device accesscceToekn
if (obj instanceof OsmAndProUser) {
OsmAndProUser pu = (OsmAndProUser) ((Authentication) user).getPrincipal();
obj = Collections.singletonMap("username", pu.getUsername());
}
return gson.toJson(obj);
}
return gson.toJson(null);
}
Aggregations