pub struct GithubAuth { /* private fields */ }Expand description
Bearer auth confined to GitHub’s two content hosts.
crate::StaticTokenAuth::bearer_scoped covers one host, but a GitHub
sync talks to exactly two — the API host for the tree listing and the raw
host for blob content — and the token must reach both while never leaking
anywhere else (a crawled markdown file can link off-host; the fetch of that
link must be anonymous).
Implementations§
Source§impl GithubAuth
impl GithubAuth
Sourcepub fn new(token: Option<String>) -> Self
pub fn new(token: Option<String>) -> Self
Auth for github.com. token = a PAT (works for public, private, and
internal repositories — raw.githubusercontent.com accepts Bearer);
None = anonymous, public repositories only.
Sourcepub fn with_hosts(
self,
api_host: impl Into<CompactString>,
raw_host: impl Into<CompactString>,
) -> Self
pub fn with_hosts( self, api_host: impl Into<CompactString>, raw_host: impl Into<CompactString>, ) -> Self
Override the trusted hosts (GitHub Enterprise).
Trait Implementations§
Source§impl AuthProvider for GithubAuth
impl AuthProvider for GithubAuth
Source§type RefreshFuture<'a> = Ready<Result<(), Error>>
type RefreshFuture<'a> = Ready<Result<(), Error>>
The future returned by
AuthProvider::refresh. Static providers use
std::future::Ready; OAuth uses its token-exchange future.Source§fn credential(&self, resource: &Resource) -> Credential<'_>
fn credential(&self, resource: &Resource) -> Credential<'_>
The credential to apply to a request for
resource. Synchronous and
lock-free — this is the per-fetch hot path.Source§fn refresh(&self) -> Self::RefreshFuture<'_>
fn refresh(&self) -> Self::RefreshFuture<'_>
Refresh an expiring credential. Static providers return a ready no-op.
Source§fn needs_refresh(&self) -> bool
fn needs_refresh(&self) -> bool
Whether the cached credential is missing or near expiry. Default: never.
Auto Trait Implementations§
impl Freeze for GithubAuth
impl RefUnwindSafe for GithubAuth
impl Send for GithubAuth
impl Sync for GithubAuth
impl Unpin for GithubAuth
impl UnsafeUnpin for GithubAuth
impl UnwindSafe for GithubAuth
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<A> DynAuthProvider for Awhere
A: AuthProvider,
impl<A> DynAuthProvider for Awhere
A: AuthProvider,
Source§fn credential(&self, resource: &Resource) -> Credential<'_>
fn credential(&self, resource: &Resource) -> Credential<'_>
Source§fn needs_refresh(&self) -> bool
fn needs_refresh(&self) -> bool
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more