Move auth logic to options
Some checks failed
ci/woodpecker/push/go-generate Pipeline failed
ci/woodpecker/push/dart-generate Pipeline failed
ci/woodpecker/push/lint Pipeline failed
ci/woodpecker/push/js-generate Pipeline failed
ci/woodpecker/push/repo-checks Pipeline was successful

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2026-05-10 18:41:11 +02:00
parent 50a2797157
commit 1325118309
2 changed files with 25 additions and 11 deletions

View File

@@ -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 {

View 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;
}