public List<String> getGroupsForUser() throws Exception {
String token = this.getSSOToken();
if (token == null) {
return Collections.EMPTY_LIST;
} else {
UserDetails details = this.ssoProxy.getUserAttributes(token);
// groups are formatted in this response to include whole
// principals, like lmmp-infra,...principal
// so split on "," and take the first token to get the group name
List<String> groups = new Vector<String>();
for (String rawGroup : details.getRoles()) {
groups.add(rawGroup.split(",")[0]);
}
return groups;
}