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).
Corresponds to org.apache.kafka.common.security.auth.KafkaPrincipal.
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).
Mirrors new KafkaPrincipal(principalType, 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.
Mirrors new KafkaPrincipal(principalType, name, tokenAuthenticated).
Sourcepub fn anonymous() -> Self
pub fn anonymous() -> Self
The anonymous principal (User:ANONYMOUS).
Mirrors KafkaPrincipal.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.
Mirrors KafkaPrincipal.getPrincipalType.
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.
Mirrors KafkaPrincipal.tokenAuthenticated(boolean).
Sourcepub fn token_authenticated(&self) -> bool
pub fn token_authenticated(&self) -> bool
Whether the principal was authenticated with a delegation token.
Mirrors KafkaPrincipal.tokenAuthenticated().
Trait Implementations§
Source§impl Clone for KafkaPrincipal
impl Clone for KafkaPrincipal
Source§fn clone(&self) -> KafkaPrincipal
fn clone(&self) -> KafkaPrincipal
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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
§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
key and return true if they are equal.