Files
threshold/internal/proto/local/controller/api/services/v1/authenticate_service.proto
T

63 lines
2.2 KiB
Protocol Buffer

syntax = "proto3";
package controller.api.services.v1;
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/services;services";
import "protoc-gen-swagger/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/authtokens/v1/authtoken.proto";
service AuthenticationService {
// Authenticate validates credentials provided and returns an auth token.
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
option (google.api.http) = {
post: "/v1/orgs/{org_id}/auth-methods/{auth_method_id}:authenticate"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
summary: "Authenticate a user to an Org and retrieve an authentication token."
};
}
// Logout terminates a user's current session.
rpc Deauthenticate(DeauthenticateRequest) returns (DeauthenticateResponse) {
option (google.api.http) = {
post: "/v1/orgs/{org_id}:deauthenticate"
};
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_operation) = {
summary: "Deauthenticate an authentication token from an Org."
};
}
}
// The layout of the struct for "credentials" field in AuthenticateRequest. This message isn't
// directly referenced anywhere but is used here to define the expected field names and types.
message PasswordCredentials {
string name = 1;
string password = 2;
}
message AuthenticateRequest {
string org_id = 1;
// The id to the authmethod in the system being used for authentication. The auth method must be in the org
// being logged in to.
string auth_method_id = 2;
// This can be "cookie" or "token". If not provided, "token" will be used. For now only type "token" is returned.
string token_type = 3;
// credentials are the different possible credential names depending on what type of auth method is used.
// For password auth method: should include only "name" and "password".
google.protobuf.Struct credentials = 8;
}
message AuthenticateResponse {
resources.authtokens.v1.AuthToken item = 1;
}
message DeauthenticateRequest {
string org_id = 1;
}
message DeauthenticateResponse {}