@Test(expected = ConfigException.class) public void testNulBearerToken() throws MalformedURLException { Map<String, Object> clientConfig = new HashMap<>(); StaticTokenCredentialProvider provider = new StaticTokenCredentialProvider(); provider.configure(clientConfig); }
@Override public void configure(Map<String, ?> configs) { bearerToken = (String) configs.get(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG); if (bearerToken != null && !bearerToken.isEmpty()) { return; } throw new ConfigException(String.format( "Token must be provided via %s config when %s is set to %s", SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, alias() )); }
StaticTokenCredentialProvider implements BearerAuthCredentialProvider { @Override public void configure(Map<String, ?> configs) { bearerToken = (String) configs.get(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG); if (bearerToken != null && !bearerToken.isEmpty()) { return; } throw new ConfigException(String.format( "Token must be provided via %s config when %s is set to %s", SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, alias() )); } }
StaticTokenCredentialProvider implements BearerAuthCredentialProvider { @Override public void configure(Map<String, ?> configs) { bearerToken = (String) configs.get(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG); if (bearerToken != null && !bearerToken.isEmpty()) { return; } throw new ConfigException(String.format( "Token must be provided via %s config when %s is set to %s", SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, alias() )); }  }
StaticTokenCredentialProvider implements BearerAuthCredentialProvider { @Override public void configure(Map<String, ?> configs) { bearerToken = (String) configs.get(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG); if (bearerToken != null && !bearerToken.isEmpty()) { return; } throw new ConfigException(String.format( "Token must be provided via %s config when %s is set to %s", SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, alias() )); }  @Override String alias(); @Override void configure(Map<String, ?> configs); @Override String getBearerToken(URL url); }
StaticTokenCredentialProvider implements BearerAuthCredentialProvider { @Override public void configure(Map<String, ?> configs) { bearerToken = (String) configs.get(SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG); if (bearerToken != null && !bearerToken.isEmpty()) { return; } throw new ConfigException(String.format( "Token must be provided via %s config when %s is set to %s", SchemaRegistryClientConfig.BEARER_AUTH_TOKEN_CONFIG, SchemaRegistryClientConfig.BEARER_AUTH_CREDENTIALS_SOURCE, alias() )); }  @Override String alias(); @Override void configure(Map<String, ?> configs); @Override String getBearerToken(URL url);  }