pub struct AuthorizationService<R, G>{ /* private fields */ }Expand description
Service that evaluates an AccessPolicy against an Account.
This is the runtime piece of the authorization model in webgates-core.
You define the rule with AccessPolicy, then ask AuthorizationService
whether a specific account satisfies it.
Implementations§
Source§impl<R, G> AuthorizationService<R, G>
impl<R, G> AuthorizationService<R, G>
Sourcepub fn new(policy: AccessPolicy<R, G>) -> Self
pub fn new(policy: AccessPolicy<R, G>) -> Self
Creates a new authorization service for the provided policy.
Returns true when the account satisfies the policy.
Policies use OR semantics across requirement categories:
- exact role matches
- role hierarchy matches
- group membership matches
- permission matches
Sourcepub fn meets_role_requirement(&self, account: &Account<R, G>) -> bool
pub fn meets_role_requirement(&self, account: &Account<R, G>) -> bool
Returns true when the account has any exactly required role.
Sourcepub fn meets_role_hierarchy_requirement(&self, account: &Account<R, G>) -> bool
pub fn meets_role_hierarchy_requirement(&self, account: &Account<R, G>) -> bool
Returns true when the account has any role that satisfies a
same-or-supervisor requirement.
Ordering contract: higher privilege is greater than lower privilege, so
a supervising role satisfies user_role >= required_role.
Sourcepub fn meets_group_requirement(&self, account: &Account<R, G>) -> bool
pub fn meets_group_requirement(&self, account: &Account<R, G>) -> bool
Returns true when the account belongs to any required group.
Sourcepub fn meets_permission_requirement(&self, account: &Account<R, G>) -> bool
pub fn meets_permission_requirement(&self, account: &Account<R, G>) -> bool
Returns true when the account has any required permission.
Sourcepub fn policy_denies_all_access(&self) -> bool
pub fn policy_denies_all_access(&self) -> bool
Returns true when the configured policy has no requirements.
Such a policy denies all access.
Sourcepub fn clone_policy(&self) -> AccessPolicy<R, G>
pub fn clone_policy(&self) -> AccessPolicy<R, G>
Returns a clone of the configured policy.
Trait Implementations§
Source§impl<R, G> Clone for AuthorizationService<R, G>
impl<R, G> Clone for AuthorizationService<R, G>
Source§fn clone(&self) -> AuthorizationService<R, G>
fn clone(&self) -> AuthorizationService<R, G>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more