Struct clio_auth::CliOAuthBuilder
source · pub struct CliOAuthBuilder { /* private fields */ }
Expand description
A builder for CliOAuth
structs.
Not constructed directly. See CliOAuth::builder()
.
Implementations§
source§impl CliOAuthBuilder
impl CliOAuthBuilder
sourcepub fn port(self, port: u16) -> Self
pub fn port(self, port: u16) -> Self
Configures a single port for the web server to attempt to bind to.
For simplicity, must be a non-privileged port (greater than or equal to 1024
).
sourcepub fn port_range(self, ports: Range<u16>) -> Self
pub fn port_range(self, ports: Range<u16>) -> Self
Configures a range of ports for the web server to attempt to bind to.
When the CliOAuth
instance is constructed, each of these ports will be tried in order. The
first open one will be used.
The default range is 3456..3465
.
sourcepub fn ip_address(self, ip_address: impl Into<IpAddr>) -> Self
pub fn ip_address(self, ip_address: impl Into<IpAddr>) -> Self
Configures the local IP address for the web server to listen on.
Address must be valid on the system. The default is “localhost” (127.0.0.1
), which works
fine in most cases.
sourcepub fn socket_address(self, address: SocketAddr) -> Self
pub fn socket_address(self, address: SocketAddr) -> Self
Configures a socket address (IP address and port) for the web server to listen on.
If provided, it overrides the ip_address
,
port
, and port_range
settings.
sourcepub fn timeout(self, timeout: u64) -> Self
pub fn timeout(self, timeout: u64) -> Self
Configures the number of seconds the server will wait for an authorization code.
If the server has not received a request containing a valid authorization code, it will shut itself down, and the token exchange will not be possible.
The default is 60
seconds.
sourcepub fn scope(self, scope: Scope) -> Self
pub fn scope(self, scope: Scope) -> Self
Adds a scope to include with the authorization request.
sourcepub fn scopes<S>(self, scopes: S) -> Selfwhere
S: IntoIterator<Item = Scope>,
pub fn scopes<S>(self, scopes: S) -> Selfwhere S: IntoIterator<Item = Scope>,
Adds scopes to include with the authorization request.
sourcepub fn build(self) -> ConfigResult<CliOAuth>
pub fn build(self) -> ConfigResult<CliOAuth>
Constructs the CliOAuth
instance with the configuration captured in this builder.