Skip to content

Commit

Permalink
[SHIBUI-1031]
Browse files Browse the repository at this point in the history
Added an endpoint to get supported roles.
  • Loading branch information
Bill Smith committed Jan 7, 2019
1 parent 9560ad0 commit 541ba5d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package edu.internet2.tier.shibboleth.admin.ui.controller;

import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration;
import edu.internet2.tier.shibboleth.admin.ui.security.model.Role;
import edu.internet2.tier.shibboleth.admin.ui.security.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.stream.Collectors;

/**
* @author Bill Smith (wsmith@unicon.net)
*/
Expand All @@ -17,8 +21,16 @@ public class ConfigurationController {
@Autowired
CustomPropertiesConfiguration customPropertiesConfiguration;

@Autowired
RoleRepository roleRepository;

@GetMapping(value = "/customAttributes")
public ResponseEntity<?> getCustomAttributes() {
return ResponseEntity.ok(customPropertiesConfiguration.getAttributes());
}

@GetMapping(value = "/supportedRoles")
public ResponseEntity<?> getSupportedRoles() {
return ResponseEntity.ok(roleRepository.findAll().stream().map(Role::getName).collect(Collectors.toList()));
}
}

0 comments on commit 541ba5d

Please sign in to comment.