Class DefaultSecurityPropertiesService

java.lang.Object
com.atlassian.jira.security.properties.DefaultSecurityPropertiesService
All Implemented Interfaces:
SecurityPropertiesService

public class DefaultSecurityPropertiesService extends Object implements SecurityPropertiesService
DefaultSecurityPropertiesService provides cached access to persistent properties backed by SecurityPropertiesDao, Notes: - a simple cache implementation here supersedes more complex CacheManager - this is to allow SecurityPropertiesService to be used in course of CacheManager's implementation initialisation (e.g. cluster auth ehcache RMI socket shared secret must be available before ehcache can be used), - the cache here gets invalidated on ImportCompletedEvent, ClearCacheEvent - for a general db-to-cache consistency - as well as on JiraUpgradeApprovedEvent and JiraUpgradedEvent - for the ZDU surveillance in case of security properties being subject to upgrade tasks or upgrade state dependent. - in order to renew a particular security property admin can issue the following SQL statement: delete from securityproperty where property_key = '';
  • Constructor Details

  • Method Details

    • defaultGenerateKey

      public static String defaultGenerateKey()
    • invalidate

      public void invalidate()
      Description copied from interface: SecurityPropertiesService
      invalidates all cache entries
      Specified by:
      invalidate in interface SecurityPropertiesService
    • invalidate

      public void invalidate(String key)
      Description copied from interface: SecurityPropertiesService
      invalidates cache entry for key
      Specified by:
      invalidate in interface SecurityPropertiesService
    • getSecret

      public Optional<String> getSecret(String key)
      Description copied from interface: SecurityPropertiesService
      gets a security property of key,
      Specified by:
      getSecret in interface SecurityPropertiesService
      Returns:
      if the property is present - return it (wrapped in Optional) if the property is missing and it's safe to create (e.g. not in ZDU) it will create, persist and return a newly generated random base64-encoded value, if it's not possible to create the value at the time (e.g. in ZDU) - returns Optional.empty() - in such case the security feature relying on the property should get temporarily disabled, but the client should keep trying to get non-empty value periodically, as eventually (e.g. after ZDU completed) it should return non-empty one.
    • getSecret

      public Optional<String> getSecret(String key, boolean createIfMissing)
    • getSecret

      public Optional<String> getSecret(String key, Supplier<Boolean> createIfMissing)
    • getSecretUsingValueCreator

      public Optional<String> getSecretUsingValueCreator(String key, Supplier<String> valueCreator)
    • onImportCompleted

      @EventListener public void onImportCompleted(ImportCompletedEvent importCompletedEvent)
    • onClearCacheEvent

      @EventListener public void onClearCacheEvent(ClearCacheEvent clearCacheEvent)
    • onJiraUpgradedEvent

      @EventListener public void onJiraUpgradedEvent(JiraUpgradedEvent jiraUpgradedEvent)
    • onJiraUpgradeApprovedEvent

      @EventListener public void onJiraUpgradeApprovedEvent(JiraUpgradeApprovedEvent jiraUpgradeApprovedEvent)