// Copyright IBM Corp. 2020, 2026
// SPDX-License-Identifier: BUSL-1.1

syntax = "proto3";

package testing.event.v1;

import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "protoc-gen-openapiv2/options/annotations.proto";

option go_package = "github.com/hashicorp/boundary/internal/gen/testing/event;event";

service TestAuthMethodService {
  // TestAuthenticate validates credentials provided and returns an Auth Token.
  rpc TestAuthenticate(TestAuthenticateRequest) returns (TestAuthenticateResponse) {
    option (google.api.http) = {
      post: "/v1/auth-methods/{auth_method_id}:authenticate"
      body: "*"
    };
    option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {summary: "Authenticate a user to an scope and retrieve an authentication token."};
  }
}
message TestAuthenticateRequest {
  // The ID of the Auth Method in the system that should be used for authentication.
  // @inject_tag: `class:"public"`
  string auth_method_id = 1 [json_name = "auth_method_id"];
  // 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.
  // @inject_tag: `class:"public"`
  string token_type = 2 [
    json_name = "token_type",
    deprecated = true
  ];
  // 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.
  // @inject_tag: `class:"public"`
  string type = 3 [json_name = "type"];
  // 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.
  // @inject_tag: `class:"public"`
  string command = 5 [json_name = "command"];
}

message TestAuthenticateResponse {
  reserved 1, 2; // Old item and token_type
  reserved "item", "token_type";
  // 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.
  // @inject_tag: `class:"public"`
  string command = 5 [json_name = "command"];
}
