Class DefaultWhitelistManager
java.lang.Object
com.atlassian.jira.gadgets.whitelist.DefaultWhitelistManager
- All Implemented Interfaces:
InternalWhitelistManager
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
@Component
public class DefaultWhitelistManager
extends Object
implements InternalWhitelistManager, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Default implementation that delegates to the common whitelist
- Since:
- v6.1
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultWhitelistManager
(com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.plugins.whitelist.WhitelistService whitelistService, com.atlassian.plugins.whitelist.OutboundWhitelist whitelist) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
destroy()
getRules()
Returns a list of rules that are currently allowed in the whitelist.boolean
Checks if requests to the provided URI are allowed according to the current whitelist configurationboolean
void
onAddGadget
(com.atlassian.gadgets.event.AddGadgetEvent addGadgetEvent) void
onAddGadgetFeed
(com.atlassian.gadgets.event.AddGadgetFeedEvent addGadgetFeedEvent) updateRules
(List<String> newRules, boolean disabled) Used to update the whitelist configuration.
-
Constructor Details
-
DefaultWhitelistManager
@Autowired public DefaultWhitelistManager(com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.plugins.whitelist.WhitelistService whitelistService, com.atlassian.plugins.whitelist.OutboundWhitelist whitelist)
-
-
Method Details
-
getRules
Description copied from interface:InternalWhitelistManager
Returns a list of rules that are currently allowed in the whitelist. The list will contain entries like:- http://www.atlassian.com/
- http://www.google.com/*
- =http://jira.atlassian.com/
- \/.*www.*\/
- Specified by:
getRules
in interfaceInternalWhitelistManager
- Returns:
- a list of allowed rules
-
isDisabled
public boolean isDisabled()- Specified by:
isDisabled
in interfaceInternalWhitelistManager
- Returns:
- true if the whitelist is currently disabled (meaning all requests are allowed)
-
updateRules
Description copied from interface:InternalWhitelistManager
Used to update the whitelist configuration. Takes a list of rules as well as a boolean flag that allows switching the whitelist off completely.The method then returns the peristed rules
- Specified by:
updateRules
in interfaceInternalWhitelistManager
- Parameters:
newRules
- List of rules to persistdisabled
- True if the whitelist should be switched off- Returns:
- A list of persisted rules
-
isAllowed
Description copied from interface:InternalWhitelistManager
Checks if requests to the provided URI are allowed according to the current whitelist configuration- Specified by:
isAllowed
in interfaceInternalWhitelistManager
- Parameters:
uri
- The uri a http request is made to- Returns:
- true if requests are allowed, false otherwise
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
public void destroy()- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
onAddGadget
@EventListener public void onAddGadget(com.atlassian.gadgets.event.AddGadgetEvent addGadgetEvent) -
onAddGadgetFeed
@EventListener public void onAddGadgetFeed(com.atlassian.gadgets.event.AddGadgetFeedEvent addGadgetFeedEvent)
-