access_level.proto 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.identity.accesscontextmanager.v1;
  16. import "google/api/resource.proto";
  17. import "google/identity/accesscontextmanager/type/device_resources.proto";
  18. import "google/protobuf/timestamp.proto";
  19. import "google/type/expr.proto";
  20. import "google/api/annotations.proto";
  21. option csharp_namespace = "Google.Identity.AccessContextManager.V1";
  22. option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "AccessLevelProto";
  25. option java_package = "com.google.identity.accesscontextmanager.v1";
  26. option objc_class_prefix = "GACM";
  27. option php_namespace = "Google\\Identity\\AccessContextManager\\V1";
  28. option ruby_package = "Google::Identity::AccessContextManager::V1";
  29. // An `AccessLevel` is a label that can be applied to requests to Google Cloud
  30. // services, along with a list of requirements necessary for the label to be
  31. // applied.
  32. message AccessLevel {
  33. option (google.api.resource) = {
  34. type: "accesscontextmanager.googleapis.com/AccessLevel"
  35. pattern: "accessPolicies/{access_policy}/accessLevels/{access_level}"
  36. };
  37. // Required. Resource name for the Access Level. The `short_name` component
  38. // must begin with a letter and only include alphanumeric and '_'. Format:
  39. // `accessPolicies/{access_policy}/accessLevels/{access_level}`. The maximum
  40. // length of the `access_level` component is 50 characters.
  41. string name = 1;
  42. // Human readable title. Must be unique within the Policy.
  43. string title = 2;
  44. // Description of the `AccessLevel` and its use. Does not affect behavior.
  45. string description = 3;
  46. // Required. Describes the necessary conditions for the level to apply.
  47. oneof level {
  48. // A `BasicLevel` composed of `Conditions`.
  49. BasicLevel basic = 4;
  50. // A `CustomLevel` written in the Common Expression Language.
  51. CustomLevel custom = 5;
  52. }
  53. // Output only. Time the `AccessLevel` was created in UTC.
  54. google.protobuf.Timestamp create_time = 6;
  55. // Output only. Time the `AccessLevel` was updated in UTC.
  56. google.protobuf.Timestamp update_time = 7;
  57. }
  58. // `BasicLevel` is an `AccessLevel` using a set of recommended features.
  59. message BasicLevel {
  60. // Options for how the `conditions` list should be combined to determine if
  61. // this `AccessLevel` is applied. Default is AND.
  62. enum ConditionCombiningFunction {
  63. // All `Conditions` must be true for the `BasicLevel` to be true.
  64. AND = 0;
  65. // If at least one `Condition` is true, then the `BasicLevel` is true.
  66. OR = 1;
  67. }
  68. // Required. A list of requirements for the `AccessLevel` to be granted.
  69. repeated Condition conditions = 1;
  70. // How the `conditions` list should be combined to determine if a request is
  71. // granted this `AccessLevel`. If AND is used, each `Condition` in
  72. // `conditions` must be satisfied for the `AccessLevel` to be applied. If OR
  73. // is used, at least one `Condition` in `conditions` must be satisfied for the
  74. // `AccessLevel` to be applied. Default behavior is AND.
  75. ConditionCombiningFunction combining_function = 2;
  76. }
  77. // A condition necessary for an `AccessLevel` to be granted. The Condition is an
  78. // AND over its fields. So a Condition is true if: 1) the request IP is from one
  79. // of the listed subnetworks AND 2) the originating device complies with the
  80. // listed device policy AND 3) all listed access levels are granted AND 4) the
  81. // request was sent at a time allowed by the DateTimeRestriction.
  82. message Condition {
  83. // CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for
  84. // a CIDR IP address block, the specified IP address portion must be properly
  85. // truncated (i.e. all the host bits must be zero) or the input is considered
  86. // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is
  87. // not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas
  88. // "2001:db8::1/32" is not. The originating IP of a request must be in one of
  89. // the listed subnets in order for this Condition to be true. If empty, all IP
  90. // addresses are allowed.
  91. repeated string ip_subnetworks = 1;
  92. // Device specific restrictions, all restrictions must hold for the
  93. // Condition to be true. If not specified, all devices are allowed.
  94. DevicePolicy device_policy = 2;
  95. // A list of other access levels defined in the same `Policy`, referenced by
  96. // resource name. Referencing an `AccessLevel` which does not exist is an
  97. // error. All access levels listed must be granted for the Condition
  98. // to be true. Example:
  99. // "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"`
  100. repeated string required_access_levels = 3;
  101. // Whether to negate the Condition. If true, the Condition becomes a NAND over
  102. // its non-empty fields, each field must be false for the Condition overall to
  103. // be satisfied. Defaults to false.
  104. bool negate = 5;
  105. // The request must be made by one of the provided user or service
  106. // accounts. Groups are not supported.
  107. // Syntax:
  108. // `user:{emailid}`
  109. // `serviceAccount:{emailid}`
  110. // If not specified, a request may come from any user.
  111. repeated string members = 6;
  112. // The request must originate from one of the provided countries/regions.
  113. // Must be valid ISO 3166-1 alpha-2 codes.
  114. repeated string regions = 7;
  115. }
  116. // `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language
  117. // to represent the necessary conditions for the level to apply to a request.
  118. // See CEL spec at: https://github.com/google/cel-spec
  119. message CustomLevel {
  120. // Required. A Cloud CEL expression evaluating to a boolean.
  121. google.type.Expr expr = 1;
  122. }
  123. // `DevicePolicy` specifies device specific restrictions necessary to acquire a
  124. // given access level. A `DevicePolicy` specifies requirements for requests from
  125. // devices to be granted access levels, it does not do any enforcement on the
  126. // device. `DevicePolicy` acts as an AND over all specified fields, and each
  127. // repeated field is an OR over its elements. Any unset fields are ignored. For
  128. // example, if the proto is { os_type : DESKTOP_WINDOWS, os_type :
  129. // DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be
  130. // true for requests originating from encrypted Linux desktops and encrypted
  131. // Windows desktops.
  132. message DevicePolicy {
  133. // Whether or not screenlock is required for the DevicePolicy to be true.
  134. // Defaults to `false`.
  135. bool require_screenlock = 1;
  136. // Allowed encryptions statuses, an empty list allows all statuses.
  137. repeated google.identity.accesscontextmanager.type.DeviceEncryptionStatus allowed_encryption_statuses = 2;
  138. // Allowed OS versions, an empty list allows all types and all versions.
  139. repeated OsConstraint os_constraints = 3;
  140. // Allowed device management levels, an empty list allows all management
  141. // levels.
  142. repeated google.identity.accesscontextmanager.type.DeviceManagementLevel allowed_device_management_levels = 6;
  143. // Whether the device needs to be approved by the customer admin.
  144. bool require_admin_approval = 7;
  145. // Whether the device needs to be corp owned.
  146. bool require_corp_owned = 8;
  147. }
  148. // A restriction on the OS type and version of devices making requests.
  149. message OsConstraint {
  150. // Required. The allowed OS type.
  151. google.identity.accesscontextmanager.type.OsType os_type = 1;
  152. // The minimum allowed OS version. If not set, any version of this OS
  153. // satisfies the constraint. Format: `"major.minor.patch"`.
  154. // Examples: `"10.5.301"`, `"9.2.1"`.
  155. string minimum_version = 2;
  156. // Only allows requests from devices with a verified Chrome OS.
  157. // Verifications includes requirements that the device is enterprise-managed,
  158. // conformant to domain policies, and the caller has permission to call
  159. // the API targeted by the request.
  160. bool require_verified_chrome_os = 3;
  161. }