mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-02-23 15:50:00 +01:00
Improve clarity on redirect URLs for #191
This commit is contained in:
@@ -156,3 +156,11 @@ impl DeviceFlowDelegate for DefaultDeviceFlowDelegate {}
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct DefaultInstalledFlowDelegate;
|
||||
impl InstalledFlowDelegate for DefaultInstalledFlowDelegate {}
|
||||
|
||||
/// The default installed-flow delegate (i.e.: show URL on stdout). Use this to specify
|
||||
/// a custom redirect URL.
|
||||
#[derive(Clone)]
|
||||
pub struct DefaultInstalledFlowDelegateWithRedirectURI(pub String);
|
||||
impl InstalledFlowDelegate for DefaultInstalledFlowDelegateWithRedirectURI {
|
||||
fn redirect_uri(&self) -> Option<&str> { Some(self.0.as_str()) }
|
||||
}
|
||||
|
||||
@@ -91,6 +91,15 @@ pub struct InstalledFlow {
|
||||
|
||||
impl InstalledFlow {
|
||||
/// Create a new InstalledFlow with the provided secret and method.
|
||||
///
|
||||
/// In order to specify the redirect URL to use (in the case of `HTTPRedirect` or
|
||||
/// `HTTPPortRedirect` as method), either implement the `InstalledFlowDelegate` trait, or
|
||||
/// use the `DefaultInstalledFlowDelegateWithRedirectURI`, which presents the URL on stdout.
|
||||
/// The redirect URL to use is configured with the OAuth provider, and possible options are
|
||||
/// given in the `ApplicationSecret.redirect_uris` field.
|
||||
///
|
||||
/// The `InstalledFlowDelegate` implementation should be assigned to the `flow_delegate` field
|
||||
/// of the `InstalledFlow` struct.
|
||||
pub(crate) fn new(
|
||||
app_secret: ApplicationSecret,
|
||||
method: InstalledFlowReturnMethod,
|
||||
|
||||
Reference in New Issue
Block a user