Move auth logic to options
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
@@ -2,26 +2,28 @@
|
||||
syntax = "proto3";
|
||||
package accounts.v1;
|
||||
import "google/protobuf/empty.proto";
|
||||
import "options/v1/options_v1.proto";
|
||||
option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1";
|
||||
|
||||
/**
|
||||
* Service for handling accounts that do not require authentication
|
||||
*/
|
||||
service AccountsNoAuthService {
|
||||
service AccountManagementService {
|
||||
// Sing in into an existing account
|
||||
rpc SignIn (SignInRequest) returns (google.protobuf.Empty) {}
|
||||
rpc SignIn (SignInRequest) returns (google.protobuf.Empty) {
|
||||
option (options.v1.auth_options) = {
|
||||
auth: true
|
||||
};
|
||||
}
|
||||
// Create a new account
|
||||
rpc SignUp (SignUpRequest) returns (google.protobuf.Empty) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Service for handling accounts that do require authentication
|
||||
* Tokens should be sent via metadata, so the service is able to authenticate a user for a request
|
||||
*/
|
||||
service AccountsAuthService {
|
||||
rpc SignUp (SignUpRequest) returns (google.protobuf.Empty) {
|
||||
option (options.v1.auth_options) = {
|
||||
auth: true
|
||||
};
|
||||
}
|
||||
// Is email for the current account verified
|
||||
rpc IsEmailVerified (IsEmailVerifiedRequest) returns (IsEmailVerifiedResponse) {}
|
||||
rpc RefreshToken (google.protobuf.Empty) returns (google.protobuf.Empty) {}
|
||||
rpc RefreshSession (google.protobuf.Empty) returns (google.protobuf.Empty) {}
|
||||
}
|
||||
|
||||
message AccountPassword {
|
||||
|
||||
12
proto/options/v1/options_v1.proto
Normal file
12
proto/options/v1/options_v1.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
package options.v1;
|
||||
import "google/protobuf/descriptor.proto";
|
||||
|
||||
message AuthOptions {
|
||||
// When set to false, the auth interceptor will be skiped on the backend
|
||||
bool auth = 1;
|
||||
}
|
||||
|
||||
extend google.protobuf.MethodOptions {
|
||||
AuthOptions auth_options = 50001;
|
||||
}
|
||||
Reference in New Issue
Block a user