Skip to content

Commit

Permalink
[SHIBUI-905][SHIBUI-916]
Browse files Browse the repository at this point in the history
Added custom attributes to json schema generation.
  • Loading branch information
Bill Smith committed Oct 8, 2018
1 parent 4758298 commit 145f18d
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package edu.internet2.tier.shibboleth.admin.ui.controller

import com.fasterxml.jackson.databind.ObjectMapper
import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomAttributesConfiguration
import groovy.json.JsonOutput
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.core.io.ResourceLoader
Expand Down Expand Up @@ -34,10 +36,22 @@ class MetadataSourcesUiDefinitionController {
@Autowired
ObjectMapper jacksonObjectMapper

@Autowired
CustomAttributesConfiguration customAttributesConfiguration

@GetMapping
ResponseEntity<?> getUiDefinitionJsonSchema() {
try {
def parsedJson = jacksonObjectMapper.readValue(this.jsonSchemaUrl, Map)
def widget = parsedJson["properties"]["attributeRelease"]["widget"]
def data = []
customAttributesConfiguration.getAttributes().each {
def attribute = [:]
attribute["key"] = it["name"]
attribute["label"] = it["displayName"]
data << attribute
}
widget["data"] = data
return ResponseEntity.ok(parsedJson)
}
catch (Exception e) {
Expand Down

0 comments on commit 145f18d

Please sign in to comment.