1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use crate::error::Error;
use crate::types::TokenInfo;
use hyper::client::connect::Connection;
use http::Uri;
use std::error::Error as StdError;
use tokio::io::{AsyncRead, AsyncWrite};
use tower_service::Service;
pub struct AccessTokenFlow {
pub(crate) access_token: String,
}
impl AccessTokenFlow {
pub(crate) async fn token<S, T>(
&self,
_hyper_client: &hyper::Client<S>,
_scopes: &[T],
) -> Result<TokenInfo, Error>
where
T: AsRef<str>,
S: Service<Uri> + Clone + Send + Sync + 'static,
S::Response: Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static,
S::Future: Send + Unpin + 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
{
Ok(TokenInfo {
access_token: Some(self.access_token.clone()),
refresh_token: None,
expires_at: None,
id_token: None,
})
}
}