Class AllowSafeHtmlAttributeConverter

java.lang.Object
sk.iway.iwcm.system.jpa.AllowSafeHtmlAttributeConverter
All Implemented Interfaces:
javax.persistence.AttributeConverter<String,String>

public class AllowSafeHtmlAttributeConverter extends Object implements javax.persistence.AttributeConverter<String,String>
Attribute konverter pre JPA beany ktory umozni pouzit BEZPECNY HTML kod podla odporucani OWASP: https://owasp.org/www-project-java-html-sanitizer/ ponechane je len zakladne HTML formatovanie pouzitie: k fieldu ktory ma mat povoleny HTML kod zadajte anotaciu
  • Constructor Details

    • AllowSafeHtmlAttributeConverter

      public AllowSafeHtmlAttributeConverter()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(String data)
      Specified by:
      convertToDatabaseColumn in interface javax.persistence.AttributeConverter<String,String>
    • convertToEntityAttribute

      public String convertToEntityAttribute(String databaseValue)
      Specified by:
      convertToEntityAttribute in interface javax.persistence.AttributeConverter<String,String>
    • sanitize

      public static String sanitize(String unsafeHtml)
      Sanitize HTML code using Owasp HTML sanitizer, allowed is: - common inline formatting elements - common block elements - styling - a element - img element - href attribute on a element
      Parameters:
      unsafeHtml -
      Returns: