-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in SHIBUI-799 (pull request #256)
SHIBUI-799 NameID Format Filter
- Loading branch information
Showing
55 changed files
with
5,008 additions
and
174 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...rnet2/tier/shibboleth/admin/ui/controller/NameIdFormatFilterUiDefinitionController.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.controller | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResourceLocation | ||
import edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaResourceLocationRegistry | ||
import edu.internet2.tier.shibboleth.admin.ui.service.JsonSchemaBuilderService | ||
import groovy.util.logging.Slf4j | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
import javax.annotation.PostConstruct | ||
|
||
import static edu.internet2.tier.shibboleth.admin.ui.jsonschema.JsonSchemaLocationLookup.nameIdFormatFilterSchema | ||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR | ||
|
||
/** | ||
* Controller implementing REST resource responsible for exposing structure definition for nameid format filter user | ||
* interface in terms of JSON schema. | ||
* | ||
* @author Dmitriy Kopylenko | ||
*/ | ||
@RestController | ||
@RequestMapping('/api/ui/NameIdFormatFilter') | ||
@Slf4j | ||
class NameIdFormatFilterUiDefinitionController { | ||
|
||
@Autowired | ||
JsonSchemaResourceLocationRegistry jsonSchemaResourceLocationRegistry | ||
|
||
JsonSchemaResourceLocation jsonSchemaLocation | ||
|
||
@Autowired | ||
ObjectMapper jacksonObjectMapper | ||
|
||
@Autowired | ||
JsonSchemaBuilderService jsonSchemaBuilderService | ||
|
||
@GetMapping | ||
ResponseEntity<?> getUiDefinitionJsonSchema() { | ||
try { | ||
def parsedJson = jacksonObjectMapper.readValue(this.jsonSchemaLocation.url, Map) | ||
jsonSchemaBuilderService.addRelyingPartyOverridesCollectionDefinitionsToJson(parsedJson["definitions"]) | ||
return ResponseEntity.ok(parsedJson) | ||
} | ||
catch (Exception e) { | ||
log.error(e.getMessage(), e) | ||
return ResponseEntity.status(INTERNAL_SERVER_ERROR) | ||
.body([jsonParseError : e.getMessage(), | ||
sourceUiSchemaDefinitionFile: this.jsonSchemaLocation.url]) | ||
} | ||
} | ||
|
||
@PostConstruct | ||
void init() { | ||
this.jsonSchemaLocation = nameIdFormatFilterSchema(this.jsonSchemaResourceLocationRegistry) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...c/main/java/edu/internet2/tier/shibboleth/admin/ui/domain/filters/NameIdFormatFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.domain.filters; | ||
|
||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.ElementCollection; | ||
import javax.persistence.Entity; | ||
import javax.persistence.OneToOne; | ||
import javax.persistence.OrderColumn; | ||
import java.util.List; | ||
|
||
@Entity | ||
@EqualsAndHashCode(callSuper = true) | ||
@Getter | ||
@Setter | ||
@ToString | ||
public class NameIdFormatFilter extends MetadataFilter { | ||
|
||
public NameIdFormatFilter() { | ||
type = "NameIDFormat"; | ||
} | ||
|
||
private Boolean removeExistingFormats = false; | ||
|
||
@ElementCollection | ||
@OrderColumn | ||
private List<String> formats; | ||
|
||
@OneToOne(cascade = CascadeType.ALL) | ||
private NameIdFormatFilterTarget nameIdFormatFilterTarget; | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
.../java/edu/internet2/tier/shibboleth/admin/ui/domain/filters/NameIdFormatFilterTarget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.domain.filters; | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.domain.AbstractAuditable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
import javax.persistence.ElementCollection; | ||
import javax.persistence.Entity; | ||
import javax.persistence.OrderColumn; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString | ||
public class NameIdFormatFilterTarget extends AbstractAuditable { | ||
|
||
public enum NameIdFormatFilterTargetType { | ||
ENTITY, CONDITION_SCRIPT, REGEX | ||
} | ||
|
||
private NameIdFormatFilterTargetType nameIdFormatFilterTargetType; | ||
|
||
public NameIdFormatFilterTargetType getNameIdFormatFilterTargetType() { | ||
return nameIdFormatFilterTargetType; | ||
} | ||
|
||
public void setNameIdFormatFilterTargetType(NameIdFormatFilterTargetType nameIdFormatFilterTargetType) { | ||
this.nameIdFormatFilterTargetType = nameIdFormatFilterTargetType; | ||
} | ||
|
||
@ElementCollection | ||
@OrderColumn | ||
private List<String> value; | ||
|
||
public List<String> getValue() { | ||
return value; | ||
} | ||
|
||
public void setSingleValue(String value) { | ||
List<String> values = new ArrayList<>(); | ||
values.add(value); | ||
this.value = values; | ||
} | ||
|
||
public void setValue(List<String> value) { | ||
this.value = value; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.