public interface

RemoteAgentAuthenticationManager

com.atlassian.bamboo.buildqueue.manager.RemoteAgentAuthenticationManager
Known Indirect Subclasses

Class Overview

Manages remote agent authentication.

This manager keeps track of two types of authentication requests: the ones pending approval (not approved) and the ones already approved. ONLY approved authentications are stored persistently.

Authentications are uniquely identified by their UUID, meaning there can never be two approved authentications with the same UUID, or two authentications pending approval with the same UUID. This also means that if an authentication gets approved with UUID associated with some other previously approved authentication, the latter will be replaced with the newly approved authentication.

IP of approved (persisted) authentications can be updated. Wildcard characters (*,?) can be used to match authentications.

Summary

Public Methods
void approveAuthentications(Iterable<RemoteAgentAuthentication> authentications)

Approve all authentications from the list.
@NotNull Iterable<RemoteAgentAuthentication> getAllAuthentications()

Get all agent authentications known to this Bamboo server.
@Nullable 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(Predicate<RemoteAgentAuthentication> filter)
Get authentication filtered by given filter.
@NotNull Pair<RemoteAgentAuthenticationBoolean> getOrCreatePendingAuthentication(UUID uuid, String ip)

Create a new pending authentication for given IP address and UUID.
boolean isRemoteAgentAuthenticationEnabled()
Checks whether the remote agent authentication is currently enabled.
void revokeAgentAuthentications(Iterable<RemoteAgentAuthentication> authentications)

Revoke approval for given agent authentications.
void setRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled)
Sets the remote agent authentication to globally enabled/disabled.
void updateIp(UUID uuid, String newIp)

Update IP of an approved authentication with given uuid.

Public Methods

public void approveAuthentications (Iterable<RemoteAgentAuthentication> authentications)

Approve 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
Parameters
authentications authentications to approve

@NotNull public Iterable<RemoteAgentAuthentication> getAllAuthentications ()

Get all agent authentications known to this Bamboo server.

The list is sorted first by the authentication status (unapproved first), then by IP address.
Returns
  • all agent authentications

@Nullable public RemoteAgentAuthentication getAuthentication (UUID uuid)

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.
Parameters
uuid UUID
Returns
  • remote agent authentication with matching UUID, or null

@Nullable public RemoteAgentAuthentication getAuthentication (UUID uuid, String ip)

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.
Parameters
uuid UUID
ip IP address
Returns
  • remote agent authentication matching the request, or null

@NotNull public Iterable<RemoteAgentAuthentication> getAuthentications (Predicate<RemoteAgentAuthentication> filter)

Get authentication filtered by given filter.

Parameters
filter predicate to filter authentications
Returns
  • list of authentications matching the filter

@NotNull public Pair<RemoteAgentAuthenticationBoolean> getOrCreatePendingAuthentication (UUID uuid, String ip)

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.
Parameters
uuid UUID
ip IP address
Returns
  • new authentication pending approval, or an existing approved authentication. The boolean flag that will be true if an existing authentication (pending or approved) with the same UUID and matching IP was found, and false otherwise (meaning new authentication created)
Throws
NullPointerException if any of the arguments is null

public boolean isRemoteAgentAuthenticationEnabled ()

Checks whether the remote agent authentication is currently enabled.

Returns
  • true, if remote agent authentication is enabled, false otherwise

public void revokeAgentAuthentications (Iterable<RemoteAgentAuthentication> authentications)

Revoke approval for given agent authentications.

Not approved authentications will be silently skipped.
Parameters
authentications authentications to disapprove

public void setRemoteAgentAuthenticationEnabled (boolean isAuthenticationEnabled)

Sets the remote agent authentication to globally enabled/disabled.

Parameters
isAuthenticationEnabled true if remote agent authentication should be enabled, false otherwise.
Throws
Exception on any error

public void updateIp (UUID uuid, String newIp)

Update IP of an approved authentication with given uuid.

If no corresponding authentication is found, no action will be taken.
Parameters
uuid UUID of an approved authentication to update
newIp new IP address of the authentication