-
Notifications
You must be signed in to change notification settings - Fork 749
api: Authorization API design #2652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
50c998e
add authorisation api spec
zetaab 9c55f24
add comments
zhaohuabing 9e13737
Remove permission in the first run
zhaohuabing bbd2999
Move subject and permission to Rule
zhaohuabing a7c0006
remove log action
zhaohuabing 6ab725c
add default action
zhaohuabing 6345f7b
add excluded client CIDR
zhaohuabing 7cf916d
hide api
zhaohuabing 03707b3
minor wording
zhaohuabing 0643397
remove exclude ip range in the first run
zhaohuabing 2335a92
change subject to principal: align with Envoy and the AWS RBAC term
zhaohuabing 3293ec2
add Name field to a Rule
zhaohuabing f84a49c
remove name field for now
zhaohuabing 1f8bd80
Update api/v1alpha1/authorization_types.go
zhaohuabing d7fbe4e
fix docs
zhaohuabing 882a52c
minor wording
zhaohuabing 387951b
fix lint
zhaohuabing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,65 @@ | ||
| // Copyright Envoy Gateway Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // The full text of the Apache license is available in the LICENSE file at | ||
| // the root of the repo. | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| // Authorization defines the authorization configuration. | ||
| // +notImplementedHide | ||
| type Authorization struct { | ||
| // Rules defines a list of authorization rules. | ||
| // These rules are evaluated in order, the first matching rule will be applied, | ||
| // and the rest will be skipped. | ||
| // | ||
|
zhaohuabing marked this conversation as resolved.
|
||
| // For example, if there are two rules: the first rule allows the request | ||
| // and the second rule denies it, when a request matches both rules, it will be allowed. | ||
| // | ||
| // +optional | ||
| Rules []Rule `json:"rules,omitempty"` | ||
|
|
||
| // DefaultAction defines the default action to be taken if no rules match. | ||
| // If not specified, the default action is Deny. | ||
| // +optional | ||
| DefaultAction *RuleActionType `json:"defaultAction"` | ||
|
zhaohuabing marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // Rule defines the single authorization rule. | ||
| // +notImplementedHide | ||
| type Rule struct { | ||
| // Action defines the action to be taken if the rule matches. | ||
| Action RuleActionType `json:"action"` | ||
|
|
||
| // Principal specifies the client identity of a request. | ||
| Principal Principal `json:"principal"` | ||
|
|
||
| // Permissions contains allowed HTTP methods. | ||
| // If empty, all methods are matching. | ||
| // | ||
| // +optional | ||
| // Permissions []string `json:"permissions,omitempty"` | ||
|
Comment on lines
+36
to
+40
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why this pass limiter, prefer to remove instead of commnet. |
||
| } | ||
|
|
||
| // Principal specifies the client identity of a request. | ||
| // +notImplementedHide | ||
| type Principal struct { | ||
| // ClientCIDR is the IP CIDR range of the client. | ||
| // Valid examples are "192.168.1.0/24" or "2001:db8::/64" | ||
| // | ||
| // By default, the client IP is inferred from the x-forwarder-for header and proxy protocol. | ||
| // You can use the `EnableProxyProtocol` and `ClientIPDetection` options in | ||
| // the `ClientTrafficPolicy` to configure how the client IP is detected. | ||
| ClientCIDR []string `json:"clientCIDR,omitempty"` | ||
| } | ||
|
|
||
| // RuleActionType specifies the types of authorization rule action. | ||
| // +kubebuilder:validation:Enum=Allow;Deny | ||
| // +notImplementedHide | ||
| type RuleActionType string | ||
|
|
||
| const ( | ||
| // Allow is the action to allow the request. | ||
| Allow RuleActionType = "Allow" | ||
| // Deny is the action to deny the request. | ||
| Deny RuleActionType = "Deny" | ||
| ) | ||
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.