Class AuthzAttributeTagProcessor

java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementTagProcessor
org.thymeleaf.processor.element.AbstractAttributeTagProcessor
io.vertigo.ui.impl.thymeleaf.components.AuthzAttributeTagProcessor
All Implemented Interfaces:
org.thymeleaf.engine.IAttributeDefinitionsAware, org.thymeleaf.processor.element.IElementProcessor, org.thymeleaf.processor.element.IElementTagProcessor, org.thymeleaf.processor.IProcessor

public class AuthzAttributeTagProcessor extends org.thymeleaf.processor.element.AbstractAttributeTagProcessor implements org.thymeleaf.engine.IAttributeDefinitionsAware
Attribut tag processor to apply simply hasAuthorization and hasOperation . It use UiAuthorizationUtil instance already registered in thymeleaf engine context. A global dev mode keep element visible but with a "security-locked" class Should sow a beautifull security overlay. 3 ways to use it : 1- With a simple string vu:authz="myGlobalAuthz" or vu:authz="mySecuredEntityAuthz$read" => use like authz.hasAuthorization('myGlobalAuthz') Support multiple list OR separator ',' and '!' for NOT 2- With a contextPath to a UiObject vu:authz="model.myEntity$read" or vu:authz="model.list[0]$read" => use like authz.hasOperation(model.myEntity, 'read') (first part is evaluated like ${model.myEntity}) 3- With a evaluated expression (starts with ${ ) vu:authz="${authz.hasAuthorization('myGlobalAuthz') && authz.hasAuthorization('mySecuredEntityAuthz$read')}" => use exactly like th:if, but no need to merge your th:if business logic with th:authz security logic
Author:
npiedeloup
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final boolean
     
    static final String
     
    static final String
     
    static final int
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    doProcess(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue, org.thymeleaf.processor.element.IElementTagStructureHandler structureHandler)
     
    protected boolean
    isVisible(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue)
     
    void
    setAttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions attributeDefinitions)
     

    Methods inherited from class org.thymeleaf.processor.element.AbstractAttributeTagProcessor

    doProcess

    Methods inherited from class org.thymeleaf.processor.element.AbstractElementTagProcessor

    getDialectPrefix, getMatchingAttributeName, getMatchingElementName, process

    Methods inherited from class org.thymeleaf.processor.AbstractProcessor

    getPrecedence, getTemplateMode

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.thymeleaf.processor.IProcessor

    getPrecedence, getTemplateMode
  • Field Details

  • Constructor Details

    • AuthzAttributeTagProcessor

      public AuthzAttributeTagProcessor(String dialectPrefix)
      Constructor.
      Parameters:
      dialectPrefix - Dialect prefix (tc)
  • Method Details

    • setAttributeDefinitions

      public void setAttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions attributeDefinitions)
      Specified by:
      setAttributeDefinitions in interface org.thymeleaf.engine.IAttributeDefinitionsAware
    • doProcess

      protected final void doProcess(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue, org.thymeleaf.processor.element.IElementTagStructureHandler structureHandler)
      Specified by:
      doProcess in class org.thymeleaf.processor.element.AbstractAttributeTagProcessor
    • isVisible

      protected boolean isVisible(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue)