github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/server/serverpb/authentication.proto (about) 1 // Copyright 2017 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.server.serverpb; 13 option go_package = "serverpb"; 14 15 import "gogoproto/gogo.proto"; 16 import "google/api/annotations.proto"; 17 18 // UserLoginRequest contains credentials a user must provide to log in. 19 message UserLoginRequest { 20 // A username which must correspond to a database user on the cluster. 21 string username = 1; 22 // A password for the provided username. 23 string password = 2; 24 } 25 26 // UserLoginResponse is currently empty. If a login is successful, an HTTP 27 // Set-Cookie header will be added to the response with a session 28 // cookie identifying the created session. 29 message UserLoginResponse { 30 // No information to return. 31 } 32 33 // UserLogoutRequest will terminate the current session in use. The request 34 // is empty because the current session is identified by an HTTP cookie on the 35 // incoming request. 36 message UserLogoutRequest { 37 // No information needed. 38 } 39 40 message UserLogoutResponse { 41 // No information to return. 42 } 43 44 // SessionCookie is a message used to encode the authentication cookie returned 45 // from successful login requests. 46 message SessionCookie { 47 // The unique ID of the session. 48 int64 id = 1 [(gogoproto.customname) = "ID"]; 49 // The secret needed to verify ownership of a session. 50 bytes secret = 2; 51 } 52 53 // LogIn and LogOut are the GRPC APIs used to create web authentication sessions. 54 // Intended for use over GRPC-Gateway, which identifies sessions using HTTP 55 // cookies. 56 // 57 // They're separate services because LogIn must not require authentication so that 58 // the user can log in, while LogOut does require authentication, so that we can 59 // decode the cookie and revoke the session. 60 service LogIn { 61 // UserLogin is used to create a web authentication session. 62 rpc UserLogin(UserLoginRequest) returns (UserLoginResponse) { 63 option (google.api.http) = { 64 post: "/login" 65 body: "*" 66 }; 67 } 68 } 69 70 service LogOut { 71 // UserLogout terminates an active authentication session. 72 rpc UserLogout(UserLogoutRequest) returns (UserLogoutResponse) { 73 option (google.api.http) = { 74 get: "/logout" 75 }; 76 } 77 }