-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track Client endpoints statically via typestates
Currently, the authorization endpoint is required, and all other endpoints are optional. This both causes problems for authentication flows that don't require an authorization endpoint (and for which the server may not implement one; see #135), and introduces fallibility into methods that depend on endpoints having been set previously. This change makes all endpoints optional, and each endpoint has a corresponding setter method as part of the Builder Pattern. Each endpoint has a corresponding const generic parameter within the `Client` that tracks whether that endpoint has been set. Each method that depends on an endpoint is implemented only for `Client` instances that have previously called the corresponding setter, which is enforced at compile time. BREAKING CHANGE: The `Client::new()` method now only accepts a client ID. The client secret, authorization endpoint, and token endpoint have been moved to `set_client_secret`, `set_auth_url`, and `set_token_url` methods, respectively. Also, the additional const generics added to `Client` and `BasicClient` will need to be specified at each call site that specifies any of the generic parameters.
- Loading branch information
Showing
12 changed files
with
797 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.