-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tls and authorization on SPU mirroring (#4022)
* feat: tls and authorization on SPU mirroring * test: add util function to create public server with root auth
- Loading branch information
Showing
18 changed files
with
318 additions
and
152 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
mod policy; | ||
mod error; | ||
|
||
pub mod root; | ||
pub mod x509; | ||
|
||
pub use policy::*; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use async_trait::async_trait; | ||
use fluvio_controlplane_metadata::extended::ObjectType; | ||
use fluvio_socket::FluvioSocket; | ||
|
||
use crate::{AuthContext, AuthError, Authorization, InstanceAction, TypeAction}; | ||
|
||
/// Authorization that allows anything | ||
#[derive(Debug, Clone, Default)] | ||
pub struct RootAuthorization {} | ||
|
||
#[async_trait] | ||
impl Authorization for RootAuthorization { | ||
type Context = RootAuthContext; | ||
|
||
async fn create_auth_context( | ||
&self, | ||
_socket: &mut FluvioSocket, | ||
) -> Result<Self::Context, AuthError> { | ||
Ok(RootAuthContext {}) | ||
} | ||
} | ||
|
||
impl RootAuthorization { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct RootAuthContext {} | ||
|
||
#[async_trait] | ||
impl AuthContext for RootAuthContext { | ||
async fn allow_type_action( | ||
&self, | ||
_ty: ObjectType, | ||
_action: TypeAction, | ||
) -> Result<bool, AuthError> { | ||
Ok(true) | ||
} | ||
|
||
/// check if specific instance of spec can be deleted | ||
async fn allow_instance_action( | ||
&self, | ||
_ty: ObjectType, | ||
_action: InstanceAction, | ||
_key: &str, | ||
) -> Result<bool, AuthError> { | ||
Ok(true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.