com.atlassian.bamboo.buildqueue.manager
Class RemoteAgentAuthenticationManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.buildqueue.manager.RemoteAgentAuthenticationManagerImpl
All Implemented Interfaces:
RemoteAgentAuthenticationManager

public class RemoteAgentAuthenticationManagerImpl
extends java.lang.Object
implements RemoteAgentAuthenticationManager

Default implementation of RemoteAgentAuthenticationManager.

Since:
3.4

Constructor Summary
RemoteAgentAuthenticationManagerImpl(AdministrationConfigurationManager configManager, RemoteAgentAuthenticationDao agentAuthenticationDao)
           
 
Method Summary
 void approveAuthentications(java.lang.Iterable<RemoteAgentAuthentication> authentications)
          

Approve all authentications from the list.

 java.lang.Iterable<RemoteAgentAuthentication> getAllAuthentications()
          

Get all agent authentications known to this Bamboo server.

 RemoteAgentAuthentication getAuthentication(java.util.UUID uuid)
          

Get first remote agent authentication matching the IP and UUID.

 RemoteAgentAuthentication getAuthentication(java.util.UUID uuid, java.lang.String ip)
          

Get remote agent authentication matching the IP and UUID.

 java.lang.Iterable<RemoteAgentAuthentication> getAuthentications(com.google.common.base.Predicate<RemoteAgentAuthentication> filter)
          Get authentication filtered by given filter.
 com.atlassian.fage.Pair<RemoteAgentAuthentication,java.lang.Boolean> getOrCreatePendingAuthentication(java.util.UUID uuid, java.lang.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(java.lang.Iterable<RemoteAgentAuthentication> authentications)
          

Revoke approval for given agent authentications.

 void setRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled)
          Sets the remote agent authentication to globally enabled/disabled.
 void updateIp(java.util.UUID uuid, java.lang.String newIp)
          

Update IP of an approved authentication with given uuid.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteAgentAuthenticationManagerImpl

public RemoteAgentAuthenticationManagerImpl(AdministrationConfigurationManager configManager,
                                            RemoteAgentAuthenticationDao agentAuthenticationDao)
Method Detail

isRemoteAgentAuthenticationEnabled

public boolean isRemoteAgentAuthenticationEnabled()
Description copied from interface: RemoteAgentAuthenticationManager
Checks whether the remote agent authentication is currently enabled.

Specified by:
isRemoteAgentAuthenticationEnabled in interface RemoteAgentAuthenticationManager
Returns:
true, if remote agent authentication is enabled, false otherwise

setRemoteAgentAuthenticationEnabled

public void setRemoteAgentAuthenticationEnabled(boolean isAuthenticationEnabled)
                                         throws java.lang.Exception
Description copied from interface: RemoteAgentAuthenticationManager
Sets the remote agent authentication to globally enabled/disabled.

Specified by:
setRemoteAgentAuthenticationEnabled in interface RemoteAgentAuthenticationManager
Parameters:
isAuthenticationEnabled - true if remote agent authentication should be enabled, false otherwise.
Throws:
java.lang.Exception - on any error

getAllAuthentications

@NotNull
public java.lang.Iterable<RemoteAgentAuthentication> getAllAuthentications()
Description copied from interface: 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.

Specified by:
getAllAuthentications in interface RemoteAgentAuthenticationManager
Returns:
all agent authentications

getAuthentications

@NotNull
public java.lang.Iterable<RemoteAgentAuthentication> getAuthentications(com.google.common.base.Predicate<RemoteAgentAuthentication> filter)
Description copied from interface: RemoteAgentAuthenticationManager
Get authentication filtered by given filter.

Specified by:
getAuthentications in interface RemoteAgentAuthenticationManager
Parameters:
filter - predicate to filter authentications
Returns:
list of authentications matching the filter

getAuthentication

@Nullable
public RemoteAgentAuthentication getAuthentication(java.util.UUID uuid,
                                                            java.lang.String ip)
Description copied from interface: 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.

Specified by:
getAuthentication in interface RemoteAgentAuthenticationManager
Parameters:
uuid - UUID
ip - IP address
Returns:
remote agent authentication matching the request, or null

getAuthentication

public RemoteAgentAuthentication getAuthentication(java.util.UUID uuid)
Description copied from interface: 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.

Specified by:
getAuthentication in interface RemoteAgentAuthenticationManager
Parameters:
uuid - UUID
Returns:
remote agent authentication with matching UUID, or null

getOrCreatePendingAuthentication

@NotNull
public com.atlassian.fage.Pair<RemoteAgentAuthentication,java.lang.Boolean> getOrCreatePendingAuthentication(@NotNull
                                                                                                                     java.util.UUID uuid,
                                                                                                                     @NotNull
                                                                                                                     java.lang.String ip)
Description copied from interface: 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.

Specified by:
getOrCreatePendingAuthentication in interface RemoteAgentAuthenticationManager
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)
See Also:
RemoteAgentAuthentications.matching(java.util.UUID, String)

approveAuthentications

public void approveAuthentications(@NotNull
                                   java.lang.Iterable<RemoteAgentAuthentication> authentications)
Description copied from interface: RemoteAgentAuthenticationManager

Approve all authentications from the list.

For each authentication in the list this method will:

Specified by:
approveAuthentications in interface RemoteAgentAuthenticationManager
Parameters:
authentications - authentications to approve

revokeAgentAuthentications

public void revokeAgentAuthentications(@NotNull
                                       java.lang.Iterable<RemoteAgentAuthentication> authentications)
Description copied from interface: RemoteAgentAuthenticationManager

Revoke approval for given agent authentications.

Not approved authentications will be silently skipped.

Specified by:
revokeAgentAuthentications in interface RemoteAgentAuthenticationManager
Parameters:
authentications - authentications to disapprove

updateIp

public void updateIp(@NotNull
                     java.util.UUID uuid,
                     @NotNull
                     java.lang.String newIp)
Description copied from interface: RemoteAgentAuthenticationManager

Update IP of an approved authentication with given uuid.

If no corresponding authentication is found, no action will be taken.

Specified by:
updateIp in interface RemoteAgentAuthenticationManager
Parameters:
uuid - UUID of an approved authentication to update
newIp - new IP address of the authentication


Copyright © 2012 Atlassian. All Rights Reserved.