Class BasicKeystoreKeyStrategy

    • Field Detail

      • log

        @Nonnull
        private org.slf4j.Logger log
        Class logger.
      • updateInterval

        @Nonnull
        private Duration updateInterval
        Time between key update checks. Default value: (PT15M).
      • updateTaskTimer

        private Timer updateTaskTimer
        Timer used to schedule update tasks.
      • internalTaskTimer

        private Timer internalTaskTimer
        Timer used to schedule update tasks if no external one set.
      • updateTask

        private TimerTask updateTask
        Task that checks for updated key version.
    • Constructor Detail

      • BasicKeystoreKeyStrategy

        public BasicKeystoreKeyStrategy()
        Constructor.
    • Method Detail

      • setKeystoreType

        public void setKeystoreType​(@Nonnull @NotEmpty
                                    String type)
        Set the keystore type.
        Parameters:
        type - the keystore type
      • setKeystoreResource

        public void setKeystoreResource​(@Nonnull @NotEmpty
                                        Resource resource)
        Set the keystore resource.
        Parameters:
        resource - the keystore resource
      • setKeyVersionResource

        public void setKeyVersionResource​(@Nonnull @NotEmpty
                                          Resource resource)
        Set the key version resource.
        Parameters:
        resource - the key version resource
      • setKeystorePassword

        public void setKeystorePassword​(@Nullable
                                        String password)
        Set the keystore password.
        Parameters:
        password - the keystore password
      • setKeyAlias

        public void setKeyAlias​(@Nonnull @NotEmpty
                                String alias)
        Set the encryption key alias base name.
        Parameters:
        alias - the encryption key alias base
      • setKeyPassword

        public void setKeyPassword​(@Nullable
                                   String password)
        Set the encryption key password.
        Parameters:
        password - the encryption key password
      • setUpdateInterval

        public void setUpdateInterval​(@Nonnull
                                      Duration interval)
        Set the time between key update checks. A value of 0 indicates that no updates will be performed. This setting cannot be changed after the service has been initialized.
        Parameters:
        interval - time between key update checks
      • setUpdateTaskTimer

        public void setUpdateTaskTimer​(@Nullable
                                       Timer timer)
        Set the timer used to schedule update tasks. This setting cannot be changed after the service has been initialized.
        Parameters:
        timer - timer used to schedule update tasks
      • doDestroy

        protected void doDestroy()
        Performs component specific destruction logic. This method is executed within the lock on the object being destroyed. The default implementation of this method is a no-op.
        Overrides:
        doDestroy in class AbstractInitializableComponent
      • updateDefaultKey

        private void updateDefaultKey()
                               throws KeyException
        Update the loaded copy of the default key based on the current key version if it's out of date (loading key version from scratch if need be).
        Throws:
        KeyException - if the key cannot be updated