code: private UsernamePasswordCredentials getCredentialsById(String credentialsId, Run<?, ?> run, PrintStream logger) {
      	if (StringUtils.isBlank(credentialsId)) {
      		throw new NullPointerException("credentials is not configured.");
      	}
      	
      	UsernamePasswordCredentials credentials = CredentialsProvider.findCredentialById(credentialsId,
          		StandardUsernamePasswordCredentials.class,
          		run,
      			URIRequirementBuilder.create().build());
      	
      	if (credentials == null) {
      		logger.println("Can not find credentials with the credentialsId:" + credentialsId);
      	}
      	return credentials;
      }
docs: Get user name password credentials by id.