Class StaticKeyInfoGenerator

  • All Implemented Interfaces:
    org.opensaml.xmlsec.keyinfo.KeyInfoGenerator

    public class StaticKeyInfoGenerator
    extends Object
    implements org.opensaml.xmlsec.keyinfo.KeyInfoGenerator
    Implementation of KeyInfoGenerator which always returns static KeyInfo data. Note that the argument to generate(Credential) is not used in generating the new KeyInfo, and so may be null. If the original KeyInfo that was passed to this instance is already the child of some other XMLObject at the time generate(Credential) is called, then a newly constructed KeyInfo object will be returned that contains the same data as the original. Otherwise, the original KeyInfo instance is returned directly.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.opensaml.xmlsec.signature.KeyInfo keyInfo
      The KeyInfo object held by this generator instance.
      private org.opensaml.core.xml.io.Marshaller keyInfoMarshaller
      Marshaller used in cloning operation.
      private org.opensaml.core.xml.io.Unmarshaller keyInfoUnmarshaller
      Unmarshaller used in cloning operation.
    • Constructor Summary

      Constructors 
      Constructor Description
      StaticKeyInfoGenerator​(org.opensaml.xmlsec.signature.KeyInfo newKeyInfo)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.opensaml.xmlsec.signature.KeyInfo clone​(org.opensaml.xmlsec.signature.KeyInfo origKeyInfo)
      Clone a KeyInfo and return the new object.
      org.opensaml.xmlsec.signature.KeyInfo generate​(org.opensaml.security.credential.Credential credential)
      org.opensaml.xmlsec.signature.KeyInfo getKeyInfo()
      Get the static KeyInfo object held by this generator.
      private org.opensaml.core.xml.io.Marshaller getMarshaller()
      Get a KeyInfo marshaller.
      private org.opensaml.core.xml.io.Unmarshaller getUnmarshaller()
      Get a KeyInfo unmarshaller.
      void setKeyInfo​(org.opensaml.xmlsec.signature.KeyInfo newKeyInfo)
      Set the static KeyInfo object held by this generator.
    • Field Detail

      • keyInfo

        private org.opensaml.xmlsec.signature.KeyInfo keyInfo
        The KeyInfo object held by this generator instance.
      • keyInfoUnmarshaller

        private org.opensaml.core.xml.io.Unmarshaller keyInfoUnmarshaller
        Unmarshaller used in cloning operation.
      • keyInfoMarshaller

        private org.opensaml.core.xml.io.Marshaller keyInfoMarshaller
        Marshaller used in cloning operation.
    • Constructor Detail

      • StaticKeyInfoGenerator

        public StaticKeyInfoGenerator​(@Nonnull @ParameterName(name="newKeyInfo")
                                      org.opensaml.xmlsec.signature.KeyInfo newKeyInfo)
        Constructor.
        Parameters:
        newKeyInfo - the KeyInfo used as the basis to return new KeyInfo objects from this generator
    • Method Detail

      • generate

        @Nonnull
        public org.opensaml.xmlsec.signature.KeyInfo generate​(@Nullable
                                                              org.opensaml.security.credential.Credential credential)
                                                       throws org.opensaml.security.SecurityException
        Specified by:
        generate in interface org.opensaml.xmlsec.keyinfo.KeyInfoGenerator
        Throws:
        org.opensaml.security.SecurityException
      • getKeyInfo

        @Nonnull
        public org.opensaml.xmlsec.signature.KeyInfo getKeyInfo()
        Get the static KeyInfo object held by this generator.
        Returns:
        the currently held KeyInfo object
      • setKeyInfo

        public void setKeyInfo​(@Nonnull
                               org.opensaml.xmlsec.signature.KeyInfo newKeyInfo)
        Set the static KeyInfo object held by this generator.
        Parameters:
        newKeyInfo - the new KeyInfo object
      • clone

        @Nonnull
        private org.opensaml.xmlsec.signature.KeyInfo clone​(@Nonnull
                                                            org.opensaml.xmlsec.signature.KeyInfo origKeyInfo)
                                                     throws org.opensaml.security.SecurityException
        Clone a KeyInfo and return the new object.
        Parameters:
        origKeyInfo - the KeyInfo object to clone
        Returns:
        a new KeyInfo object cloned from the original
        Throws:
        org.opensaml.security.SecurityException - thrown in there are marshalling or unmarshalling errors during cloning
      • getMarshaller

        @Nonnull
        private org.opensaml.core.xml.io.Marshaller getMarshaller()
                                                           throws org.opensaml.security.SecurityException
        Get a KeyInfo marshaller.
        Returns:
        a KeyInfo marshaller
        Throws:
        org.opensaml.security.SecurityException - thrown if there is an error obtaining the marshaller from the configuration
      • getUnmarshaller

        @Nonnull
        private org.opensaml.core.xml.io.Unmarshaller getUnmarshaller()
                                                               throws org.opensaml.security.SecurityException
        Get a KeyInfo unmarshaller.
        Returns:
        a KeyInfo unmarshaller
        Throws:
        org.opensaml.security.SecurityException - thrown if there is an error obtaining the unmarshaller from the configuration