Skip to content

Commit

Permalink
Athenz Identity Provider for Harness (#2773)
Browse files Browse the repository at this point in the history
* Athenz Identity Provider for Harness

---------

Signed-off-by: Henry Avetisyan <[email protected]>
  • Loading branch information
havetisyan authored Oct 23, 2024
1 parent 349dea9 commit e0b7faf
Show file tree
Hide file tree
Showing 18 changed files with 2,125 additions and 22 deletions.
2 changes: 1 addition & 1 deletion libs/java/instance_provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<packaging>jar</packaging>

<properties>
<code.coverage.min>0.9983</code.coverage.min>
<code.coverage.min>1.00</code.coverage.min>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public class InstanceGCPProvider implements InstanceProvider {

DynamicConfigLong bootTimeOffsetSeconds; // boot time offset in seconds
long certValidityTime; // cert validity for STS creds only case
boolean supportRefresh = false;
String gcpRegion;
Set<String> dnsSuffixes = null;
List<String> gkeDnsSuffixes = null;
Expand Down Expand Up @@ -134,12 +133,8 @@ public void setExternalCredentialsProvider(ExternalCredentialsProvider externalC
}

public ProviderResourceException error(String message) {
return error(ProviderResourceException.FORBIDDEN, message);
}

public ProviderResourceException error(int errorCode, String message) {
LOGGER.error(message);
return new ProviderResourceException(errorCode, message);
return new ProviderResourceException(ProviderResourceException.FORBIDDEN, message);
}

protected Set<String> getDnsSuffixes() {
Expand Down Expand Up @@ -298,14 +293,13 @@ public InstanceConfirmation confirmInstance(InstanceConfirmation confirmation) t

@Override
public InstanceConfirmation refreshInstance(InstanceConfirmation confirmation) throws ProviderResourceException {

// if we don't have an attestation data then we're going to
// return not found exception unless the provider is required
// to support refresh and in that case we'll return forbidden
// return not forbidden exception

final String attestationDataStr = confirmation.getAttestationData();
if (StringUtil.isEmpty(attestationDataStr)) {
int errorCode = supportRefresh ? ProviderResourceException.FORBIDDEN : ProviderResourceException.NOT_FOUND;
throw error(errorCode, "No attestation data provided during refresh");
throw error("No attestation data provided during refresh");
}

GCPAttestationData attestationData = JSON.fromString(attestationDataStr, GCPAttestationData.class);
Expand Down
Loading

0 comments on commit e0b7faf

Please sign in to comment.