public class RemoteAgentAuthenticationManagerImpl extends Object implements RemoteAgentAuthenticationManager
RemoteAgentAuthenticationManager
.Constructor and Description |
---|
RemoteAgentAuthenticationManagerImpl(AdministrationConfigurationAccessor administrationConfigurationAccessor,
AdministrationConfigurationPersister administrationConfigurationPersister,
AgentManager agentManager,
RemoteAgentAuthenticationDao agentAuthenticationDao,
com.atlassian.event.api.EventPublisher eventPublisher,
int agentHeartbeatIntervalSeconds) |
Modifier and Type | Method and Description |
---|---|
void |
approveAuthentications(@NotNull Iterable<RemoteAgentAuthentication> authentications)
Approve all authentications from the list.
|
@NotNull Iterable<RemoteAgentAuthentication> |
getAllAuthentications()
Get all agent authentications known to this Bamboo server.
|
RemoteAgentAuthentication |
getAuthentication(UUID uuid)
Get first remote agent authentication matching the IP and UUID.
|
@Nullable RemoteAgentAuthentication |
getAuthentication(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.
|
boolean |
isAuthenticatedAgentIp(@NotNull InetAddress inetAddress)
Returns true if the given IP address matches one of the already authenticated remote agent IP patterns.
|
boolean |
isAuthenticatedAgentIp(@NotNull String ip)
Returns true if the given IP address matches one of the already authenticated remote agent IP patterns.
|
boolean |
isRemoteAgentAuthenticationEnabled()
Checks whether the remote agent authentication is currently enabled.
|
void |
revokeAgentAuthentications(@NotNull Iterable<RemoteAgentAuthentication> authentications)
Revoke approval for given agent authentications.
|
void |
setRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled)
Sets the remote agent authentication to globally enabled/disabled.
|
void |
updateIp(@NotNull UUID uuid,
@NotNull String newIp)
Update IP of an approved authentication with given uuid.
|
public RemoteAgentAuthenticationManagerImpl(AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister, AgentManager agentManager, RemoteAgentAuthenticationDao agentAuthenticationDao, com.atlassian.event.api.EventPublisher eventPublisher, int agentHeartbeatIntervalSeconds)
public boolean isRemoteAgentAuthenticationEnabled()
RemoteAgentAuthenticationManager
isRemoteAgentAuthenticationEnabled
in interface RemoteAgentAuthenticationManager
true
, if remote agent authentication is enabled, false
otherwisepublic void setRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled) throws Exception
RemoteAgentAuthenticationManager
setRemoteAgentAuthenticationEnabled
in interface RemoteAgentAuthenticationManager
isAuthenticationEnabled
- true
if remote agent authentication should be enabled, false
otherwise.Exception
- on any error@NotNull public @NotNull Iterable<RemoteAgentAuthentication> getAllAuthentications()
RemoteAgentAuthenticationManager
Get all agent authentications known to this Bamboo server.
The list is sorted first by the authentication status (unapproved first), then by IP address.
getAllAuthentications
in interface RemoteAgentAuthenticationManager
@NotNull public @NotNull Iterable<RemoteAgentAuthentication> getAuthentications(com.google.common.base.Predicate<RemoteAgentAuthentication> filter)
RemoteAgentAuthenticationManager
getAuthentications
in interface RemoteAgentAuthenticationManager
filter
- predicate to filter authentications@Nullable public @Nullable RemoteAgentAuthentication getAuthentication(UUID uuid, String ip)
RemoteAgentAuthenticationManager
Get remote agent authentication matching the IP and UUID. If not found, null
will 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.
getAuthentication
in interface RemoteAgentAuthenticationManager
uuid
- UUIDip
- IP addressnull
public RemoteAgentAuthentication getAuthentication(UUID uuid)
RemoteAgentAuthenticationManager
Get first remote agent authentication matching the IP and UUID. If not found, null
will 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.
getAuthentication
in interface RemoteAgentAuthenticationManager
uuid
- UUIDnull
@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)
RemoteAgentAuthenticationManager
Create 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.
getOrCreatePendingAuthentication
in interface RemoteAgentAuthenticationManager
uuid
- UUIDip
- IP addresstrue
if an existing authentication (pending or approved) with the same UUID and matching IP was
found, and false
otherwise (meaning new authentication created)RemoteAgentAuthentications.matching(java.util.UUID, String)
public void approveAuthentications(@NotNull @NotNull Iterable<RemoteAgentAuthentication> authentications)
RemoteAgentAuthenticationManager
Approve all authentications from the list.
For each authentication in the list this method will:
approveAuthentications
in interface RemoteAgentAuthenticationManager
authentications
- authentications to approvepublic void revokeAgentAuthentications(@NotNull @NotNull Iterable<RemoteAgentAuthentication> authentications)
RemoteAgentAuthenticationManager
Revoke approval for given agent authentications.
Not approved authentications will be silently skipped.
revokeAgentAuthentications
in interface RemoteAgentAuthenticationManager
authentications
- authentications to disapprovepublic void updateIp(@NotNull @NotNull UUID uuid, @NotNull @NotNull String newIp)
RemoteAgentAuthenticationManager
Update IP of an approved authentication with given uuid.
If no corresponding authentication is found, no action will be taken.
updateIp
in interface RemoteAgentAuthenticationManager
uuid
- UUID of an approved authentication to updatenewIp
- new IP address of the authenticationpublic boolean isAuthenticatedAgentIp(@NotNull @NotNull String ip)
RemoteAgentAuthenticationManager
RemoteAgentAuthenticationManager.isAuthenticatedAgentIp(InetAddress)
is preferred over this method.isAuthenticatedAgentIp
in interface RemoteAgentAuthenticationManager
public boolean isAuthenticatedAgentIp(@NotNull @NotNull InetAddress inetAddress)
RemoteAgentAuthenticationManager
isAuthenticatedAgentIp
in interface RemoteAgentAuthenticationManager
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.