Update GCP Auth to 0.12
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gcp_auth::AuthenticationManager;
|
||||
|
||||
use crate::error::Result;
|
||||
|
||||
pub trait TokenProvider {
|
||||
@@ -9,18 +7,10 @@ pub trait TokenProvider {
|
||||
-> impl std::future::Future<Output = Result<String>> + Send;
|
||||
}
|
||||
|
||||
impl TokenProvider for Arc<AuthenticationManager> {
|
||||
impl TokenProvider for Arc<dyn gcp_auth::TokenProvider> {
|
||||
async fn get_token(&self, scope: &[&str]) -> Result<String> {
|
||||
match AuthenticationManager::get_token(self, scope).await {
|
||||
Ok(token) => Ok(token.as_str().to_string()),
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TokenProvider for AuthenticationManager {
|
||||
async fn get_token(&self, scope: &[&str]) -> Result<String> {
|
||||
match AuthenticationManager::get_token(self, scope).await {
|
||||
let token = self.token(scope).await;
|
||||
match token {
|
||||
Ok(token) => Ok(token.as_str().to_string()),
|
||||
Err(e) => Err(e.into()),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user