feat: Default configs sms provider (#3187)

* feat: sms config

* feat: twilio as sms provider

* feat:sms projection

* feat: sms queries

* feat: sms queries test

* feat: sms configs

* feat: sms configs sql file

* fix merge

* fix: rename from to sendername

* fix: proto comments

* fix: token as crypto

* fix: tests

* fix: sms config sender name to sender number

* fix: sms config sender name to sender number

* Update email.go

* Update channel.go

* Update V1.111__settings.sql

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Fabi
2022-02-21 13:22:20 +01:00
committed by GitHub
parent e3528ff0b2
commit 7d235e3eed
24 changed files with 2760 additions and 8 deletions

View File

@@ -254,6 +254,66 @@ service AdminService {
};
}
// list sms provider configurations
rpc ListSMSProviders(ListSMSProvidersRequest) returns (ListSMSProvidersResponse) {
option (google.api.http) = {
post: "/sms/_search"
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.read";
};
}
// Get sms provider
rpc GetSMSProvider(GetSMSProviderRequest) returns (GetSMSProviderResponse) {
option (google.api.http) = {
get: "/sms/{id}";
};
option (zitadel.v1.auth_option) = {
permission: "iam.read";
};
}
// Add twilio sms provider
rpc AddSMSProviderTwilio(AddSMSProviderTwilioRequest) returns (AddSMSProviderTwilioResponse) {
option (google.api.http) = {
post: "/sms/twilio";
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
}
// Update twilio sms provider
rpc UpdateSMSProviderTwilio(UpdateSMSProviderTwilioRequest) returns (UpdateSMSProviderTwilioResponse) {
option (google.api.http) = {
put: "/sms/twilio/{id}";
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
}
// Update twilio sms provider token
rpc UpdateSMSProviderTwilioToken(UpdateSMSProviderTwilioTokenRequest) returns (UpdateSMSProviderTwilioTokenResponse) {
option (google.api.http) = {
put: "/sms/twilio/{id}/token";
body: "*"
};
option (zitadel.v1.auth_option) = {
permission: "iam.write";
};
}
// Returns an organisation by id
rpc GetOrgByID(GetOrgByIDRequest) returns (GetOrgByIDResponse) {
option (google.api.http) = {
@@ -2431,6 +2491,54 @@ message UpdateSMTPConfigPasswordResponse {
zitadel.v1.ObjectDetails details = 1;
}
message ListSMSProvidersRequest {
//list limitations and ordering
zitadel.v1.ListQuery query = 1;
}
message ListSMSProvidersResponse {
zitadel.v1.ListDetails details = 1;
repeated zitadel.settings.v1.SMSProvider result = 3;
}
message GetSMSProviderRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 100}];
}
message GetSMSProviderResponse {
zitadel.settings.v1.SMSProvider config = 1;
}
message AddSMSProviderTwilioRequest {
string sid = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
string token = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
string sender_number = 3 [(validate.rules).string = {min_len: 1, max_len: 200}];
}
message AddSMSProviderTwilioResponse {
zitadel.v1.ObjectDetails details = 1;
string id = 2;
}
message UpdateSMSProviderTwilioRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
string sid = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
string sender_number = 3 [(validate.rules).string = {min_len: 1, max_len: 200}];
}
message UpdateSMSProviderTwilioResponse {
zitadel.v1.ObjectDetails details = 1;
}
message UpdateSMSProviderTwilioTokenRequest {
string id = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
string token = 2 [(validate.rules).string = {min_len: 1, max_len: 200}];
}
message UpdateSMSProviderTwilioTokenResponse {
zitadel.v1.ObjectDetails details = 1;
}
// if name or domain is already in use, org is not unique
message IsOrgUniqueRequest {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {

View File

@@ -51,3 +51,25 @@ message SMTPConfig {
string host = 5;
string user = 6;
}
message SMSProvider {
zitadel.v1.ObjectDetails details = 1;
string id = 2;
SMSProviderConfigState state = 3;
oneof config {
TwilioConfig twilio = 4;
}
}
message TwilioConfig {
string sid = 1;
string sender_number = 2;
}
enum SMSProviderConfigState {
SMS_PROVIDER_CONFIG_STATE_UNSPECIFIED = 0;
SMS_PROVIDER_CONFIG_ACTIVE = 1;
SMS_PROVIDER_CONFIG_INACTIVE = 2;
}