Package org.graylog2.system.urlwhitelist
Class UrlWhitelistService
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
org.graylog2.system.urlwhitelist.UrlWhitelistService
- All Implemented Interfaces:
com.google.common.util.concurrent.Service
@Singleton
public class UrlWhitelistService
extends com.google.common.util.concurrent.AbstractIdleService
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Constructor Summary
ConstructorDescriptionUrlWhitelistService
(com.google.common.eventbus.EventBus eventBus, ClusterConfigService clusterConfigService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntry
(WhitelistEntry entry) Gets the whitelist by reading from the cluster configuration.void
boolean
isWhitelisted
(String url) void
removeEntry
(String id) void
saveWhitelist
(UrlWhitelist whitelist) protected void
shutDown()
protected void
startUp()
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toString
-
Constructor Details
-
UrlWhitelistService
@Inject public UrlWhitelistService(com.google.common.eventbus.EventBus eventBus, ClusterConfigService clusterConfigService)
-
-
Method Details
-
getWhitelist
Gets the whitelist by reading from the cluster configuration.There should always be a whitelist which is created by an initial migration but if there is none, we return a disabled one, which will consider all URLs as whitelisted.
This is because we can't easily guarantee that migrations are run before other services are started. On a system that didn't have a whitelist before, we have to add the URLs configured e.g. in lookup table data adapters to the whitelist by running a migration. If the services start before the migration has run, the configured URLs have to pass the whitelist though, otherwise the services won't be able to run properly. Once the migration has run, these URLs will have been added to whitelist and we are fine.
-
saveWhitelist
-
isWhitelisted
-
getEntry
-
addEntry
-
removeEntry
-
handleWhitelistUpdated
-
startUp
protected void startUp()- Specified by:
startUp
in classcom.google.common.util.concurrent.AbstractIdleService
-
shutDown
protected void shutDown()- Specified by:
shutDown
in classcom.google.common.util.concurrent.AbstractIdleService
-