authentication_service.proto 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. // Authentication for Identity Toolkit
  27. service AuthenticationService {
  28. option (google.api.default_host) = "identitytoolkit.googleapis.com";
  29. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  30. // Verifies the MFA challenge and performs sign-in
  31. rpc FinalizeMfaSignIn(FinalizeMfaSignInRequest) returns (FinalizeMfaSignInResponse) {
  32. option (google.api.http) = {
  33. post: "/v2/accounts/mfaSignIn:finalize"
  34. body: "*"
  35. };
  36. }
  37. // Sends the MFA challenge
  38. rpc StartMfaSignIn(StartMfaSignInRequest) returns (StartMfaSignInResponse) {
  39. option (google.api.http) = {
  40. post: "/v2/accounts/mfaSignIn:start"
  41. body: "*"
  42. };
  43. }
  44. }
  45. // Finalizes sign-in by verifying MFA challenge.
  46. message FinalizeMfaSignInRequest {
  47. // Required. Pending credential from first factor sign-in.
  48. string mfa_pending_credential = 2 [(google.api.field_behavior) = REQUIRED];
  49. // Proof of completion of the MFA challenge.
  50. oneof verification_info {
  51. // Proof of completion of the SMS based MFA challenge.
  52. FinalizeMfaPhoneRequestInfo phone_verification_info = 3;
  53. }
  54. // The ID of the Identity Platform tenant the user is signing in to. If not
  55. // set, the user will sign in to the default Identity Platform project.
  56. string tenant_id = 4;
  57. }
  58. // FinalizeMfaSignIn response.
  59. message FinalizeMfaSignInResponse {
  60. // ID token for the authenticated user.
  61. string id_token = 1;
  62. // Refresh token for the authenticated user.
  63. string refresh_token = 2;
  64. // MFA verified sign-in information.
  65. oneof auxiliary_auth_info {
  66. // Extra phone auth info, including android verification proof.
  67. FinalizeMfaPhoneResponseInfo phone_auth_info = 3;
  68. }
  69. }
  70. // Starts multi-factor sign-in by sending the multi-factor auth challenge.
  71. message StartMfaSignInRequest {
  72. // Required. Pending credential from first factor sign-in.
  73. string mfa_pending_credential = 2 [(google.api.field_behavior) = REQUIRED];
  74. // Required. MFA enrollment id from the user's list of current MFA enrollments.
  75. string mfa_enrollment_id = 3 [(google.api.field_behavior) = REQUIRED];
  76. // MFA information by type of 2nd factor.
  77. oneof sign_in_info {
  78. // Verification info to authorize sending an SMS for phone verification.
  79. StartMfaPhoneRequestInfo phone_sign_in_info = 4;
  80. }
  81. // The ID of the Identity Platform tenant the user is signing in to. If not
  82. // set, the user will sign in to the default Identity Platform project.
  83. string tenant_id = 5;
  84. }
  85. // StartMfaSignIn response.
  86. message StartMfaSignInResponse {
  87. // MultiFactor start sign-in response by 2nd factor type.
  88. oneof response_info {
  89. // MultiFactor sign-in session information specific to SMS-type second
  90. // factors. Along with the one-time code retrieved from the sent SMS, the
  91. // contents of this session information should be passed to
  92. // FinalizeMfaSignIn to complete the sign in.
  93. StartMfaPhoneResponseInfo phone_response_info = 1;
  94. }
  95. }