Move authenticate service into auth method service (#635)

This was always an RPC-only distinction and from that perspective it
makes sense; however it causes the generated docs to treat it as an
entirely separate service even though it's under the same collection
path as auth methods and this is confusing.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-10-12 18:03:15 -04:00
1 parent 0f1fbea8f7
commit dd8973dd9f
14 files changed
+1019 -1349

No files matched your search

@@ -7,7 +7,9 @@ option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/s
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.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";
service AuthMethodService {
// GetAuthMethod returns a stored Auth Method if present. The provided request
@@ -80,6 +82,18 @@ service AuthMethodService {
summary: "Deletes an AuthMethod"
};
}
// Authenticate validates credentials provided and returns an Auth Token.
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
option (google.api.http) = {
post: "/v1/auth-methods/{auth_method_id}:authenticate"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Authenticate a user to an scope and retrieve an authentication token."
};
}
}
message GetAuthMethodRequest {
@@ -122,3 +136,23 @@ message DeleteAuthMethodRequest {
}
message DeleteAuthMethodResponse {}
// 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 login_name = 1 [json_name="login_name"];
string password = 2;
}
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"];
// 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"];
// Credentials are passed to the Auth Method; the valid keys and values depend on the type of Auth Method.
google.protobuf.Struct credentials = 3;
}
message AuthenticateResponse {
resources.authtokens.v1.AuthToken item = 1;
string token_type = 2 [json_name="token_type"];
}
@@ -1,52 +0,0 @@
syntax = "proto3";
package controller.api.services.v1;
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/authtokens/v1/authtoken.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Controller API"
}
schemes: HTTPS
schemes: HTTP
};
service AuthenticationService {
// Authenticate validates credentials provided and returns an Auth Token.
rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {
option (google.api.http) = {
post: "/v1/auth-methods/{auth_method_id}:authenticate"
body: "*"
response_body: "item"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Authenticate a user to an scope and retrieve an authentication token."
};
}
}
// 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 login_name = 1 [json_name="login_name"];
string password = 2;
}
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"];
// 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"];
// Credentials are passed to the Auth Method; the valid keys and values depend on the type of Auth Method.
google.protobuf.Struct credentials = 3;
}
message AuthenticateResponse {
resources.authtokens.v1.AuthToken item = 1;
string token_type = 2 [json_name="token_type"];
}