Chromium Code Reviews| 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. | |
|
Vadim Sh.
2017/03/30 06:04:48
Read token_minter.proto and oauth_token_grant.prot
| |
| 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 ImportCAConfigs methods on success. | 80 // ImportedConfigs is returned by ImportCAConfigs methods on success. |
| 70 message ImportedConfigs { | 81 message ImportedConfigs { |
| 71 message ConfigFile { | 82 message ConfigFile { |
| 72 string name = 1; // name of the config file | 83 string name = 1; // name of the config file |
| 73 string revision = 2; // the revision of the imported config | 84 string revision = 2; // the revision of the imported config |
| 74 } | 85 } |
| 75 // The list of imported config files with their revision numbers. | 86 // The list of imported config files with their revision numbers. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 // The deserialized token envelope. | 205 // The deserialized token envelope. |
| 195 // | 206 // |
| 196 // May be empty if token was malformed and couldn't be deserialized. | 207 // May be empty if token was malformed and couldn't be deserialized. |
| 197 messages.DelegationToken envelope = 5; | 208 messages.DelegationToken envelope = 5; |
| 198 | 209 |
| 199 // The deserialized token body (deserialized 'envelope.serialized_subtoken'). | 210 // The deserialized token body (deserialized 'envelope.serialized_subtoken'). |
| 200 // | 211 // |
| 201 // May be empty if token was malformed and couldn't be deserialized. | 212 // May be empty if token was malformed and couldn't be deserialized. |
| 202 messages.Subtoken subtoken = 6; | 213 messages.Subtoken subtoken = 6; |
| 203 } | 214 } |
| 215 | |
| 216 | |
| 217 // InspectOAuthTokenGrantRequest is body of InspectOAuthTokenGrant RPC call. | |
| 218 message InspectOAuthTokenGrantRequest { | |
| 219 // The token body. | |
| 220 string token = 1; | |
| 221 } | |
| 222 | |
| 223 | |
| 224 // InspectOAuthTokenGrantResponse is return value of InspectOAuthTokenGrant RPC. | |
| 225 message InspectOAuthTokenGrantResponse { | |
| 226 // True if the token is valid. | |
| 227 // | |
| 228 // A token is valid if its signature is correct and it hasn't expired yet. | |
| 229 bool valid = 1; | |
| 230 | |
| 231 // Human readable summary of why token is invalid. | |
| 232 // | |
| 233 // Summarizes the rest of the fields of this struct. Set only if 'valid' is | |
| 234 // false. | |
| 235 string invalidity_reason = 2; | |
| 236 | |
| 237 // True if the token signature was verified. | |
| 238 // | |
| 239 // It means the token was generated by the token server and its body is not | |
| 240 // a garbage. Note that a token can be correctly signed, but invalid (if it | |
| 241 // has expired). | |
| 242 // | |
| 243 // If 'signed' is false, the fields below may (or may not) be a garbage. | |
| 244 // | |
| 245 // The token server uses private keys managed by Google Cloud Platform, they | |
| 246 // are constantly being rotated and "old" signatures become invalid over time | |
| 247 // (when corresponding keys are rotated out of existence). | |
| 248 // | |
| 249 // If 'signed' is false, use the rest of the response only as FYI, possibly | |
| 250 // invalid or even maliciously constructed. | |
| 251 bool signed = 3; | |
| 252 | |
| 253 // True if the token signature was verified and token hasn't expired yet. | |
| 254 // | |
| 255 // We use "non_" prefix to make default 'false' value safer. | |
| 256 bool non_expired = 4; | |
| 257 | |
| 258 // ID of a token server private key used to sign the token. | |
| 259 string signing_key_id = 5; | |
| 260 | |
| 261 // The deserialized token body. | |
| 262 // | |
| 263 // May be empty if token was malformed and couldn't be deserialized. | |
| 264 tokenserver.OAuthTokenGrantBody token_body = 6; | |
| 265 } | |
| OLD | NEW |