diff --git a/gradle.properties b/gradle.properties index 2c836a3df..a732a05aa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,6 @@ # limitations under the License. # -version=3.25.5 +version=3.25.7 groupId=com.nike.cerberus artifactId=cms diff --git a/src/main/java/com/nike/cerberus/endpoints/authentication/AuthenticateStsIdentity.java b/src/main/java/com/nike/cerberus/endpoints/authentication/AuthenticateStsIdentity.java index 60d749b20..dafbbcf5d 100644 --- a/src/main/java/com/nike/cerberus/endpoints/authentication/AuthenticateStsIdentity.java +++ b/src/main/java/com/nike/cerberus/endpoints/authentication/AuthenticateStsIdentity.java @@ -78,16 +78,17 @@ private ResponseInfo authenticate(RequestInfo request) final String headerXAmzDate = getHeaderXAmzDate(request); final String headerXAmzSecurityToken = getHeaderXAmzSecurityToken(request); final String headerAuthorization = getHeaderAuthorization(request); - - if (headerAuthorization == null || headerXAmzDate == null || headerXAmzSecurityToken == null) { - throw new ApiException(DefaultApiError.MISSING_AWS_SIGNATURE_HEADERS); - } - - AwsStsHttpHeader header = new AwsStsHttpHeader(headerXAmzDate, headerXAmzSecurityToken, headerAuthorization); - GetCallerIdentityResponse getCallerIdentityResponse = awsStsClient.getCallerIdentity(header); - String iamPrincipalArn = getCallerIdentityResponse.getGetCallerIdentityResult().getArn(); + String iamPrincipalArn = null; AuthTokenResponse authResponse = null; try { + if (headerAuthorization == null || headerXAmzDate == null || headerXAmzSecurityToken == null) { + throw new ApiException(DefaultApiError.MISSING_AWS_SIGNATURE_HEADERS); + } + + AwsStsHttpHeader header = new AwsStsHttpHeader(headerXAmzDate, headerXAmzSecurityToken, headerAuthorization); + GetCallerIdentityResponse getCallerIdentityResponse = awsStsClient.getCallerIdentity(header); + iamPrincipalArn = getCallerIdentityResponse.getGetCallerIdentityResult().getArn(); + authResponse = authenticationService.stsAuthenticate(iamPrincipalArn); } catch (ApiException e) { eventProcessorService.ingestEvent(auditableEvent(