feat(authmethods): Add typed attributes to authenticate request and response
The AuthenticateRequest and AuthenticateResponse types have a complex mapping rule system, which requires a pair of custom callback functions.
This commit is contained in:
1 parent
0e51f9cc92
commit
a2bff4efdf
14 files changed
+1346
-678
No files matched your search
@@ -42,9 +42,6 @@ message AuthToken {
|
||||
// Output only. The time this Auth Token expires.
|
||||
google.protobuf.Timestamp expiration_time = 110 [json_name="expiration_time"];
|
||||
|
||||
// Output only. The type of this auth token. Either "cookie" or "token".
|
||||
string token_type = 120 [json_name="token_type"];
|
||||
|
||||
// Output only. The available actions on this resource for this user.
|
||||
repeated string authorized_actions = 300 [json_name="authorized_actions"];
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import "google/api/visibility.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "controller/api/resources/authmethods/v1/auth_method.proto";
|
||||
import "controller/api/resources/authtokens/v1/authtoken.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
option (custom_options.v1.domain) = "auth";
|
||||
@@ -196,15 +197,6 @@ message OidcStartAttributes {
|
||||
string cached_roundtrip_payload = 2;
|
||||
}
|
||||
|
||||
// The layout of the struct for "attributes" field in AuthenticateRequest for a
|
||||
// oidc type's token command. This message isn't directly referenced anywhere
|
||||
// but is used here to define the expected field names and types.
|
||||
message OidcTokenAttributes {
|
||||
// The token id for the request. This is the token id that was returned from
|
||||
// the oidc type's start command
|
||||
string token_id = 1;
|
||||
}
|
||||
|
||||
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"`
|
||||
@@ -214,8 +206,16 @@ message AuthenticateRequest {
|
||||
// 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 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"];
|
||||
oneof attrs {
|
||||
// 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;
|
||||
// Note: these fields have a custom mapping function for transforming to and from the generic attributes,
|
||||
// they do not use the standard attribute transformation.
|
||||
PasswordLoginAttributes password_login_attributes = 7 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
OidcStartAttributes oidc_start_attributes = 8 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackRequest oidc_auth_method_authenticate_callback_request = 9 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenRequest oidc_auth_method_authenticate_token_request = 10 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
}
|
||||
// The command to perform.
|
||||
string command = 5 [json_name = "command"]; // @gotags: `class:"public"`
|
||||
|
||||
@@ -229,8 +229,16 @@ message AuthenticateResponse {
|
||||
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"];
|
||||
oneof attrs {
|
||||
// Valid keys and values depend on the type of Auth Method as well as the command.
|
||||
google.protobuf.Struct attributes = 4 [json_name = "attributes"];
|
||||
// Note: these fields have a custom mapping function for transforming to and from the generic attributes,
|
||||
// they do not use the standard attribute transformation.
|
||||
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateStartResponse oidc_auth_method_authenticate_start_response = 6 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateCallbackResponse oidc_auth_method_authenticate_callback_response = 7 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenResponse oidc_auth_method_authenticate_token_response = 8 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
controller.api.resources.authtokens.v1.AuthToken auth_token_response = 9 [(google.api.field_visibility).restriction = "INTERNAL"];
|
||||
}
|
||||
// The command that was performed.
|
||||
string command = 5 [json_name = "command"]; // @gotags: `class:"public"`
|
||||
}
|
||||
Reference in new issue
Block a user