private static Credentials getCredentials ( ConnectionParameters parameters ) throws IOException { if ( parameters . isEmulator ( ) ) { return NoCredentials . getInstance ( ) ; } InputStream jsonCredentialsStream = parameters . getJsonCredentialsStream ( ) ; if ( jsonCredentialsStream != null ) { return ServiceAccountCredentials . fromStream ( jsonCredentialsStream ) ; } File jsonCredentialsFile = parameters . getJsonCredentialsFile ( ) ; if ( jsonCredentialsFile != null ) { return ServiceAccountCredentials . fromStream ( new FileInputStream ( jsonCredentialsFile ) ) ; } return ServiceAccountCredentials . getApplicationDefault ( ) ; }
Creates and returns the credentials from the given connection parameters .