2024-03-09 18:45:32 +01:00
|
|
|
syntax = "proto2";
|
|
|
|
|
|
|
|
package auth;
|
|
|
|
|
2024-08-21 21:38:36 +02:00
|
|
|
import "common.proto";
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// Server entrypoint, authenticates users and grants initial session token.
|
2024-03-09 18:45:32 +01:00
|
|
|
service Auth {
|
2024-09-05 00:08:07 +02:00
|
|
|
// Send credentials, returns valid session token.
|
2024-08-22 01:01:25 +02:00
|
|
|
rpc Login (LoginRequest) returns (LoginResponse);
|
2024-03-09 18:45:32 +01:00
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// If the given token has recently expired, get a new valid one.
|
2024-08-21 21:38:36 +02:00
|
|
|
rpc Refresh (common.Token) returns (common.Token);
|
2024-03-09 18:45:32 +01:00
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// The login request message.
|
2024-08-21 21:38:36 +02:00
|
|
|
message LoginRequest {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The username to log in with.
|
2024-03-09 19:07:23 +01:00
|
|
|
required string username = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The password to log in with.
|
2024-03-09 19:07:23 +01:00
|
|
|
required string password = 2;
|
2024-03-09 18:45:32 +01:00
|
|
|
}
|
2024-08-22 01:01:25 +02:00
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// The login response message.
|
2024-08-22 01:01:25 +02:00
|
|
|
message LoginResponse {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The newly created session token.
|
2024-08-22 01:01:25 +02:00
|
|
|
required common.Token token = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The user profile that has been authenticated.
|
2024-08-22 01:01:25 +02:00
|
|
|
required common.User user = 2;
|
|
|
|
}
|