Class AbstractSerializationSecurityManager
- java.lang.Object
-
- com.atlassian.bamboo.serialization.AbstractSerializationSecurityManager
-
- All Implemented Interfaces:
SerializationSecurityManager
- Direct Known Subclasses:
RemoteSerializationSecurityManager,SerializationSecurityManagerImpl
public abstract class AbstractSerializationSecurityManager extends Object implements SerializationSecurityManager
Assumptions made: - plugin state modifications are rare and we can afford recalculating the plugin-generated whitelist from scratch
-
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.base.Optional<Set<String>>completeClassNameWhitelistprotected List<String>pluginProvidedClassNameWhitelist
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSerializationSecurityManager(com.atlassian.plugin.PluginAccessor pluginAccessor, com.atlassian.plugin.event.PluginEventManager pluginEventManager, SystemSerializableClassWhitelistProvider systemSerializableClassWhitelistProvider)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddWhitelistedClassNames(com.google.common.collect.ImmutableSet.Builder<String> whitelistBuilder)This method should be overridden by implementations to modify class whitelist.Set<String>getClassNameWhitelist()Get set of class names that are whitelisted for purpose of serialization.booleanisBlacklisted(@NotNull Class<?> type, @NotNull SerializationSecurityMethod method)returns true for classes that should not be serialised or deserialised.voidpluginDisabled(com.atlassian.plugin.event.events.PluginDisabledEvent pluginDisabledEvent)voidpluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent pluginEnabledEvent)voidpluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent pluginModuleDisabledEvent)voidpluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent pluginModuleEnabledEvent)voidpluginUninstalled(com.atlassian.plugin.event.events.PluginUninstalledEvent pluginUninstalledEvent)voidpluginUpgraded(com.atlassian.plugin.event.events.PluginUpgradedEvent pluginUpgradedEvent)protected voidrecalculateMasterClassWhitelist()This method should be called by implementations after any of the class whitelist sources has changed.voidregisterPluginEventListeners()voidunregisterPluginEventListeners()Unregistering event listener on PreDestroy can save from processing multiple events when all plugins will be unregistered
-
-
-
Constructor Detail
-
AbstractSerializationSecurityManager
protected AbstractSerializationSecurityManager(com.atlassian.plugin.PluginAccessor pluginAccessor, com.atlassian.plugin.event.PluginEventManager pluginEventManager, SystemSerializableClassWhitelistProvider systemSerializableClassWhitelistProvider)
-
-
Method Detail
-
getClassNameWhitelist
public Set<String> getClassNameWhitelist()
Description copied from interface:SerializationSecurityManagerGet set of class names that are whitelisted for purpose of serialization. Returned set might be immutable.- Specified by:
getClassNameWhitelistin interfaceSerializationSecurityManager
-
isBlacklisted
public boolean isBlacklisted(@NotNull @NotNull Class<?> type, @NotNull @NotNull SerializationSecurityMethod method)Description copied from interface:SerializationSecurityManagerreturns true for classes that should not be serialised or deserialised.- Specified by:
isBlacklistedin interfaceSerializationSecurityManager- Returns:
-
registerPluginEventListeners
@PostConstruct public void registerPluginEventListeners() throws Exception- Throws:
Exception
-
unregisterPluginEventListeners
@PreDestroy public void unregisterPluginEventListeners() throws ExceptionUnregistering event listener on PreDestroy can save from processing multiple events when all plugins will be unregistered- Throws:
Exception
-
pluginUninstalled
public void pluginUninstalled(com.atlassian.plugin.event.events.PluginUninstalledEvent pluginUninstalledEvent)
-
pluginUpgraded
public void pluginUpgraded(com.atlassian.plugin.event.events.PluginUpgradedEvent pluginUpgradedEvent)
-
pluginEnabled
public void pluginEnabled(com.atlassian.plugin.event.events.PluginEnabledEvent pluginEnabledEvent)
-
pluginDisabled
public void pluginDisabled(com.atlassian.plugin.event.events.PluginDisabledEvent pluginDisabledEvent)
-
pluginModuleEnabled
public void pluginModuleEnabled(com.atlassian.plugin.event.events.PluginModuleEnabledEvent pluginModuleEnabledEvent)
-
pluginModuleDisabled
public void pluginModuleDisabled(com.atlassian.plugin.event.events.PluginModuleDisabledEvent pluginModuleDisabledEvent)
-
recalculateMasterClassWhitelist
protected final void recalculateMasterClassWhitelist()
This method should be called by implementations after any of the class whitelist sources has changed.
-
addWhitelistedClassNames
protected abstract void addWhitelistedClassNames(@NotNull com.google.common.collect.ImmutableSet.Builder<String> whitelistBuilder)This method should be overridden by implementations to modify class whitelist.
-
-