pub trait AuthProvider {
type Config;
// Required methods
fn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: '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;
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 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 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 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 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;
// Provided methods
fn auth_index_fetch<'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: Sync + '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,
crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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: Sync + '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: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn token_from_headers<'h>(
&self,
headers: &'h HeaderMap,
) -> Result<Option<&'h str>, StatusCode> { ... }
}
Required Associated Types§
Required Methods§
fn healthcheck<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
If the crate has never been published before to the registry, the user should be given ownership of the new crate.
Sourcefn 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.
Provided Methods§
Sourcefn auth_index_fetch<'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: Sync + '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,
crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: Sync + '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.
This is currently only meaningful for registries which rely on experimental cargo features to auth any access to the registry.
Sourcefn auth_crate_download<'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: Sync + '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,
crate_name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Verify that a user is allowed to download a given crate.
This is currently only meaningful for registries which rely on experimental cargo features to auth any access to the registry.
Sourcefn auth_view_full_index<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: Sync + '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: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify that a user is allowed to view the full index.
This is used for both searching the index and listing all crates.
This is currently only meaningful for registries which rely on experimental cargo features to auth any access to the registry.
Sourcefn auth_config<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: Sync + '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: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch of config.json. Called only if the server is configured to do so.
fn token_from_headers<'h>( &self, headers: &'h HeaderMap, ) -> Result<Option<&'h str>, StatusCode>
Implementors§
Source§impl AuthProvider for CfAuthProvider
Available on crate feature cf-backend
only.
impl AuthProvider for CfAuthProvider
cf-backend
only.Source§impl AuthProvider for FsAuthProvider
Available on crate feature fs-backend
only.
impl AuthProvider for FsAuthProvider
fs-backend
only.Source§impl AuthProvider for NoAuthProvider
Used as fallback to avoid compile error when no backend is configured
impl AuthProvider for NoAuthProvider
Used as fallback to avoid compile error when no backend is configured
Source§impl AuthProvider for PgAuthProvider
Available on crate feature pg-backend
only.
impl AuthProvider for PgAuthProvider
pg-backend
only.Source§impl AuthProvider for YesAuthProvider
Available on crate feature yes-backend
only.
impl AuthProvider for YesAuthProvider
yes-backend
only.