Package org.xwiki.rendering.macro
Class AbstractSignableMacro<P>
- java.lang.Object
-
- org.xwiki.rendering.macro.AbstractMacro<P>
-
- org.xwiki.rendering.macro.AbstractSignableMacro<P>
-
- Type Parameters:
P
- the type of the macro parameters bean
- All Implemented Interfaces:
Comparable<org.xwiki.rendering.macro.Macro<?>>
,org.xwiki.component.phase.Initializable
,org.xwiki.rendering.macro.Macro<P>
,SignableMacro
- Direct Known Subclasses:
AbstractNoParameterSignableMacro
public abstract class AbstractSignableMacro<P> extends org.xwiki.rendering.macro.AbstractMacro<P> implements SignableMacro
Helper to implement signable Macro, supplementing the default implementation provided byAbstractMacro
to ease the support of signatures.- Since:
- 6.1M2
- Version:
- $Id: 11774a40e438014158da212b347f7ea167023733 $
-
-
Constructor Summary
Constructors Constructor Description AbstractSignableMacro(String name)
Creates a newMacro
instance.AbstractSignableMacro(String name, String description)
Creates a newMacro
instance.AbstractSignableMacro(String name, String description, Class<?> parametersBeanClass)
Creates a newMacro
instance.AbstractSignableMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
Creates a newMacro
instance.AbstractSignableMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor, Class<?> parametersBeanClass)
Creates a newMacro
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.xwiki.component.manager.ComponentManager
getComponentManager()
void
sign(org.xwiki.rendering.block.Block block, org.xwiki.crypto.signer.param.CMSSignedDataGeneratorParameters parameters)
Sign the given macro block.org.xwiki.crypto.signer.param.CMSSignedDataVerified
verify(org.xwiki.rendering.block.Block block, org.xwiki.crypto.pkix.CertificateProvider certificateProvider)
Verify signature of the given macro block.-
Methods inherited from class org.xwiki.rendering.macro.AbstractMacro
compareTo, getDescriptor, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getNonGeneratedContentMetaData, getPriority, initialize, setDefaultCategories, setDescriptor, setPriority
-
-
-
-
Constructor Detail
-
AbstractSignableMacro
public AbstractSignableMacro(String name)
Creates a newMacro
instance. 5005- Parameters:
name
- the name of the macro (eg "Table Of Contents" for the TOC macro)
-
AbstractSignableMacro
public AbstractSignableMacro(String name, String description)
Creates a newMacro
instance.- Parameters:
name
- the name of the macro (eg "Table Of Contents" for the TOC macro)description
- a string describing this macro.
-
AbstractSignableMacro
public AbstractSignableMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor)
Creates a newMacro
instance.- Parameters:
name
- the name of the macro (eg "Table Of Contents" for the TOC macro)description
- a string describing this macro.contentDescriptor
-ContentDescriptor
for this macro.
-
AbstractSignableMacro
public AbstractSignableMacro(String name, String description, Class<?> parametersBeanClass)
Creates a newMacro
instance.- Parameters:
name
- the name of the macro (eg "Table Of Contents" for the TOC macro)description
- a string describing this macro.parametersBeanClass
- class of the parameters bean of this macro.
-
AbstractSignableMacro
public AbstractSignableMacro(String name, String description, org.xwiki.rendering.macro.descriptor.ContentDescriptor contentDescriptor, Class<?> parametersBeanClass)
Creates a newMacro
instance.- Parameters:
name
- the name of the macro (eg "Table Of Contents" for the TOC macro)description
- string describing this macro.contentDescriptor
- theContentDescriptor
describing the content of this macro.parametersBeanClass
- class of the parameters bean.
-
-
Method Detail
-
getComponentManager
protected org.xwiki.component.manager.ComponentManager getComponentManager()
- Returns:
- the component manager
- Since:
- 2.0M1 (moved from AbstractScriptMacro)
-
sign
public void sign(org.xwiki.rendering.block.Block block, org.xwiki.crypto.signer.param.CMSSignedDataGeneratorParameters parameters) throws MacroSignatureException
Description copied from interface:SignableMacro
Sign the given macro block.- Specified by:
sign
in interfaceSignableMacro
- Parameters:
block
- the block to sign. This block should have a known content source and could be either aMacroBlock
or aMacroMarkerBlock
.parameters
- the signature generation parameters.- Throws:
MacroSignatureException
- on error.
-
verify
public org.xwiki.crypto.signer.param.CMSSignedDataVerified verify(org.xwiki.rendering.block.Block block, org.xwiki.crypto.pkix.CertificateProvider certificateProvider) throws MacroSignatureException
Description copied from interface:SignableMacro
Verify signature of the given macro block.- Specified by:
verify
in interfaceSignableMacro
- Parameters:
block
- the block to verify. This block should have a known content source and could be either aMacroBlock
or aMacroMarkerBlock
.certificateProvider
- a certificate provider providing available certificates.- Returns:
- signature verification results, or null no signature where found for the given block.
- Throws:
MacroSignatureException
- on error.
-
-