@@ -60,6 +60,7 @@ const DEFAULT_EXCHANGE_URL: &str = "http://localhost";
6060
6161/// Stored credentials for OAuth2 authorization
6262#[ derive( Clone , Serialize , Deserialize ) ]
63+ #[ non_exhaustive]
6364pub struct StoredCredentials {
6465 pub client_id : String ,
6566 pub token_response : Option < OAuthTokenResponse > ,
@@ -134,6 +135,7 @@ impl CredentialStore for InMemoryCredentialStore {
134135
135136/// Stored authorization state for OAuth2 PKCE flow
136137#[ derive( Clone , Serialize , Deserialize ) ]
138+ #[ non_exhaustive]
137139pub struct StoredAuthorizationState {
138140 pub pkce_verifier : String ,
139141 pub csrf_token : String ,
@@ -257,6 +259,7 @@ impl StateStore for InMemoryStateStore {
257259
258260/// HTTP client with OAuth 2.0 authorization
259261#[ derive( Clone ) ]
262+ #[ non_exhaustive]
260263pub struct AuthClient < C > {
261264 pub http_client : C ,
262265 pub auth_manager : Arc < Mutex < AuthorizationManager > > ,
@@ -350,6 +353,7 @@ pub enum AuthError {
350353
351354/// oauth2 metadata
352355#[ derive( Debug , Clone , Deserialize , Serialize , Default ) ]
356+ #[ non_exhaustive]
353357pub struct AuthorizationMetadata {
354358 pub authorization_endpoint : String ,
355359 pub token_endpoint : String ,
@@ -373,6 +377,7 @@ struct ResourceServerMetadata {
373377
374378/// Parameters extracted from WWW-Authenticate header
375379#[ derive( Debug , Clone , Default ) ]
380+ #[ non_exhaustive]
376381pub struct WWWAuthenticateParams {
377382 pub resource_metadata_url : Option < Url > ,
378383 pub scope : Option < String > ,
@@ -394,13 +399,35 @@ impl WWWAuthenticateParams {
394399
395400/// oauth2 client config
396401#[ derive( Debug , Clone ) ]
402+ #[ non_exhaustive]
397403pub struct OAuthClientConfig {
398404 pub client_id : String ,
399405 pub client_secret : Option < String > ,
400406 pub scopes : Vec < String > ,
401407 pub redirect_uri : String ,
402408}
403409
410+ impl OAuthClientConfig {
411+ pub fn new ( client_id : impl Into < String > , redirect_uri : impl Into < String > ) -> Self {
412+ Self {
413+ client_id : client_id. into ( ) ,
414+ client_secret : None ,
415+ scopes : Vec :: new ( ) ,
416+ redirect_uri : redirect_uri. into ( ) ,
417+ }
418+ }
419+
420+ pub fn with_client_secret ( mut self , secret : impl Into < String > ) -> Self {
421+ self . client_secret = Some ( secret. into ( ) ) ;
422+ self
423+ }
424+
425+ pub fn with_scopes ( mut self , scopes : Vec < String > ) -> Self {
426+ self . scopes = scopes;
427+ self
428+ }
429+ }
430+
404431// add type aliases for oauth2 types
405432type OAuthErrorResponse = oauth2:: StandardErrorResponse < oauth2:: basic:: BasicErrorResponseType > ;
406433
@@ -534,6 +561,7 @@ impl ClientCredentialsConfig {
534561
535562/// Configuration for scope upgrade behavior
536563#[ derive( Debug , Clone ) ]
564+ #[ non_exhaustive]
537565pub struct ScopeUpgradeConfig {
538566 /// Maximum number of scope upgrade attempts before giving up
539567 pub max_upgrade_attempts : u32 ,
0 commit comments