Java Code Examples for org.gluu.util.StringHelper#removePunctuation()

The following examples show how to use org.gluu.util.StringHelper#removePunctuation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfileConfigurationService.java    From oxTrust with MIT License 5 votes vote down vote up
private void saveCertificate(GluuSAMLTrustRelationship trustRelationship,
		Map<String, FileUploadWrapper> fileWrappers, String name) {
	if (fileWrappers.get(name) != null && fileWrappers.get(name).getStream() != null) {
		String profileConfigurationCertFileName = StringHelper
				.removePunctuation(name + trustRelationship.getInum());
		shibboleth3ConfService.saveProfileConfigurationCert(profileConfigurationCertFileName, fileWrappers.get(name).getStream());
		trustRelationship.getProfileConfigurations().get(name).setProfileConfigurationCertFileName(
				StringHelper.removePunctuation(profileConfigurationCertFileName));
	}

}
 
Example 2
Source File: Shibboleth3ConfService.java    From oxTrust with MIT License 4 votes vote down vote up
public String getSpNewMetadataFileName(String inum) {
	String relationshipInum = StringHelper.removePunctuation(inum);
	return String.format(SHIB3_SP_METADATA_FILE_PATTERN, relationshipInum);
}
 
Example 3
Source File: Shibboleth3ConfService.java    From oxTrust with MIT License 4 votes vote down vote up
public String getNewMetadataFileName(GluuSAMLFederationProposal federationProposal,
		List<GluuSAMLFederationProposal> allFederationProposals) {

	String relationshipInum = StringHelper.removePunctuation(federationProposal.getInum());
	return String.format(SHIB3_METADATA_FILE_PATTERN, relationshipInum);
}
 
Example 4
Source File: FilterService.java    From oxTrust with MIT License 4 votes vote down vote up
public void saveFilters(GluuSAMLTrustRelationship trustRelationship, FileUploadWrapper filterCertWrapper) {
	VelocityContext context = new VelocityContext();
	if (trustRelationship.getMetadataFilters().get("validation") != null) {
		List<String> extensionSchemas = trustRelationship.getMetadataFilters().get("validation").getExtensionSchemas();
		if (extensionSchemas != null && !extensionSchemas.isEmpty()) {
			context.put("extensionSchemas", extensionSchemas);
		} else {
			log.warn("validation filter on " + trustRelationship.getDisplayName() + "is invalid. Removing it.");
			trustRelationship.getMetadataFilters().remove("validation");
		}
	}

	if (trustRelationship.getMetadataFilters().get("entityRoleWhiteList") != null) {
		List<String> retainedRoles = trustRelationship.getMetadataFilters().get("entityRoleWhiteList").getRetainedRoles();
		if (retainedRoles != null && !retainedRoles.isEmpty()) {
			context.put("retainedRoles", retainedRoles);
			boolean removeEmptyEntitiesDescriptors = trustRelationship.getMetadataFilters().get("entityRoleWhiteList")
					.getRemoveEmptyEntitiesDescriptors();
			context.put("removeEmptyEntitiesDescriptors", removeEmptyEntitiesDescriptors);
			boolean removeRolelessEntityDescriptors = trustRelationship.getMetadataFilters().get("entityRoleWhiteList")
					.getRemoveRolelessEntityDescriptors();
			context.put("removeRolelessEntityDescriptors", removeRolelessEntityDescriptors);
		} else {
			log.warn("entityRoleWhiteList filter on " + trustRelationship.getDisplayName() + "is invalid. Removing it.");
			trustRelationship.getMetadataFilters().remove("entityRoleWhiteList");
		}

	}

	if (trustRelationship.getMetadataFilters().get("requiredValidUntil") != null) {
		int maxValidityInterval = trustRelationship.getMetadataFilters().get("requiredValidUntil").getMaxValidityInterval();
		context.put("maxValidityInterval", maxValidityInterval);
	}

	if (trustRelationship.getMetadataFilters().get("signatureValidation") != null) {
		String filterCertFileName = StringHelper.removePunctuation(trustRelationship.getInum());
		if (filterCertWrapper.getStream() != null) {
			shibboleth3ConfService.saveFilterCert(filterCertFileName, filterCertWrapper.getStream());
			trustRelationship.getMetadataFilters().get("signatureValidation")
					.setFilterCertFileName(StringHelper.removePunctuation(trustRelationship.getInum()));
		}

		if (StringHelper.isNotEmpty(trustRelationship.getMetadataFilters().get("signatureValidation").getFilterCertFileName())) {
			boolean requireSignedMetadata = trustRelationship.getMetadataFilters().get("signatureValidation").getRequireSignedMetadata();
			context.put("trustEngine", "shibboleth.FedTrustEngine");
			context.put("requireSignedMetadata", requireSignedMetadata);
		} else {
			log.warn("signatureValidation filter on " + trustRelationship.getDisplayName() + " is invalid. Removing it.");
			trustRelationship.getMetadataFilters().remove("signatureValidation");
		}
	}

	trustRelationship.setGluuSAMLMetaDataFilter(new ArrayList<String>());

	for (String filterName : trustRelationship.getMetadataFilters().keySet()) {
		trustRelationship.getGluuSAMLMetaDataFilter().add(templateService.generateConfFile(filterName + "Filter.xml", context));
	}
}