-
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.
Added validation for FileBackedHttpMetadataResolver url
- Loading branch information
Showing
14 changed files
with
252 additions
and
69 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
...ibboleth/admin/ui/domain/resolvers/validator/FileBackedHttpMetadataResolverValidator.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,32 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.validator; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.FileBackedHttpMetadataResolver; | ||
| import edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.MetadataResolver; | ||
| import edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.ResourceBackedMetadataResolver; | ||
| import edu.internet2.tier.shibboleth.admin.ui.security.service.IGroupService; | ||
| import edu.internet2.tier.shibboleth.admin.ui.security.service.UserService; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
|
|
||
| public class FileBackedHttpMetadataResolverValidator implements IMetadataResolverValidator { | ||
| @Autowired | ||
| IGroupService groupService; | ||
|
|
||
| @Autowired | ||
| UserService userService; | ||
|
|
||
| public FileBackedHttpMetadataResolverValidator(IGroupService groupService, UserService userService) { | ||
| this.groupService = groupService; | ||
| this.userService = userService; | ||
| } | ||
|
|
||
| @Override public boolean supports(MetadataResolver resolver) { return resolver instanceof FileBackedHttpMetadataResolver; } | ||
|
|
||
| @Override public ValidationResult validate(MetadataResolver resolver) { | ||
| FileBackedHttpMetadataResolver fbhmResolver = (FileBackedHttpMetadataResolver) resolver; | ||
| String url = fbhmResolver.getMetadataURL(); | ||
| if (!groupService.doesUrlMatchGroupPattern(userService.getCurrentUser().getGroupId(), url)) { | ||
| return new ValidationResult("Metadata URL not acceptable for user's group"); | ||
| } | ||
| return new ValidationResult(); | ||
| } | ||
| } |
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
Oops, something went wrong.