public class

DefaultWhitelistManager

extends Object
implements InternalWhitelistManager DisposableBean InitializingBean
java.lang.Object
   ↳ com.atlassian.jira.gadgets.whitelist.DefaultWhitelistManager

Class Overview

Default implementation that delegates to the common whitelist

Summary

Public Constructors
DefaultWhitelistManager(EventPublisher eventPublisher, WhitelistService whitelistService, OutboundWhitelist whitelist)
Public Methods
void afterPropertiesSet()
void destroy()
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()
@EventListener void onAddGadget(AddGadgetEvent addGadgetEvent)
@EventListener void onAddGadgetFeed(AddGadgetFeedEvent addGadgetFeedEvent)
List<String> updateRules(List<String> newRules, boolean disabled)
Used to update the whitelist configuration.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.whitelist.InternalWhitelistManager
From interface org.springframework.beans.factory.DisposableBean
From interface org.springframework.beans.factory.InitializingBean

Public Constructors

public DefaultWhitelistManager (EventPublisher eventPublisher, WhitelistService whitelistService, OutboundWhitelist whitelist)

Public Methods

public void afterPropertiesSet ()

public void destroy ()

public List<String> getRules ()

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.*\/

Returns
  • a list of allowed rules

public boolean isAllowed (URI uri)

Checks if requests to the provided URI are allowed according to the current whitelist configuration

Parameters
uri The uri a http request is made to
Returns
  • true if requests are allowed, false otherwise

public boolean isDisabled ()

@EventListener public void onAddGadget (AddGadgetEvent addGadgetEvent)

@EventListener public void onAddGadgetFeed (AddGadgetFeedEvent addGadgetFeedEvent)

public List<String> updateRules (List<String> newRules, boolean disabled)

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

Parameters
newRules List of rules to persist
disabled True if the whitelist should be switched off
Returns
  • A list of persisted rules