public static Credential credential ( AccessTokenProviderClassFromConfigFactory providerClassFactory , Configuration config , Collection < String > scopes ) throws IOException , GeneralSecurityException { Class < ? extends AccessTokenProvider > clazz = providerClassFactory . getAccessTokenProviderClass ( config ) ; if ( clazz != null ) { logger . atFine ( ) . log ( "Using AccessTokenProvider (%s)" , clazz . getName ( ) ) ; try { AccessTokenProvider accessTokenProvider = clazz . getDeclaredConstructor ( ) . newInstance ( ) ; accessTokenProvider . setConf ( config ) ; return getCredentialFromAccessTokenProvider ( accessTokenProvider , scopes ) ; } catch ( ReflectiveOperationException ex ) { throw new IOException ( "Can't instantiate " + clazz . getName ( ) , ex ) ; } } return null ; }
Generate the credential .