Class 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 by AbstractMacro to ease the support of signatures.
    Since:
    6.1M2
    Version:
    $Id: 11774a40e438014158da212b347f7ea167023733 $
    • Field Summary

      • Fields inherited from class org.xwiki.rendering.macro.AbstractMacro

        beanManager, DEFAULT_CATEGORY_CONTENT, DEFAULT_CATEGORY_DEPRECATED, DEFAULT_CATEGORY_DEVELOPMENT, DEFAULT_CATEGORY_FORMATTING, DEFAULT_CATEGORY_INTERNAL, DEFAULT_CATEGORY_LAYOUT, DEFAULT_CATEGORY_NAVIGATION
    • 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
      • Methods inherited from interface org.xwiki.rendering.macro.Macro

        execute, supportsInlineMode
    • Constructor Detail

      • AbstractSignableMacro

        public AbstractSignableMacro​(String name)
        Creates a new Macro 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 new Macro 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 new Macro 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 new Macro 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 new Macro instance.
        Parameters:
        name - the name of the macro (eg "Table Of Contents" for the TOC macro)
        description - string describing this macro.
        contentDescriptor - the ContentDescriptor 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 interface SignableMacro
        Parameters:
        block - the block to sign. This block should have a known content source and could be either a MacroBlock or a MacroMarkerBlock.
        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 interface SignableMacro
        Parameters:
        block - the block to verify. This block should have a known content source and could be either a MacroBlock or a MacroMarkerBlock.
        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.