pub struct DcrBuilder { /* private fields */ }Expand description
Builder for dynamic client registration requests
Provides convenient methods for constructing registration requests with sensible defaults for MCP clients.
§Example
use turbomcp_auth::oauth2::dcr::DcrBuilder;
let request = DcrBuilder::mcp_client("My MCP Client", "http://localhost:3000/callback")
.with_scopes(vec!["mcp:tools".to_string(), "mcp:resources".to_string()])
.with_client_uri("https://my-app.example.com".to_string())
.with_contacts(vec!["admin@example.com".to_string()])
.build();Implementations§
Source§impl DcrBuilder
impl DcrBuilder
Sourcepub fn mcp_client(client_name: &str, redirect_uri: &str) -> Self
pub fn mcp_client(client_name: &str, redirect_uri: &str) -> Self
Create a new DCR builder for MCP client
Sets sensible defaults:
- Grant types: authorization_code, refresh_token
- Response types: code
- Token endpoint auth: client_secret_basic
- Application type: web
- Software ID: turbomcp
§Arguments
client_name- Human-readable client nameredirect_uri- OAuth redirect URI
Sourcepub fn native_client(client_name: &str, redirect_uri: &str) -> Self
pub fn native_client(client_name: &str, redirect_uri: &str) -> Self
Create a builder for a native/mobile client
Sets application_type to “native” and uses appropriate auth method
Sourcepub fn with_scopes(self, scopes: Vec<String>) -> Self
pub fn with_scopes(self, scopes: Vec<String>) -> Self
Set OAuth scopes
Sourcepub fn with_client_uri(self, uri: String) -> Self
pub fn with_client_uri(self, uri: String) -> Self
Set client homepage URI
Sourcepub fn with_logo_uri(self, uri: String) -> Self
pub fn with_logo_uri(self, uri: String) -> Self
Set logo URI
Sourcepub fn with_contacts(self, contacts: Vec<String>) -> Self
pub fn with_contacts(self, contacts: Vec<String>) -> Self
Set contact emails
Sourcepub fn with_tos_uri(self, uri: String) -> Self
pub fn with_tos_uri(self, uri: String) -> Self
Set terms of service URI
Sourcepub fn with_policy_uri(self, uri: String) -> Self
pub fn with_policy_uri(self, uri: String) -> Self
Set privacy policy URI
Sourcepub fn with_jwks_uri(self, uri: String) -> Self
pub fn with_jwks_uri(self, uri: String) -> Self
Set JWKS URI for public keys
Sourcepub fn with_redirect_uris(self, uris: Vec<String>) -> Self
pub fn with_redirect_uris(self, uris: Vec<String>) -> Self
Set additional redirect URIs
Sourcepub fn build(self) -> RegistrationRequest
pub fn build(self) -> RegistrationRequest
Build the registration request
Auto Trait Implementations§
impl Freeze for DcrBuilder
impl RefUnwindSafe for DcrBuilder
impl Send for DcrBuilder
impl Sync for DcrBuilder
impl Unpin for DcrBuilder
impl UnwindSafe for DcrBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more