Class DefaultSecurityPropertiesService
java.lang.Object
com.atlassian.jira.security.properties.DefaultSecurityPropertiesService
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionDefaultSecurityPropertiesService
(SecurityPropertiesDao securityPropertiesDao, ClusterUpgradeStateDao clusterUpgradeStateDao) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
gets a security property of key,getSecretUsingValueCreator
(String key, Supplier<String> valueCreator) void
invalidates all cache entriesvoid
invalidate
(String key) invalidates cache entry for keyvoid
onClearCacheEvent
(ClearCacheEvent clearCacheEvent) void
onImportCompleted
(ImportCompletedEvent importCompletedEvent) void
onJiraUpgradeApprovedEvent
(JiraUpgradeApprovedEvent jiraUpgradeApprovedEvent) void
onJiraUpgradedEvent
(JiraUpgradedEvent jiraUpgradedEvent)
-
Constructor Details
-
DefaultSecurityPropertiesService
public DefaultSecurityPropertiesService(SecurityPropertiesDao securityPropertiesDao, ClusterUpgradeStateDao clusterUpgradeStateDao)
-
-
Method Details
-
defaultGenerateKey
-
invalidate
public void invalidate()Description copied from interface:SecurityPropertiesService
invalidates all cache entries- Specified by:
invalidate
in interfaceSecurityPropertiesService
-
invalidate
Description copied from interface:SecurityPropertiesService
invalidates cache entry for key- Specified by:
invalidate
in interfaceSecurityPropertiesService
-
getSecret
Description copied from interface:SecurityPropertiesService
gets a security property of key,- Specified by:
getSecret
in interfaceSecurityPropertiesService
- 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
-
getSecret
-
getSecretUsingValueCreator
-
onImportCompleted
-
onClearCacheEvent
-
onJiraUpgradedEvent
-
onJiraUpgradeApprovedEvent
@EventListener public void onJiraUpgradeApprovedEvent(JiraUpgradeApprovedEvent jiraUpgradeApprovedEvent)
-