forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: Authorization API design (envoyproxy#2652)
* add authorisation api spec Signed-off-by: Jesse Haka <haka.jesse@gmail.com> * add comments Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * Remove permission in the first run Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * Move subject and permission to Rule Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * remove log action Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * add default action Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * add excluded client CIDR Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * hide api Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * minor wording Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * remove exclude ip range in the first run Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * change subject to principal: align with Envoy and the AWS RBAC term Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * add Name field to a Rule Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * remove name field for now Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * Update api/v1alpha1/authorization_types.go Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com> Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com> * fix docs Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * minor wording Signed-off-by: huabing zhao <zhaohuabing@gmail.com> * fix lint Signed-off-by: huabing zhao <zhaohuabing@gmail.com> --------- Signed-off-by: Jesse Haka <haka.jesse@gmail.com> Signed-off-by: huabing zhao <zhaohuabing@gmail.com> Signed-off-by: Huabing Zhao <zhaohuabing@gmail.com> Co-authored-by: huabing zhao <zhaohuabing@gmail.com> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
- Loading branch information
1 parent
c30d09f
commit 3bc7cf1
Showing
7 changed files
with
255 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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. | ||
// | ||
// 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"` | ||
} | ||
|
||
// 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"` | ||
} | ||
|
||
// 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 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 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 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 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 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