| 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 import "google/protobuf/empty.proto"; | 9 import "google/protobuf/empty.proto"; |
| 10 | 10 |
| 11 import "github.com/luci/luci-go/server/auth/delegation/messages/delegation.proto
"; | 11 import "github.com/luci/luci-go/server/auth/delegation/messages/delegation.proto
"; |
| 12 import "github.com/luci/luci-go/tokenserver/api/machine_token.proto"; | 12 import "github.com/luci/luci-go/tokenserver/api/machine_token.proto"; |
| 13 import "github.com/luci/luci-go/tokenserver/api/oauth_token_grant.proto"; |
| 13 | 14 |
| 14 | 15 |
| 15 // Admin service is used by service administrators to manage the server. | 16 // Admin service is used by service administrators to manage the server. |
| 16 service Admin { | 17 service Admin { |
| 17 // ImportCAConfigs makes the server read CA configs from luci-config. | 18 // ImportCAConfigs makes the server read 'tokenserver.cfg'. |
| 18 // | |
| 19 // This reads 'tokenserver.cfg' file. | |
| 20 // | |
| 21 // Note that regularly configs are read in background each 5 min. | |
| 22 // ImportCAConfigs can be used to force config reread immediately. It will | |
| 23 // block until the configs are read. | |
| 24 rpc ImportCAConfigs(google.protobuf.Empty) returns (ImportedConfigs); | 19 rpc ImportCAConfigs(google.protobuf.Empty) returns (ImportedConfigs); |
| 25 | 20 |
| 26 // ImportDelegationConfigs makes the server read 'delegation.cfg' config. | 21 // ImportDelegationConfigs makes the server read 'delegation.cfg'. |
| 27 // | |
| 28 // Note that regularly configs are read in background each 5 min. | |
| 29 // ImportDelegationConfigs can be used to force config reread immediately. It | |
| 30 // will block until the configs are read. | |
| 31 rpc ImportDelegationConfigs(google.protobuf.Empty) returns (ImportedConfigs); | 22 rpc ImportDelegationConfigs(google.protobuf.Empty) returns (ImportedConfigs); |
| 32 | 23 |
| 24 // ImportServiceAccountsConfigs makes the server read 'service_accounts.cfg'. |
| 25 rpc ImportServiceAccountsConfigs(google.protobuf.Empty) returns (ImportedConfi
gs); |
| 26 |
| 33 // InspectMachineToken decodes a machine token and verifies it is valid. | 27 // InspectMachineToken decodes a machine token and verifies it is valid. |
| 34 // | 28 // |
| 35 // It verifies the token was signed by a private key of the token server and | 29 // It verifies the token was signed by a private key of the token server and |
| 36 // checks token's expiration time and revocation status. | 30 // checks token's expiration time and revocation status. |
| 37 // | 31 // |
| 38 // It tries to give as much information about the token and its status as | 32 // It tries to give as much information about the token and its status as |
| 39 // possible (e.g. it checks for revocation status even if token is already | 33 // possible (e.g. it checks for revocation status even if token is already |
| 40 // expired). | 34 // expired). |
| 41 // | 35 // |
| 42 // Administrators can use this call to debug issues with tokens. | 36 // Administrators can use this call to debug issues with tokens. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 // possible (e.g. attempts to decode the body even if the signing key has been | 50 // possible (e.g. attempts to decode the body even if the signing key has been |
| 57 // rotated already). | 51 // rotated already). |
| 58 // | 52 // |
| 59 // Administrators can use this call to debug issues with tokens. | 53 // Administrators can use this call to debug issues with tokens. |
| 60 // | 54 // |
| 61 // Returns: | 55 // Returns: |
| 62 // InspectDelegationTokenResponse for tokens of supported kind. | 56 // InspectDelegationTokenResponse for tokens of supported kind. |
| 63 // grpc.InvalidArgument error for unsupported token kind. | 57 // grpc.InvalidArgument error for unsupported token kind. |
| 64 // grpc.Internal error for transient errors. | 58 // grpc.Internal error for transient errors. |
| 65 rpc InspectDelegationToken(InspectDelegationTokenRequest) returns (InspectDele
gationTokenResponse); | 59 rpc InspectDelegationToken(InspectDelegationTokenRequest) returns (InspectDele
gationTokenResponse); |
| 60 |
| 61 // InspectOAuthTokenGrant decodes OAuth token grant and verifies it is valid. |
| 62 // |
| 63 // It verifies the token was signed by a private key of the token server and |
| 64 // checks token's expiration time. |
| 65 // |
| 66 // It tries to give as much information about the token and its status as |
| 67 // possible (e.g. attempts to decode the body even if the signing key has been |
| 68 // rotated already). |
| 69 // |
| 70 // Administrators can use this call to debug issues with tokens. |
| 71 // |
| 72 // Returns: |
| 73 // InspectOAuthTokenGrantResponse for tokens of supported kind. |
| 74 // grpc.InvalidArgument error for unsupported token kind. |
| 75 // grpc.Internal error for transient errors. |
| 76 rpc InspectOAuthTokenGrant(InspectOAuthTokenGrantRequest) returns (InspectOAut
hTokenGrantResponse); |
| 66 } | 77 } |
| 67 | 78 |
| 68 | 79 |
| 69 // ImportedConfigs is returned by Import<something>Configs methods on success. | 80 // ImportedConfigs is returned by Import<something>Configs methods on success. |
| 70 message ImportedConfigs { | 81 message ImportedConfigs { |
| 71 // The revision of the configs that are now in the datastore. | 82 // The revision of the configs that are now in the datastore. |
| 72 // | 83 // |
| 73 // It's either the imported revision, if configs change, or a previously known | 84 // It's either the imported revision, if configs change, or a previously known |
| 74 // revision, if configs at HEAD are same. | 85 // revision, if configs at HEAD are same. |
| 75 string revision = 1; | 86 string revision = 1; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // The deserialized token envelope. | 204 // The deserialized token envelope. |
| 194 // | 205 // |
| 195 // May be empty if token was malformed and couldn't be deserialized. | 206 // May be empty if token was malformed and couldn't be deserialized. |
| 196 messages.DelegationToken envelope = 5; | 207 messages.DelegationToken envelope = 5; |
| 197 | 208 |
| 198 // The deserialized token body (deserialized 'envelope.serialized_subtoken'). | 209 // The deserialized token body (deserialized 'envelope.serialized_subtoken'). |
| 199 // | 210 // |
| 200 // May be empty if token was malformed and couldn't be deserialized. | 211 // May be empty if token was malformed and couldn't be deserialized. |
| 201 messages.Subtoken subtoken = 6; | 212 messages.Subtoken subtoken = 6; |
| 202 } | 213 } |
| 214 |
| 215 |
| 216 // InspectOAuthTokenGrantRequest is body of InspectOAuthTokenGrant RPC call. |
| 217 message InspectOAuthTokenGrantRequest { |
| 218 // The token body. |
| 219 string token = 1; |
| 220 } |
| 221 |
| 222 |
| 223 // InspectOAuthTokenGrantResponse is return value of InspectOAuthTokenGrant RPC. |
| 224 message InspectOAuthTokenGrantResponse { |
| 225 // True if the token is valid. |
| 226 // |
| 227 // A token is valid if its signature is correct and it hasn't expired yet. |
| 228 bool valid = 1; |
| 229 |
| 230 // Human readable summary of why token is invalid. |
| 231 // |
| 232 // Summarizes the rest of the fields of this struct. Set only if 'valid' is |
| 233 // false. |
| 234 string invalidity_reason = 2; |
| 235 |
| 236 // True if the token signature was verified. |
| 237 // |
| 238 // It means the token was generated by the token server and its body is not |
| 239 // a garbage. Note that a token can be correctly signed, but invalid (if it |
| 240 // has expired). |
| 241 // |
| 242 // If 'signed' is false, the fields below may (or may not) be a garbage. |
| 243 // |
| 244 // The token server uses private keys managed by Google Cloud Platform, they |
| 245 // are constantly being rotated and "old" signatures become invalid over time |
| 246 // (when corresponding keys are rotated out of existence). |
| 247 // |
| 248 // If 'signed' is false, use the rest of the response only as FYI, possibly |
| 249 // invalid or even maliciously constructed. |
| 250 bool signed = 3; |
| 251 |
| 252 // True if the token signature was verified and token hasn't expired yet. |
| 253 // |
| 254 // We use "non_" prefix to make default 'false' value safer. |
| 255 bool non_expired = 4; |
| 256 |
| 257 // ID of a token server private key used to sign the token. |
| 258 string signing_key_id = 5; |
| 259 |
| 260 // The deserialized token body. |
| 261 // |
| 262 // May be empty if token was malformed and couldn't be deserialized. |
| 263 tokenserver.OAuthTokenGrantBody token_body = 6; |
| 264 } |
| OLD | NEW |