pub struct ClientId(String);Expand description
An OAuth client_id, known to be in canonical form.
A rule denying a client compares its id as text. If one client could
spell its id two ways — https://Bad.example/…, https://bad.example:443/…
— the second spelling would walk past a rule written against the first.
ClientId::parse accepts exactly one spelling: the one the url crate
serializes the URL back to. atproto’s reference authorization server
refuses the same inputs, so a conformant client never sends another.
The atproto profile’s local form, http://localhost with an optional
query, is different. Its client builds it from its own query, and many
spellings build the same document: http://localhost/?a and
http://localhost?a, parameters in any order, ports in its redirect URIs,
which the profile does not match. So ClientId::parse rewrites every
spelling of one to a single one: http://localhost/?, then each
redirect_uri without its port, sorted, then one scope with its atoms
sorted. A parameter the profile does not define is refused. A local id
with no redirect_uri or no scope is spelled with the profile’s
defaults.
Tuple Fields§
§0: StringImplementations§
Source§impl ClientId
impl ClientId
Sourcepub fn parse(raw: &str) -> Result<Self, ClientIdError>
pub fn parse(raw: &str) -> Result<Self, ClientIdError>
Accepts raw if it is a client_id in canonical form, and rewrites
a local one into its canonical form.
§Errors
Any spelling other than the canonical one, and any URL carrying
credentials, a fragment, or no usable host. A local one carrying a
parameter the profile does not define. See ClientIdError.
Trait Implementations§
impl Eq for ClientId
impl StructuralPartialEq for ClientId
Auto Trait Implementations§
impl Freeze for ClientId
impl RefUnwindSafe for ClientId
impl Send for ClientId
impl Sync for ClientId
impl Unpin for ClientId
impl UnsafeUnpin for ClientId
impl UnwindSafe for ClientId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.