@Nonnull @Override public Secret getPassword() { final AmazonWebServicesCredentials credentials = getCredentials(); if (credentials == null) throw new IllegalStateException("Invalid credentials"); LOG.log(Level.FINE,"Get Password for {0} region : {1}", new Object[]{credentials.getDisplayName(), region}); if(LOG.isLoggable(Level.ALL)){ String fullStackTrace = org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(new Throwable()); LOG.log(Level.ALL,"Trace : {0}", fullStackTrace); } com.amazonaws.AmazonECRClientFactory factory = new com.amazonaws.AmazonECRClientFactory(); final AmazonECRClient client = factory.getAmazonECRClientWithProxy(credentials.getCredentials()); client.setRegion(Region.getRegion(region)); GetAuthorizationTokenRequest request = new GetAuthorizationTokenRequest(); final GetAuthorizationTokenResult authorizationToken = client.getAuthorizationToken(request); final List<AuthorizationData> authorizationData = authorizationToken.getAuthorizationData(); if (authorizationData == null || authorizationData.isEmpty()) { throw new IllegalStateException("Failed to retrieve authorization token for Amazon ECR"); } LOG.fine("Success "); if(LOG.isLoggable(Level.ALL)){ LOG.finest("Auth token: " + authorizationToken.toString()); LOG.finest("Request: " + request.toString()); } return Secret.fromString(authorizationData.get(0).getAuthorizationToken()); }