Documentation
¶
Overview ¶
Package authz 提供授权判定(PDP)能力。
Index ¶
- type Client
- func (c *Client) Allow(ctx context.Context, subject, domain, object, action string) (bool, error)
- func (c *Client) Check(ctx context.Context, req *authzv1.CheckRequest) (*authzv1.CheckResponse, error)
- func (c *Client) GetAuthorizationSnapshot(ctx context.Context, req *authzv1.GetAuthorizationSnapshotRequest) (*authzv1.GetAuthorizationSnapshotResponse, error)
- func (c *Client) GrantAssignment(ctx context.Context, req *authzv1.GrantAssignmentRequest) (*authzv1.GrantAssignmentResponse, error)
- func (c *Client) Raw() authzv1.AuthorizationServiceClient
- func (c *Client) RevokeAssignment(ctx context.Context, req *authzv1.RevokeAssignmentRequest) (*authzv1.RevokeAssignmentResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 授权服务客户端。
func NewClient ¶
func NewClient(authorizationService authzv1.AuthorizationServiceClient) *Client
NewClient 创建授权服务客户端。
func (*Client) Check ¶
func (c *Client) Check(ctx context.Context, req *authzv1.CheckRequest) (*authzv1.CheckResponse, error)
Check 对单条 (subject, domain, object, action) 执行授权判定。
func (*Client) GetAuthorizationSnapshot ¶
func (c *Client) GetAuthorizationSnapshot(ctx context.Context, req *authzv1.GetAuthorizationSnapshotRequest) (*authzv1.GetAuthorizationSnapshotResponse, error)
GetAuthorizationSnapshot 获取主体在指定租户/应用下的授权快照。
func (*Client) GrantAssignment ¶
func (c *Client) GrantAssignment(ctx context.Context, req *authzv1.GrantAssignmentRequest) (*authzv1.GrantAssignmentResponse, error)
GrantAssignment 为主体授予角色。
func (*Client) Raw ¶
func (c *Client) Raw() authzv1.AuthorizationServiceClient
Raw 返回原始 AuthorizationService gRPC 客户端。
func (*Client) RevokeAssignment ¶
func (c *Client) RevokeAssignment(ctx context.Context, req *authzv1.RevokeAssignmentRequest) (*authzv1.RevokeAssignmentResponse, error)
RevokeAssignment 撤销主体上的角色。
Click to show internal directories.
Click to hide internal directories.