All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.furms.ui.components.HtmlSanitizerPolicyFactory Maven / Gradle / Ivy

There is a newer version: 4.3.1
Show newest version
/*
 * Copyright (c) 2020 Bixbit s.c. All rights reserved.
 * See LICENSE file for licensing information.
 */

package io.imunity.furms.ui.components;

import org.owasp.html.HtmlPolicyBuilder;
import org.owasp.html.PolicyFactory;
import org.owasp.html.Sanitizers;

public class HtmlSanitizerPolicyFactory {
	public static PolicyFactory create(){
		return Sanitizers.STYLES
			.and(Sanitizers.TABLES)
			.and(new HtmlPolicyBuilder()
				.allowStandardUrlProtocols()
				.allowCommonBlockElements()
				.allowCommonInlineFormattingElements()
				.allowElements("a", "img", "audio", "video", "audio-wrapper", "video-wrapper", "center")
				.allowAttributes("href", "src", "controls", "target")
				.onElements("a", "img", "audio", "video")
				.allowAttributes("align")
				.onElements("p", "div", "h1", "h2", "h3", "h4", "h5", "h6")
				.toFactory()
			);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy