pub struct CfAuthProvider { /* private fields */ }
Available on crate feature
cf-backend
only.Expand description
Registry auth based on Cloudflare Access, using JsonWebTokens for auth
It’s not possible to validate Service Auth tokens direclty. To use a token, you need to log in with it to an Access-protected URL, and obtain the JWT from the CF_Authorization cookie. This temporary cookie is the only way auth with this Freighter backend.
For personal account, you can call cloudflared access token
to obtain the JWT.
Implementations§
Source§impl CfAuthProvider
impl CfAuthProvider
pub fn new(config: Config) -> AuthResult<Self>
Trait Implementations§
Source§impl AuthProvider for CfAuthProvider
impl AuthProvider for CfAuthProvider
Source§fn auth_config<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn auth_config<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch of config.json.
type Config = Config
fn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Register a new user, returning a token if successful.
Source§fn list_owners<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<ListedOwner>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_owners<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<ListedOwner>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
List the owners of a crate.
Source§fn add_owners<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
token: &'life1 str,
_users: &'life2 [&'life3 str],
_crate_name: &'life4 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn add_owners<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
token: &'life1 str,
_users: &'life2 [&'life3 str],
_crate_name: &'life4 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Add a new owner to a crate.
Source§fn remove_owners<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
token: &'life1 str,
_users: &'life2 [&'life3 str],
_crate_name: &'life4 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn remove_owners<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
token: &'life1 str,
_users: &'life2 [&'life3 str],
_crate_name: &'life4 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Remove an owner from a crate.
Source§fn publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify that a user has permission to publish new versions of a crate. Read more
Source§fn auth_yank<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_yank<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify that a user has permission to yank or unyank versions of a crate.
Source§fn auth_index_fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_all_users_can_read_crates: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_index_fetch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_all_users_can_read_crates: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify that a user is allowed to look at the index entry for a given crate. Read more
Source§fn auth_crate_download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_all_users_can_read_crates: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_crate_download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
_all_users_can_read_crates: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify that a user is allowed to download a given crate. Read more
Source§fn auth_view_full_index<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn auth_view_full_index<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify that a user is allowed to view the full index. Read more
fn token_from_headers<'h>( &self, headers: &'h HeaderMap, ) -> Result<Option<&'h str>, StatusCode>
Auto Trait Implementations§
impl !Freeze for CfAuthProvider
impl !RefUnwindSafe for CfAuthProvider
impl Send for CfAuthProvider
impl Sync for CfAuthProvider
impl Unpin for CfAuthProvider
impl UnwindSafe for CfAuthProvider
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