in emr-user-role-mapper-credentials-provider/src/main/java/com/amazonaws/emr/urm/credentialsprovider/URMCredentialsProvider.java [88:113]
public AWSCredentials getCredentials()
{
//Check to make sure I am allowed to impersonate.
if (!usersAllowedToImpersonate.contains(createdBy)) {
//not going to use impersonation for this.
if (LOG.isDebugEnabled()) {
LOG.debug("Not Impersonating as I am: " + createdBy);
}
//Return null which will then let the existing credentials provider chain to get credentials
return null;
}
String callingUser = this.createdFor;
if (LOG.isDebugEnabled()) {
LOG.debug("I am impersonating user: " + callingUser);
}
try {
urmCredentialsFetcher.setImpersonationUser(callingUser);
return urmCredentialsFetcher.getCredentials();
} catch (Exception e) {
LOG.error("Failed to get credentials for user: " + callingUser + " from URM", e);
throw e;
}
}