yup_oauth2/
access_token.rs

1//! pseudo authenticator for use with plain access tokens.
2//! If you use a specialized service to manage your
3//! OAuth2-tokens you may get just the fresh generated
4//! access token from your service.
5//! The intention behind this is that if two services using the
6//! same refresh token then each service will invalitate the
7//! access token of the other service by generating a new token.
8use crate::client::SendRequest;
9use crate::error::Error;
10use crate::types::TokenInfo;
11
12/// the flow for the access token authenticator
13pub struct AccessTokenFlow {
14    pub(crate) access_token: String,
15}
16
17impl AccessTokenFlow {
18    /// just return the access token
19    pub(crate) async fn token<T>(
20        &self,
21        _hyper_client: &impl SendRequest,
22        _scopes: &[T],
23    ) -> Result<TokenInfo, Error>
24    where
25        T: AsRef<str>,
26    {
27        Ok(TokenInfo {
28            access_token: Some(self.access_token.clone()),
29            refresh_token: None,
30            expires_at: None,
31            id_token: None,
32        })
33    }
34}