account_management_service.proto 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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.cloud.identitytoolkit.v2;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/cloud/identitytoolkit/v2/mfa_info.proto";
  20. option csharp_namespace = "Google.Cloud.IdentityToolkit.V2";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/v2;identitytoolkit";
  22. option java_multiple_files = true;
  23. option java_package = "com.google.cloud.identitytoolkit.v2";
  24. option php_namespace = "Google\\Cloud\\IdentityToolkit\\V2";
  25. option ruby_package = "Google::Cloud::IdentityToolkit::V2";
  26. // Account management for Identity Toolkit
  27. service AccountManagementService {
  28. option (google.api.default_host) = "identitytoolkit.googleapis.com";
  29. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  30. // Finishes enrolling a second factor for the user.
  31. rpc FinalizeMfaEnrollment(FinalizeMfaEnrollmentRequest) returns (FinalizeMfaEnrollmentResponse) {
  32. option (google.api.http) = {
  33. post: "/v2/accounts/mfaEnrollment:finalize"
  34. body: "*"
  35. };
  36. }
  37. // Step one of the MFA enrollment process. In SMS case, this sends an
  38. // SMS verification code to the user.
  39. rpc StartMfaEnrollment(StartMfaEnrollmentRequest) returns (StartMfaEnrollmentResponse) {
  40. option (google.api.http) = {
  41. post: "/v2/accounts/mfaEnrollment:start"
  42. body: "*"
  43. };
  44. }
  45. // Revokes one second factor from the enrolled second factors for an account.
  46. rpc WithdrawMfa(WithdrawMfaRequest) returns (WithdrawMfaResponse) {
  47. option (google.api.http) = {
  48. post: "/v2/accounts/mfaEnrollment:withdraw"
  49. body: "*"
  50. };
  51. }
  52. }
  53. // Finishes enrolling a second factor for the user.
  54. message FinalizeMfaEnrollmentRequest {
  55. // Required. ID token.
  56. string id_token = 1 [(google.api.field_behavior) = REQUIRED];
  57. // Display name which is entered by users to distinguish between different
  58. // second factors with same type or different type.
  59. string display_name = 3;
  60. // MFA enrollment information to be verified.
  61. oneof verification_info {
  62. // Verification info to authorize sending an SMS for phone verification.
  63. FinalizeMfaPhoneRequestInfo phone_verification_info = 4;
  64. }
  65. // The ID of the Identity Platform tenant that the user enrolling MFA belongs
  66. // to. If not set, the user belongs to the default Identity Platform project.
  67. string tenant_id = 5;
  68. }
  69. // FinalizeMfaEnrollment response.
  70. message FinalizeMfaEnrollmentResponse {
  71. // ID token updated to reflect MFA enrollment.
  72. string id_token = 1;
  73. // Refresh token updated to reflect MFA enrollment.
  74. string refresh_token = 2;
  75. // MFA verified enrollment information.
  76. oneof auxiliary_auth_info {
  77. // Auxiliary auth info specific to phone auth.
  78. FinalizeMfaPhoneResponseInfo phone_auth_info = 3;
  79. }
  80. }
  81. // Sends MFA enrollment verification SMS for a user.
  82. message StartMfaEnrollmentRequest {
  83. // Required. User's ID token.
  84. string id_token = 1 [(google.api.field_behavior) = REQUIRED];
  85. // MFA information by type of 2nd factor.
  86. oneof enrollment_info {
  87. // Verification info to authorize sending an SMS for phone verification.
  88. StartMfaPhoneRequestInfo phone_enrollment_info = 3;
  89. }
  90. // The ID of the Identity Platform tenant that the user enrolling MFA belongs
  91. // to. If not set, the user belongs to the default Identity Platform project.
  92. string tenant_id = 4;
  93. }
  94. // StartMfaEnrollment response.
  95. message StartMfaEnrollmentResponse {
  96. // MFA start enrollment response by 2nd factor type.
  97. oneof enrollment_response {
  98. // Verification info to authorize sending an SMS for phone verification.
  99. StartMfaPhoneResponseInfo phone_session_info = 1;
  100. }
  101. }
  102. // Withdraws MFA.
  103. message WithdrawMfaRequest {
  104. // Required. User's ID token.
  105. string id_token = 1 [(google.api.field_behavior) = REQUIRED];
  106. // Required. MFA enrollment id from a current MFA enrollment.
  107. string mfa_enrollment_id = 2 [(google.api.field_behavior) = REQUIRED];
  108. // The ID of the Identity Platform tenant that the user unenrolling MFA
  109. // belongs to. If not set, the user belongs to the default Identity Platform
  110. // project.
  111. string tenant_id = 3;
  112. }
  113. // Withdraws MultiFactorAuth response.
  114. message WithdrawMfaResponse {
  115. // ID token updated to reflect removal of the second factor.
  116. string id_token = 1;
  117. // Refresh token updated to reflect removal of the second factor.
  118. string refresh_token = 2;
  119. }