feat(auth): add StoredCredentials::new() constructor (#778)
StoredCredentials is #[non_exhaustive] but has no constructor, making it impossible for external crates implementing CredentialStore to construct instances without a serde roundtrip workaround. Add a new() constructor matching the pattern used for other #[non_exhaustive] types in this crate. Fixes #777
This commit is contained in:
parent
ac749e3ced
commit
b74f5ca35b
1 changed files with 17 additions and 0 deletions
|
|
@ -84,6 +84,23 @@ impl std::fmt::Debug for StoredCredentials {
|
|||
}
|
||||
}
|
||||
|
||||
impl StoredCredentials {
|
||||
/// Create a new `StoredCredentials` instance.
|
||||
pub fn new(
|
||||
client_id: String,
|
||||
token_response: Option<OAuthTokenResponse>,
|
||||
granted_scopes: Vec<String>,
|
||||
token_received_at: Option<u64>,
|
||||
) -> Self {
|
||||
Self {
|
||||
client_id,
|
||||
token_response,
|
||||
granted_scopes,
|
||||
token_received_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for storing and retrieving OAuth2 credentials
|
||||
///
|
||||
/// Implementations of this trait can provide custom storage backends
|
||||
|
|
|
|||
Loading…
Reference in a new issue