Exposing SpiffeSVID and SpiffeIdManager

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
This commit is contained in:
Max Lambrecht 2018-09-04 12:20:59 -03:00
parent 5a8662563e
commit f2d492e586
2 changed files with 10 additions and 6 deletions

View File

@ -17,7 +17,7 @@ import static java.util.Collections.EMPTY_SET;
* It gets SVID updates asynchronously from the Workload API
*
*/
class SpiffeIdManager {
public class SpiffeIdManager {
private static final SpiffeIdManager INSTANCE = new SpiffeIdManager();
@ -47,6 +47,10 @@ class SpiffeIdManager {
svidFetcher.registerListener(this::updateSVID);
}
public SpiffeSVID getSpiffeSVID() {
return guard.read(() -> spiffeSVID);
}
/**
* Method used as callback that gets executed whenever an SVID update is pushed by the Workload API
* Uses a write lock to synchronize access to spiffeSVID

View File

@ -12,7 +12,7 @@ import java.util.logging.Logger;
* Represents a SPIFFE Identity
*
*/
class SpiffeSVID {
public class SpiffeSVID {
private static final Logger LOGGER = Logger.getLogger(SpiffeSVID.class.getName());
@ -51,19 +51,19 @@ class SpiffeSVID {
}
}
String getSpiffeID() {
public String getSpiffeID() {
return spiffeID;
}
X509Certificate getCertificate() {
public X509Certificate getCertificate() {
return certificate;
}
PrivateKey getPrivateKey() {
public PrivateKey getPrivateKey() {
return privateKey;
}
Set<X509Certificate> getBundle() {
public Set<X509Certificate> getBundle() {
return bundle;
}
}