com.atlassian.jira.bc.whitelist
Class DefaultWhitelistManager

java.lang.Object
  extended by com.atlassian.jira.bc.whitelist.DefaultWhitelistManager
All Implemented Interfaces:
WhitelistManager

public class DefaultWhitelistManager
extends Object
implements WhitelistManager

Default implementation that persists the whitelist in applicationproperties

Since:
v4.3

Field Summary
static String NO_WILDCARDS_PREFIX
           
static String REGEX_PREFIX
           
 
Constructor Summary
DefaultWhitelistManager(ApplicationProperties applicationProperties, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
protected  String createRegex(String rule)
           
 List<String> getRules()
          Returns a list of rules that are currently allowed in the whitelist.
 boolean isAllowed(URI uri)
          Checks if requests to the provided URI are allowed according to the current whitelist configuration
 boolean isDisabled()
          Returns true if the whitelist is currently disabled (meaning all requests are allowed).
 void onAddGadget(com.atlassian.gadgets.event.AddGadgetEvent addGadgetEvent)
           
 void onAddGadgetFeed(com.atlassian.gadgets.event.AddGadgetFeedEvent addGadgetFeedEvent)
           
 void onClearCache(ClearCacheEvent event)
           
 List<String> updateRules(List<String> newRules, boolean disabled)
          Used to update the whitelist configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_WILDCARDS_PREFIX

public static final String NO_WILDCARDS_PREFIX
See Also:
Constant Field Values

REGEX_PREFIX

public static final String REGEX_PREFIX
See Also:
Constant Field Values
Constructor Detail

DefaultWhitelistManager

public DefaultWhitelistManager(ApplicationProperties applicationProperties,
                               com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

getRules

public List<String> getRules()
Description copied from interface: WhitelistManager
Returns a list of rules that are currently allowed in the whitelist. The list will contain entries like:

Specified by:
getRules in interface WhitelistManager
Returns:
a list of allowed rules

isDisabled

public boolean isDisabled()
Description copied from interface: WhitelistManager
Returns true if the whitelist is currently disabled (meaning all requests are allowed).

Specified by:
isDisabled in interface WhitelistManager
Returns:
true if the whitelist is currently disabled (meaning all requests are allowed)

updateRules

public List<String> updateRules(List<String> newRules,
                                boolean disabled)
Description copied from interface: WhitelistManager
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 interface WhitelistManager
Parameters:
newRules - List of rules to persist
disabled - True if the whitelist should be switched off
Returns:
A list of persisted rules

isAllowed

public boolean isAllowed(URI uri)
Description copied from interface: WhitelistManager
Checks if requests to the provided URI are allowed according to the current whitelist configuration

Specified by:
isAllowed in interface WhitelistManager
Parameters:
uri - The uri a http request is made to
Returns:
true if requests are allowed, false otherwise

createRegex

protected String createRegex(String rule)

onAddGadget

@EventListener
public void onAddGadget(com.atlassian.gadgets.event.AddGadgetEvent addGadgetEvent)

onAddGadgetFeed

@EventListener
public void onAddGadgetFeed(com.atlassian.gadgets.event.AddGadgetFeedEvent addGadgetFeedEvent)

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)


Copyright © 2002-2013 Atlassian. All Rights Reserved.