refact(authmethods): Add top level token type to Authenticate (#2010)

Other parts of the system make use of a "type" field, while the
AuthenticateResponse sets a "token_type" on the response attributes
directly. Rename this field to "type", and move it up to the response
level, to be more consistent with other RPCs.

Also adds a new field to the AuthenticateRequest, "type" which will
replace the "token_type" field over time.
This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2022-04-18 09:26:15 -04:00
1 parent bf9e7874b1
commit 80b2c9230f
15 files changed
+246 -171

No files matched your search

@@ -202,8 +202,11 @@ message AuthenticateRequest {
// The ID of the Auth Method in the system that should be used for authentication.
string auth_method_id = 1 [json_name = "auth_method_id"]; // @gotags: `class:"public"`
// This can be "cookie" or "token". If not provided, "token" will be used. "cookie" activates a split-cookie method where the token is split partially between http-only and regular cookies in order
// to keep it safe from rogue JS in the browser. Deprecated, use "type" instead.
string token_type = 2 [json_name = "token_type", deprecated = true]; // @gotags: `class:"public"`
// This can be "cookie" or "token". If not provided, "token" will be used. "cookie" activates a split-cookie method where the token is split partially between http-only and regular cookies in order
// to keep it safe from rogue JS in the browser.
string token_type = 2 [json_name = "token_type"]; // @gotags: `class:"public"`
string type = 6 [json_name = "type"]; // @gotags: `class:"public"`
// Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command.
google.protobuf.Struct attributes = 4 [json_name = "attributes"];
// The command to perform.
@@ -217,6 +220,8 @@ message AuthenticateRequest {
message AuthenticateResponse {
reserved 1, 2; // Old item and token_type
reserved "item", "token_type";
// The type of the token returned. Either "cookie" or "token".
string type = 3; // @gotags: `class:"public"`
// Valid keys and values depend on the type of Auth Method as well as the command.
google.protobuf.Struct attributes = 4 [json_name = "attributes"];
// The command that was performed.