access_level.proto 8.2 KB

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