From d88ceea9ea73f3009f96c06bf05a26e27c283627 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 10 May 2026 18:42:26 +0200 Subject: [PATCH] Move auth logic to options Signed-off-by: Nikolai Rodionov --- README.md | 93 +++++++++++++++++++++++-------- proto/options/v1/options_v1.proto | 1 + 2 files changed, 71 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index fc1c78d..f12fbb8 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,23 @@ ## Table of Contents +- [options/v1/options_v1.proto](#options_v1_options_v1-proto) + - [AuthOptions](#options-v1-AuthOptions) + + - [File-level Extensions](#options_v1_options_v1-proto-extensions) + - [accounts/v1/accounts_v1.proto](#accounts_v1_accounts_v1-proto) - [AccountData](#accounts-v1-AccountData) - [AccountPassword](#accounts-v1-AccountPassword) - [IsEmailVerifiedRequest](#accounts-v1-IsEmailVerifiedRequest) - [IsEmailVerifiedResponse](#accounts-v1-IsEmailVerifiedResponse) - [NewPasswordRequest](#accounts-v1-NewPasswordRequest) + - [RefreshTokenRequest](#accounts-v1-RefreshTokenRequest) - [ResetPasswordRequest](#accounts-v1-ResetPasswordRequest) - [SignInRequest](#accounts-v1-SignInRequest) - [SignUpRequest](#accounts-v1-SignUpRequest) - - [AccountAuthService](#accounts-v1-AccountAuthService) - - [AccountsNoAuthService](#accounts-v1-AccountsNoAuthService) + - [AccountManagementService](#accounts-v1-AccountManagementService) - [applications/v1/applications_v1.proto](#applications_v1_applications_v1-proto) - [ApplicationFull](#applications-ApplicationFull) @@ -71,6 +76,45 @@ + +

Top

+ +## options/v1/options_v1.proto + + + + + +### AuthOptions + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| auth | [bool](#bool) | | When set to false, the auth interceptor will be skiped on the backend | + + + + + + + + + + + + +### File-level Extensions +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +| auth_options | AuthOptions | .google.protobuf.MethodOptions | 50001 | | + + + + + + +

Top

@@ -156,6 +200,21 @@ Protobuf definitions for the accounts service. + + +### RefreshTokenRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| session_id | [string](#string) | | | + + + + + + ### ResetPasswordRequest @@ -179,8 +238,8 @@ Protobuf definitions for the accounts service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| data | [AccountData](#accounts-v1-AccountData) | | | -| password | [AccountPassword](#accounts-v1-AccountPassword) | | | +| email | [string](#string) | | | +| password | [string](#string) | | | @@ -195,8 +254,8 @@ Protobuf definitions for the accounts service. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| data | [AccountData](#accounts-v1-AccountData) | | | -| password | [AccountPassword](#accounts-v1-AccountPassword) | | | +| email | [string](#string) | | | +| password | [string](#string) | | | @@ -209,29 +268,17 @@ Protobuf definitions for the accounts service. - + -### AccountAuthService -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 - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| IsEmailVerified | [IsEmailVerifiedRequest](#accounts-v1-IsEmailVerifiedRequest) | [IsEmailVerifiedResponse](#accounts-v1-IsEmailVerifiedResponse) | Is email for the current account verified | - - - - -### AccountsNoAuthService +### AccountManagementService Service for handling accounts that do not require authentication | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| SignUp | [SignUpRequest](#accounts-v1-SignUpRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Create a new user | | SignIn | [SignInRequest](#accounts-v1-SignInRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Sing in into an existing account | -| ResetPassword | [ResetPasswordRequest](#accounts-v1-ResetPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Reset the password, if it was lost | -| NewPassword | [NewPasswordRequest](#accounts-v1-NewPasswordRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Set the new password after reset | -| RefreshToken | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | Send the refresh token request, token should be passed in the metadata. This rpc does requier auth, but it should be handled not on the middleware level, that's why it set in the NoAuth service | +| SignUp | [SignUpRequest](#accounts-v1-SignUpRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | Create a new account | +| IsEmailVerified | [IsEmailVerifiedRequest](#accounts-v1-IsEmailVerifiedRequest) | [IsEmailVerifiedResponse](#accounts-v1-IsEmailVerifiedResponse) | Is email for the current account verified | +| RefreshSession | [.google.protobuf.Empty](#google-protobuf-Empty) | [.google.protobuf.Empty](#google-protobuf-Empty) | | diff --git a/proto/options/v1/options_v1.proto b/proto/options/v1/options_v1.proto index 59136ee..f76418e 100644 --- a/proto/options/v1/options_v1.proto +++ b/proto/options/v1/options_v1.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package options.v1; import "google/protobuf/descriptor.proto"; +option go_package = "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/options/v1"; message AuthOptions { // When set to false, the auth interceptor will be skiped on the backend