use of com.microsoft.sqlserver.jdbc.SQLServerKeyVaultAuthenticationCallback in project mssql-jdbc by microsoft.
the class FedauthWithAE method setupKeyStoreProvider_AKVOld.
private SQLServerColumnEncryptionKeyStoreProvider setupKeyStoreProvider_AKVOld() throws SQLServerException {
ExecutorService service = Executors.newFixedThreadPool(2);
SQLServerKeyVaultAuthenticationCallback authenticationCallback = new SQLServerKeyVaultAuthenticationCallback() {
@Override
public String getAccessToken(String authority, String resource, String scope) {
AuthenticationResult result = null;
try {
AuthenticationContext context = new AuthenticationContext(authority, false, service);
ClientCredential cred = new ClientCredential(applicationClientID, applicationKey);
Future<AuthenticationResult> future = context.acquireToken(resource, cred, null);
result = future.get();
return result.getAccessToken();
} catch (Exception e) {
fail(e.getMessage());
return null;
}
}
};
return new SQLServerColumnEncryptionAzureKeyVaultProvider(authenticationCallback);
}
use of com.microsoft.sqlserver.jdbc.SQLServerKeyVaultAuthenticationCallback in project mssql-jdbc by Microsoft.
the class FedauthWithAE method setupKeyStoreProvider_AKVOld.
private SQLServerColumnEncryptionKeyStoreProvider setupKeyStoreProvider_AKVOld() throws SQLServerException {
ExecutorService service = Executors.newFixedThreadPool(2);
SQLServerKeyVaultAuthenticationCallback authenticationCallback = new SQLServerKeyVaultAuthenticationCallback() {
@Override
public String getAccessToken(String authority, String resource, String scope) {
AuthenticationResult result = null;
try {
AuthenticationContext context = new AuthenticationContext(authority, false, service);
ClientCredential cred = new ClientCredential(applicationClientID, applicationKey);
Future<AuthenticationResult> future = context.acquireToken(resource, cred, null);
result = future.get();
return result.getAccessToken();
} catch (Exception e) {
fail(e.getMessage());
return null;
}
}
};
return new SQLServerColumnEncryptionAzureKeyVaultProvider(authenticationCallback);
}
Aggregations