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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voiddoProcess(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue, org.thymeleaf.processor.element.IElementTagStructureHandler structureHandler) protected booleanisVisible(org.thymeleaf.context.ITemplateContext context, org.thymeleaf.model.IProcessableElementTag tag, org.thymeleaf.engine.AttributeName attributeName, String attributeValue) voidsetAttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions attributeDefinitions) Methods inherited from class org.thymeleaf.processor.element.AbstractAttributeTagProcessor
doProcessMethods inherited from class org.thymeleaf.processor.element.AbstractElementTagProcessor
getDialectPrefix, getMatchingAttributeName, getMatchingElementName, processMethods inherited from class org.thymeleaf.processor.AbstractProcessor
getPrecedence, getTemplateModeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.thymeleaf.processor.IProcessor
getPrecedence, getTemplateMode
-
Field Details
-
CLASS_AUTHZ_LOCKED
- See Also:
-
PRECEDENCE
public static final int PRECEDENCE- See Also:
-
ATTR_NAME
- See Also:
-
AUTHZ_DEV_MODE_LOOK
public static final boolean AUTHZ_DEV_MODE_LOOK- See Also:
-
AUTHZ_DEV_MODE_NAME
- See Also:
-
TARGET_ATTR_NAME
- See Also:
-
-
Constructor Details
-
AuthzAttributeTagProcessor
Constructor.- Parameters:
dialectPrefix- Dialect prefix (tc)
-
-
Method Details
-
setAttributeDefinitions
public void setAttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions attributeDefinitions) - Specified by:
setAttributeDefinitionsin interfaceorg.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:
doProcessin classorg.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)
-