Class RemoteAgentAuthenticationManagerImpl
- All Implemented Interfaces:
RemoteAgentAuthenticationManager
RemoteAgentAuthenticationManager.- Since:
- 3.4
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteAgentAuthenticationManagerImpl(AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister, AgentManager agentManager, RemoteAgentAuthenticationDao agentAuthenticationDao, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.cache.CacheManager cacheManager, int agentHeartbeatIntervalSeconds) -
Method Summary
Modifier and TypeMethodDescriptionvoidapproveAuthentications(@NotNull Iterable<RemoteAgentAuthentication> authentications) Approve all authentications from the list.@NotNull Iterable<RemoteAgentAuthentication>Get all agent authentications known to this Bamboo server.getAuthentication(UUID uuid) Get first remote agent authentication matching the IP and UUID.@Nullable RemoteAgentAuthenticationgetAuthentication(UUID uuid, String ip) Get remote agent authentication matching the IP and UUID.@NotNull Iterable<RemoteAgentAuthentication>getAuthentications(com.google.common.base.Predicate<RemoteAgentAuthentication> filter) Get authentication filtered by given filter.@NotNull org.apache.commons.lang3.tuple.Pair<RemoteAgentAuthentication,Boolean> getOrCreatePendingAuthentication(@NotNull UUID uuid, @NotNull String ip, @Nullable Long agentId, boolean strictAuthEnabled) Create a new pending authentication for given IP address and UUID.booleanisAuthenticatedAgentIp(@NotNull String ip) Returns true if the given IP address matches one of the already authenticated remote agent IP patterns.booleanisAuthenticatedAgentIp(@NotNull InetAddress inetAddress) Returns true if the given IP address matches one of the already authenticated remote agent IP patterns.booleanChecks whether the remote agent authentication is currently enabled.voidvoidrevokeAgentAuthentications(@NotNull Iterable<RemoteAgentAuthentication> authentications) Revoke approval for given agent authentications.voidsetRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled) Sets the remote agent authentication to globally enabled/disabled.voidUpdate IP of an approved authentication with given uuid.
-
Constructor Details
-
RemoteAgentAuthenticationManagerImpl
public RemoteAgentAuthenticationManagerImpl(AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister, AgentManager agentManager, RemoteAgentAuthenticationDao agentAuthenticationDao, com.atlassian.event.api.EventPublisher eventPublisher, com.atlassian.cache.CacheManager cacheManager, int agentHeartbeatIntervalSeconds)
-
-
Method Details
-
onNodePromotedEvent
-
isRemoteAgentAuthenticationEnabled
public boolean isRemoteAgentAuthenticationEnabled()Description copied from interface:RemoteAgentAuthenticationManagerChecks whether the remote agent authentication is currently enabled.- Specified by:
isRemoteAgentAuthenticationEnabledin interfaceRemoteAgentAuthenticationManager- Returns:
true, if remote agent authentication is enabled,falseotherwise
-
setRemoteAgentAuthenticationEnabled
Description copied from interface:RemoteAgentAuthenticationManagerSets the remote agent authentication to globally enabled/disabled.- Specified by:
setRemoteAgentAuthenticationEnabledin interfaceRemoteAgentAuthenticationManager- Parameters:
isAuthenticationEnabled-trueif remote agent authentication should be enabled,falseotherwise.- Throws:
Exception- on any error
-
getAllAuthentications
Description copied from interface:RemoteAgentAuthenticationManagerGet all agent authentications known to this Bamboo server.
The list is sorted first by the authentication status (unapproved first), then by IP address.
- Specified by:
getAllAuthenticationsin interfaceRemoteAgentAuthenticationManager- Returns:
- all agent authentications
-
getAuthentications
@NotNull public @NotNull Iterable<RemoteAgentAuthentication> getAuthentications(com.google.common.base.Predicate<RemoteAgentAuthentication> filter) Description copied from interface:RemoteAgentAuthenticationManagerGet authentication filtered by given filter.- Specified by:
getAuthenticationsin interfaceRemoteAgentAuthenticationManager- Parameters:
filter- predicate to filter authentications- Returns:
- list of authentications matching the filter
-
getAuthentication
Description copied from interface:RemoteAgentAuthenticationManagerGet remote agent authentication matching the IP and UUID. If not found,
nullwill be returned.The returned authentication (if found) will have UUID matching the uuid parameter and IP address either equal to ip parameter or a wildcard mask that matches the ip parameter. Persisted (approved) authentications will be queried in preference to the authentications pending approval.
- Specified by:
getAuthenticationin interfaceRemoteAgentAuthenticationManager- Parameters:
uuid- UUIDip- IP address- Returns:
- remote agent authentication matching the request, or
null
-
getAuthentication
Description copied from interface:RemoteAgentAuthenticationManagerGet first remote agent authentication matching the IP and UUID. If not found,
nullwill be returned.The returned authentication (if found) will have UUID matching the uuid parameter. Persisted (approved) authentications will be queried in preference to the authentications pending approval.
- Specified by:
getAuthenticationin interfaceRemoteAgentAuthenticationManager- Parameters:
uuid- UUID- Returns:
- remote agent authentication with matching UUID, or
null
-
getOrCreatePendingAuthentication
@NotNull public @NotNull org.apache.commons.lang3.tuple.Pair<RemoteAgentAuthentication,Boolean> getOrCreatePendingAuthentication(@NotNull @NotNull UUID uuid, @NotNull @NotNull String ip, @Nullable @Nullable Long agentId, boolean strictAuthEnabled) Description copied from interface:RemoteAgentAuthenticationManagerCreate a new pending authentication for given IP address and UUID. Or return an existing (approved or not approved) authentication.
If an approved authentication matching given IP and UUID already exists, it will be returned.
If a pending authentication with given UUID exists, it will be replaced by the new authentication with given uuid and ip.
- Specified by:
getOrCreatePendingAuthenticationin interfaceRemoteAgentAuthenticationManager- Parameters:
uuid- UUIDip- IP address- Returns:
- new authentication pending approval, or an existing approved authentication. The boolean flag that will be
trueif an existing authentication (pending or approved) with the same UUID and matching IP was found, andfalseotherwise (meaning new authentication created) - See Also:
-
approveAuthentications
public void approveAuthentications(@NotNull @NotNull Iterable<RemoteAgentAuthentication> authentications) Description copied from interface:RemoteAgentAuthenticationManagerApprove all authentications from the list.
For each authentication in the list this method will:
- remove any pending authentication with matching UUID
- if an approved authentication with matching UUID already exists, it's IP address will be persistently updated to the new authentication's IP address value
- if no approved authentication exists, a new approved authentication with given UUID and IP will be persisted
- Specified by:
approveAuthenticationsin interfaceRemoteAgentAuthenticationManager- Parameters:
authentications- authentications to approve
-
revokeAgentAuthentications
public void revokeAgentAuthentications(@NotNull @NotNull Iterable<RemoteAgentAuthentication> authentications) Description copied from interface:RemoteAgentAuthenticationManagerRevoke approval for given agent authentications.
Not approved authentications will be silently skipped.
- Specified by:
revokeAgentAuthenticationsin interfaceRemoteAgentAuthenticationManager- Parameters:
authentications- authentications to disapprove
-
updateIp
Description copied from interface:RemoteAgentAuthenticationManagerUpdate IP of an approved authentication with given uuid.
If no corresponding authentication is found, no action will be taken.
- Specified by:
updateIpin interfaceRemoteAgentAuthenticationManager- Parameters:
uuid- UUID of an approved authentication to updatenewIp- new IP address of the authentication
-
isAuthenticatedAgentIp
Description copied from interface:RemoteAgentAuthenticationManagerReturns true if the given IP address matches one of the already authenticated remote agent IP patterns. Note that this method will also work for proxy IP addresses. Usage ofRemoteAgentAuthenticationManager.isAuthenticatedAgentIp(InetAddress)is preferred over this method.- Specified by:
isAuthenticatedAgentIpin interfaceRemoteAgentAuthenticationManager
-
isAuthenticatedAgentIp
Description copied from interface:RemoteAgentAuthenticationManagerReturns true if the given IP address matches one of the already authenticated remote agent IP patterns. Note that this method will also work for proxy IP addresses.- Specified by:
isAuthenticatedAgentIpin interfaceRemoteAgentAuthenticationManager
-