external_identities.proto 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/common.proto";
  5. // Public metadata for a configured external login provider.
  6. message ExternalIdentityProvider {
  7. reserved 1 to 4;
  8. reserved "id", "type", "label", "login_url";
  9. // URL that starts authenticated account linking for this provider. Clients
  10. // should use StartExternalIdentityLink instead of navigating here directly.
  11. string link_url = 5;
  12. // True when this provider is already linked to the authenticated user.
  13. bool linked = 6;
  14. // Linked identity subject hash for this provider, when linked.
  15. string linked_identity_subject_hash = 7;
  16. // Shared provider metadata.
  17. ProviderMetadata provider = 8;
  18. }
  19. // Linked provider identity metadata for the authenticated user's settings UI.
  20. message LinkedExternalIdentity {
  21. // Provider ID recorded when the identity was linked.
  22. string provider_id = 1;
  23. // Provider type recorded when the identity was linked.
  24. string provider_type = 2;
  25. // Current or fallback provider label.
  26. string provider_label = 3;
  27. // Stable one-way subject hash, useful only as a UI/list key.
  28. string subject_hash = 4;
  29. }
  30. // Request to list configured and linked external identities for the current user.
  31. message ListExternalIdentitiesRequest {}
  32. // Finite snapshot of configured providers and linked external identities.
  33. message ListExternalIdentitiesResponse {
  34. // Configured providers the user may link.
  35. repeated ExternalIdentityProvider providers = 1;
  36. // Provider identities already linked to the authenticated user.
  37. repeated LinkedExternalIdentity linked_identities = 2;
  38. }
  39. // Request to start linking a configured provider to the current user.
  40. message StartExternalIdentityLinkRequest {
  41. // Provider ID to link.
  42. string provider_id = 1 [(buf.validate.field).string.min_len = 1];
  43. // Internal path to return to after confirmation.
  44. string redirect_path = 2;
  45. // Current password proof for accounts with a password when the active
  46. // runtime credential is no longer fresh.
  47. string current_password = 3;
  48. }
  49. // Result of preparing an external identity link flow.
  50. message StartExternalIdentityLinkResponse {
  51. // Browser URL that starts provider authorization on the target server origin.
  52. string start_url = 1;
  53. }
  54. // Request to disconnect a linked provider identity from the authenticated user.
  55. message DisconnectExternalIdentityRequest {
  56. // Stable one-way subject hash of the linked identity to disconnect.
  57. string subject_hash = 1 [(buf.validate.field).string.min_len = 1];
  58. // Current password proof for accounts with a password when the active
  59. // runtime credential is no longer fresh.
  60. string current_password = 2;
  61. }
  62. // Result of disconnecting a provider identity.
  63. message DisconnectExternalIdentityResponse {
  64. // True when the identity was disconnected.
  65. bool disconnected = 1;
  66. }