| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 syntax = "proto3"; | 5 syntax = "proto3"; |
| 6 | 6 |
| 7 package tokenserver.admin; | 7 package tokenserver.admin; |
| 8 | 8 |
| 9 | 9 |
| 10 // TokenServerConfig is read from tokenserver.cfg in luci-config. | 10 // TokenServerConfig is read from tokenserver.cfg in luci-config. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // * 'audience' is a subset of 'allowed_audience' set. | 84 // * 'audience' is a subset of 'allowed_audience' set. |
| 85 // * 'services' is a subset of 'target_service' set. | 85 // * 'services' is a subset of 'target_service' set. |
| 86 // | 86 // |
| 87 // The presence of a matching rule permits to mint the token. The rule also | 87 // The presence of a matching rule permits to mint the token. The rule also |
| 88 // provides an upper bound on allowed validity_duration, and the rule's name | 88 // provides an upper bound on allowed validity_duration, and the rule's name |
| 89 // is logged in the audit trail. | 89 // is logged in the audit trail. |
| 90 message DelegationRule { | 90 message DelegationRule { |
| 91 // A descriptive name of this rule, for the audit log. | 91 // A descriptive name of this rule, for the audit log. |
| 92 string name = 1; | 92 string name = 1; |
| 93 | 93 |
| 94 // Email of developers that added this rule, to know who to contact. | 94 // Email of developers that own this rule, to know who to contact. |
| 95 repeated string owner = 2; | 95 repeated string owner = 2; |
| 96 | 96 |
| 97 // A set of callers to which this rule applies. | 97 // A set of callers to which this rule applies. |
| 98 // | 98 // |
| 99 // Matched against verified credentials of a caller of MintDelegationToken. | 99 // Matched against verified credentials of a caller of MintDelegationToken. |
| 100 // | 100 // |
| 101 // Each element is either: | 101 // Each element is either: |
| 102 // * An identity string ("user:<email>"). | 102 // * An identity string ("user:<email>"). |
| 103 // * A group reference ("group:<name>"). | 103 // * A group reference ("group:<name>"). |
| 104 // | 104 // |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // | 158 // |
| 159 // Default is 12 hours. | 159 // Default is 12 hours. |
| 160 int64 max_validity_duration = 7; | 160 int64 max_validity_duration = 7; |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 // ServiceAccountsPermissions is read from service_accounts.cfg in luci-config. | 164 // ServiceAccountsPermissions is read from service_accounts.cfg in luci-config. |
| 165 message ServiceAccountsPermissions { | 165 message ServiceAccountsPermissions { |
| 166 // Rules specify how MintOAuthTokenViaGrant can be used. | 166 // Rules specify how MintOAuthTokenViaGrant can be used. |
| 167 // | 167 // |
| 168 // Rules are evaluated independently. One and only one rule should match the | 168 // Rules define a mapping {service account email -> authorization config}, |
| 169 // request to allow the operation. If none rules or more than one rule match, | 169 // where 'service account email' is matched to 'service_account' field of |
| 170 // the request will be denied. | 170 // ServiceAccountRule, and 'authorization config' is the rest of fields in |
| 171 // ServiceAccountRule that define how exactly the given service account is |
| 172 // allowed to be used. |
| 171 // | 173 // |
| 172 // See ServiceAccountRule comments for more details. | 174 // See ServiceAccountRule comments for more details. |
| 173 repeated ServiceAccountRule rules = 1; | 175 repeated ServiceAccountRule rules = 1; |
| 174 } | 176 } |
| 175 | 177 |
| 176 | 178 |
| 177 // ServiceAccountRule describes a single allowed case of using service accounts. | 179 // ServiceAccountRule describes a single allowed case of using service accounts. |
| 178 // | 180 // |
| 179 // TODO(vadimsh): Implement. | 181 // The usage of a service account is initiated by an end user, through some |
| 182 // "proxy" service. For example, when a user posts a Swarming task that uses |
| 183 // a service account, the end user is whoever posts the task, and the proxy is |
| 184 // Swarming service itself. |
| 185 // |
| 186 // This rule specifies which end users are allowed to act as an account, and |
| 187 // through which proxies. |
| 180 message ServiceAccountRule { | 188 message ServiceAccountRule { |
| 181 // A descriptive name of this rule, for the audit log. | 189 // A descriptive name of this rule, for the audit log. |
| 182 string name = 1; | 190 string name = 1; |
| 183 | 191 |
| 184 // Email of developers that owns this rule, to know who to contact. | 192 // Email of developers that own this rule, to know who to contact. |
| 185 repeated string owner = 2; | 193 repeated string owner = 2; |
| 194 |
| 195 // Email of service accounts that this rule applies to. |
| 196 // |
| 197 // This is the "primary key" in the rules table: there can be only one rule |
| 198 // that applies to a given service account. |
| 199 repeated string service_account = 3; |
| 200 |
| 201 // OAuth scopes we allow to be granted to the OAuth token. |
| 202 // |
| 203 // Any subset of given scopes is allowed. This field is evaluated in |
| 204 // MintOAuthTokenViaGrant RPC handler, right before generating the OAuth |
| 205 // token. |
| 206 repeated string allowed_scope = 4; |
| 207 |
| 208 // A set of identities that are allowed to act as the service account (perhaps |
| 209 // indirectly through some other intermediary "proxy" service like Swarming). |
| 210 // |
| 211 // Users listed here are ultimately able to grab an OAuth token belonging to |
| 212 // the service account. |
| 213 // |
| 214 // Each element is either: |
| 215 // * An identity string ("user:<email>"). |
| 216 // * A group reference ("group:<name>"). |
| 217 repeated string end_user = 5; |
| 218 |
| 219 // A set of identities that are allowed to act on behalf of end users when |
| 220 // grabbing an OAuth token for the service account. |
| 221 // |
| 222 // These identities represent "proxy" services that do something with service |
| 223 // accounts on behalf of end users. Only identities in this set are allowed |
| 224 // to perform MintOAuthTokenGrant RPC. |
| 225 // |
| 226 // Each element is either: |
| 227 // * An identity string ("user:<email>"). |
| 228 // * A group reference ("group:<name>"). |
| 229 repeated string proxy = 6; |
| 230 |
| 231 // Maximum allowed validity duration (sec) of OAuth token grants. |
| 232 // |
| 233 // The grant is minted by MintOAuthTokenGrant RPC (called, for example, when |
| 234 // Swarming task is posted), and checked by MintOAuthTokenViaGrant RPC (called |
| 235 // when the task actually runs). So the allowed validity duration should |
| 236 // account for possible queuing delays. |
| 237 // |
| 238 // This duration has no relation to the OAuth token lifetime. The OAuth token |
| 239 // produced by MintOAuthTokenViaGrant can always live up to 1h regardless of |
| 240 // validity duration of the grant. |
| 241 // |
| 242 // Default is 24 hours. |
| 243 int64 max_grant_validity_duration = 7; |
| 186 } | 244 } |
| OLD | NEW |