idp_service.proto 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. syntax = "proto3";
  2. package memos.api.v1;
  3. import "google/api/annotations.proto";
  4. import "google/api/client.proto";
  5. import "google/protobuf/empty.proto";
  6. import "google/protobuf/field_mask.proto";
  7. option go_package = "gen/api/v1";
  8. service IdentityProviderService {
  9. // ListIdentityProviders lists identity providers.
  10. rpc ListIdentityProviders(ListIdentityProvidersRequest) returns (ListIdentityProvidersResponse) {
  11. option (google.api.http) = {get: "/api/v1/identityProviders"};
  12. }
  13. // GetIdentityProvider gets an identity provider.
  14. rpc GetIdentityProvider(GetIdentityProviderRequest) returns (IdentityProvider) {
  15. option (google.api.http) = {get: "/api/v1/{name=identityProviders/*}"};
  16. option (google.api.method_signature) = "name";
  17. }
  18. // CreateIdentityProvider creates an identity provider.
  19. rpc CreateIdentityProvider(CreateIdentityProviderRequest) returns (IdentityProvider) {
  20. option (google.api.http) = {
  21. post: "/api/v1/identityProviders"
  22. body: "identity_provider"
  23. };
  24. }
  25. // UpdateIdentityProvider updates an identity provider.
  26. rpc UpdateIdentityProvider(UpdateIdentityProviderRequest) returns (IdentityProvider) {
  27. option (google.api.http) = {
  28. patch: "/api/v1/{identity_provider.name=identityProviders/*}"
  29. body: "identity_provider"
  30. };
  31. option (google.api.method_signature) = "identity_provider,update_mask";
  32. }
  33. // DeleteIdentityProvider deletes an identity provider.
  34. rpc DeleteIdentityProvider(DeleteIdentityProviderRequest) returns (google.protobuf.Empty) {
  35. option (google.api.http) = {delete: "/api/v1/{name=identityProviders/*}"};
  36. option (google.api.method_signature) = "name";
  37. }
  38. }
  39. message IdentityProvider {
  40. // The name of the identityProvider.
  41. // Format: identityProviders/{id}
  42. string name = 1;
  43. enum Type {
  44. TYPE_UNSPECIFIED = 0;
  45. OAUTH2 = 1;
  46. }
  47. Type type = 2;
  48. string title = 3;
  49. string identifier_filter = 4;
  50. IdentityProviderConfig config = 5;
  51. }
  52. message IdentityProviderConfig {
  53. oneof config {
  54. OAuth2Config oauth2_config = 1;
  55. }
  56. }
  57. message FieldMapping {
  58. string identifier = 1;
  59. string display_name = 2;
  60. string email = 3;
  61. }
  62. message OAuth2Config {
  63. string client_id = 1;
  64. string client_secret = 2;
  65. string auth_url = 3;
  66. string token_url = 4;
  67. string user_info_url = 5;
  68. repeated string scopes = 6;
  69. FieldMapping field_mapping = 7;
  70. }
  71. message ListIdentityProvidersRequest {}
  72. message ListIdentityProvidersResponse {
  73. repeated IdentityProvider identity_providers = 1;
  74. }
  75. message GetIdentityProviderRequest {
  76. // The name of the identityProvider to get.
  77. // Format: identityProviders/{id}
  78. string name = 1;
  79. }
  80. message CreateIdentityProviderRequest {
  81. // The identityProvider to create.
  82. IdentityProvider identity_provider = 1;
  83. }
  84. message UpdateIdentityProviderRequest {
  85. // The identityProvider to update.
  86. IdentityProvider identity_provider = 1;
  87. // The update mask applies to the resource. Only the top level fields of
  88. // IdentityProvider are supported.
  89. google.protobuf.FieldMask update_mask = 2;
  90. }
  91. message DeleteIdentityProviderRequest {
  92. // The name of the identityProvider to delete.
  93. // Format: identityProviders/{id}
  94. string name = 1;
  95. }