pub struct KafkaPrincipal { /* private fields */ }Expand description
Principals in Kafka are defined by a type and a name.
The principal type will always be "User" for the simple authorizer that is
enabled by default, but custom authorizers can leverage different principal
types (such as to enable group or role-based ACLs).
Implementations§
Source§impl KafkaPrincipal
impl KafkaPrincipal
Sourcepub fn new(principal_type: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(principal_type: impl Into<String>, name: impl Into<String>) -> Self
Creates a new principal from a type and name (not token-authenticated).
§Arguments
principal_type- the principal type, such asSelf::USER_TYPEname- the principal name
Sourcepub fn with_token_authenticated(
principal_type: impl Into<String>,
name: impl Into<String>,
token_authenticated: bool,
) -> Self
pub fn with_token_authenticated( principal_type: impl Into<String>, name: impl Into<String>, token_authenticated: bool, ) -> Self
Creates a new principal from a type, name, and token-authenticated flag.
§Arguments
principal_type- the principal type, such asSelf::USER_TYPEname- the principal nametoken_authenticated- whether the principal was authenticated with a delegation token
Sourcepub fn anonymous() -> Self
pub fn anonymous() -> Self
The anonymous principal (User:ANONYMOUS).
Modeled as a function rather than a
constant because the name is an owned String.
Sourcepub fn principal_type(&self) -> &str
pub fn principal_type(&self) -> &str
Returns the principal type.
Sourcepub fn set_token_authenticated(&mut self, token_authenticated: bool)
pub fn set_token_authenticated(&mut self, token_authenticated: bool)
Sets whether the principal was authenticated with a delegation token.
§Arguments
token_authenticated- whether the principal was authenticated with a delegation token
Sourcepub fn token_authenticated(&self) -> bool
pub fn token_authenticated(&self) -> bool
Returns whether the principal was authenticated with a delegation token.
Trait Implementations§
Source§impl Clone for KafkaPrincipal
impl Clone for KafkaPrincipal
Source§fn clone(&self) -> KafkaPrincipal
fn clone(&self) -> KafkaPrincipal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KafkaPrincipal
impl Debug for KafkaPrincipal
Source§impl Display for KafkaPrincipal
impl Display for KafkaPrincipal
Source§impl Hash for KafkaPrincipal
impl Hash for KafkaPrincipal
Source§impl PartialEq for KafkaPrincipal
impl PartialEq for KafkaPrincipal
impl Eq for KafkaPrincipal
Auto Trait Implementations§
impl Freeze for KafkaPrincipal
impl RefUnwindSafe for KafkaPrincipal
impl Send for KafkaPrincipal
impl Sync for KafkaPrincipal
impl Unpin for KafkaPrincipal
impl UnsafeUnpin for KafkaPrincipal
impl UnwindSafe for KafkaPrincipal
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
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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
key and return true if they are equal.§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
Checks if this value is equivalent to the given key. Read more