Integrate with Vault to retrieve and manage per session credentials (#1308)
* Fix down migrations * Udpates due to merge * Sentinel values only have to be greater than 0 * Create credential related sdk structs and methods. * Post merge interface updating. * Removing scratch code that was not cleaned up. * updates * Convert client certificate and client certificate keys into pem blocks and validate. * Add newline at end of file. * Faster check for "s" at the end of a resource name when generating from templates. * make fmt * updates * Add dynamic credentials to a session * Refactor: move contents of file * updates * Updates * Add InvalidDynamicCredential error * Assign credentials * Allow updating client certificates seperate from the client certificate key. * Replace application purpose string with enum value * PR feedback / fix go test . * Delete dead code * Use common view * Refactor: extract interface and rename method * Refactor: move code to eliminate privPurpLibrary * Add comment to requestMap * Refactor: do not export methods on an unexported struct * Update internal/db/schema/migrations/postgres/10/03_vault_credential.up.sql Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> * Add comments to credential Purpose constants * Reorder switch statements to handle errors first * PR feedback * update * fix merge * Organizing the scheduler code and extract the individual store creation test helper function. * Run 'make fmt' * Create certificate when creating store. Allow vault address to be passed in as option * Refactor: rename database views and associated structs This change renames two database views and associated go structs to use a consistent naming pattern. Views ending in 'private' contain encrypted credentials needed for connecting to Vault. Views ending in 'public' mirror the 'private' views but do not include any encrypted values. This change does not include any changes to functionality or behavior. * Adding SAD target operations for credential libraries to the SDK. * Add status field and enumeration table for credential status * Refactor: rename Status to TokenStatus * Add status to vault credentials * Creating the template for the CLI and helper functions. * Add private database view for vault credentials * Add scope_id to view and cleanup TODO comment * Reformat embedded sql queries * Add vault client helpers * updates * white space * Add LookupLease test * CLI commands for Store work. Renamed fields in proto w/ vault prefix. * Test issue credentials with client TLS * Add additional checks to vault ping * Add an error for vault token capabilities and create a VaultToken error kind * Add support for working with Vault policies * Use Vault 1.7.2 for testing * Add testing helper for creating a vault client with a non-root token * Fix Vault renew lease test The Vault renew lease endpoint accepts an optional duration parameter for requesting the number of seconds to extend the lease by. However, Vault is not required to honor this request. * Add a var for the required capabilities of a boundary Vault token * Enhance the test helper for adding a policy to Vault * Allow the test role in postgresql to revoke credentials * Remove out of date comments * Enhance Vault test helpers for the database secrets engine * Reformat comments * Add a method for getting the capabilities of the current Vault token * Add revoke lease to internal Vault client * Reformat: combine err return line with check for nil line * Remove redundant checks in test code Remove checks in test code that are redundant with checks in the test harness. * Refactor CreateToken test helper to return the secret and the token * Fix build failures caused by signature change in vault.CreateToken * Fix Vault version and Vault API link in comments * ran `make gen` after merging from mgaffney-vault. * Remove Vault prefix from attribute fields in API, create a base CLI option for adding field prefixes. format now uses that prefix for error reporting. * Template now allows attaching attribute field prefixes. * Credential store uses PrefixAttributeFieldErrorsWithSubactionPrefix. * Fixing naming of vault flags and helper flags. * Updating more references to generated api methods. * Make the capabilities String method more readable * Add comment outlining PrintApiError usage of Options. * Refactor test to move declarations closer to first use * Fix comment * Implement revoke method on vault repository * Tests now verify certs, CA, and tokens, addresses can be updated in a store. * Added test for creating store with pk/cert in same field. * Allo updating certificates seperate from private key. Only contact backing vault service when updating token. * Fixing bad tests and removing unused code. * Adding tests for various ways of updating tokens. * Add private credential * Add token revocation job and cred renewal/revocation job * Regen after merge. * Fixing field mask related merge error. * Create Library CLI. Removes vault prefix from path. Adds a WithoutCleanup testOption for vault. * Set all credentials to revoked when a token is revoked * Fixing missed renaming update. * fix copy/paste error. * Fixing code generation errors after merge. * make gen after merge. * Update internal/cmd/commands/credentialstorescmd/vault_funcs.go Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> * Update internal/cmd/commands/credentialstorescmd/vault_funcs.go Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> * Update internal/cmd/commands/credentialstorescmd/vault_funcs.go Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> * Refactor: move migrations from 10 to 12 * Removing logic from transaction. * wrapping client errors in the calling op for CredentialStore's client() method. * Redact token * redact client key * updates * Add trigger to revoke credentials when session is canceled or terminated * Fixing some help text for some flags. * Add ability to load values from files (file://) or environment variables (env://). * Updating comments * fix bad merge * feedback * Adding issued credentials to sessions. * Error on capabilities * updates * Expose NewVaulTestServer * Add godoc * Adding generated SessionCredential struct for API. * Progress on building handler test for Authorize Session. * feedback * Update policies * Add 'revoke' as a status for Vault Tokens * Add delete_time to vault credential store * Create dynamic credentials at session creation time. * Tests pass with credentials attached to AuthorizedSession result. * Only call issue if there are credentials to issue. * Fixing output only issues. Adding type to credential library. * Fix test to clear un/pw generated. confirm generated un/pw changes from 1 authorize session call to another. * Update lookupTokenError * Add delete_time to private credential store * Refactor: move private store to separate file * Fixing tests for AuthorizeSession and verifying error cases. * Only create the credential repo if there are credentials to issue. * Rename Library field to CredentialLibrary. * Fixing missing change of Library to CredentialLibrary. * Removing Default SDK functions for fields which are required and update CLI to match. * Replace resource specific id variables with "id" and the input parmater for paths to be just a single string and the resource name as it should show up in the path. * Soft delete vault credential stores * Prevent new SQL functions from silently overwriting existing functions * Rename "Hmac" to "HMAC" in the human readable cli response table. * Fix tests * Add vault database cleanup jobs * Add ability to set the token period in the vault test harness * updates * Add not_null_columns func test * remove unused struct * Up no output timeout * Validate current vault token on addr update * Fix client cert change test * add cert test * Update revocation job where * Fix comment * Use Vault's default port in CLI help strings * Remove down migrations * Increase migration file numbers by 1 * Run make migrations * Move migrations from 12 to 10 * Increase Circle CI timeout for acceptance tests * Fix spelling mistake in error messages * ASD cmds for Target and returning credentials to AuthSession request (#1338) * Add Add/Set/Remove commands for libraries on Targets. Return credentials on AuthorizeSession request. Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com> Co-authored-by: Louis Ruch <louisruch@gmail.com> Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com> Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
This commit is contained in:
216 files changed
+38675
-1941
No files matched your search
+60
@@ -0,0 +1,60 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.resources.credentiallibraries.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/resources/credentiallibraries;credentiallibraries";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "controller/api/resources/scopes/v1/scope.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
// CredentialLibrary contains all fields related to an Credential Library resource
|
||||
message CredentialLibrary {
|
||||
// Output only. The ID of the Credential Library.
|
||||
string id = 10;
|
||||
|
||||
// The ID of the Credential Store of which this Credential Library is a part.
|
||||
string credential_store_id = 20 [json_name = "credential_store_id"];
|
||||
|
||||
// Output only. Scope information for this Credential Library.
|
||||
resources.scopes.v1.ScopeInfo scope = 30;
|
||||
|
||||
// Optional name for identification purposes.
|
||||
google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "name" that: "Name" }];
|
||||
|
||||
// Optional user-set description for identification purposes.
|
||||
google.protobuf.StringValue description = 50 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "description" that: "Description" }];
|
||||
|
||||
// Output only. The time this resource was created.
|
||||
google.protobuf.Timestamp created_time = 60 [json_name = "created_time"];
|
||||
|
||||
// Output only. The time this resource was last updated.
|
||||
google.protobuf.Timestamp updated_time = 70 [json_name = "updated_time"];
|
||||
|
||||
// Version is used in mutation requests, after the initial creation, to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 80;
|
||||
|
||||
// The Credential Library type.
|
||||
string type = 90;
|
||||
|
||||
// The attributes that are applicable for the specific Credential Library type.
|
||||
google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true];
|
||||
|
||||
// Output only. The available actions on this resource for this user.
|
||||
repeated string authorized_actions = 300 [json_name = "authorized_actions"];
|
||||
}
|
||||
|
||||
// The attributes of a vault typed Credential Library.
|
||||
message VaultCredentialLibraryAttributes {
|
||||
// The path in Vault to request credentials from.
|
||||
google.protobuf.StringValue path = 10 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.path" that: "VaultPath" }];
|
||||
|
||||
// The HTTP method the library uses to communicate with Vault.
|
||||
google.protobuf.StringValue http_method = 20 [json_name = "http_method", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_method" that: "HttpMethod" }];
|
||||
|
||||
// The body of the HTTP request the library sends to vault. When set http_method must be "POST"
|
||||
google.protobuf.StringValue http_request_body = 30 [json_name = "http_request_body", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.http_request_body" that: "HttpRequestBody" }];
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.resources.credentialstores.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/resources/credentialstores;credentialstores";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "controller/api/resources/scopes/v1/scope.proto";
|
||||
import "controller/custom_options/v1/options.proto";
|
||||
|
||||
// CredentialStore contains all fields related to an Credential Store resource
|
||||
message CredentialStore {
|
||||
// Output only. The ID of the Credential Store.
|
||||
string id = 10;
|
||||
|
||||
// The ID of the Scope of which this Credential Store is a part.
|
||||
string scope_id = 20 [json_name = "scope_id"];
|
||||
|
||||
// Output only. Scope information for this Credential Store.
|
||||
resources.scopes.v1.ScopeInfo scope = 30;
|
||||
|
||||
// Optional name for identification purposes.
|
||||
google.protobuf.StringValue name = 40 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "name" that: "Name" }];
|
||||
|
||||
// Optional user-set description for identification purposes.
|
||||
google.protobuf.StringValue description = 50 [(custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "description" that: "Description" }];
|
||||
|
||||
// Output only. The time this resource was created.
|
||||
google.protobuf.Timestamp created_time = 60 [json_name = "created_time"];
|
||||
|
||||
// Output only. The time this resource was last updated.
|
||||
google.protobuf.Timestamp updated_time = 70 [json_name = "updated_time"];
|
||||
|
||||
// Version is used in mutation requests, after the initial creation, to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 80;
|
||||
|
||||
// The Credential Store type.
|
||||
string type = 90;
|
||||
|
||||
// The attributes that are applicable for the specific Credential Store type.
|
||||
google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true];
|
||||
|
||||
// Output only. The available actions on this resource for this user.
|
||||
repeated string authorized_actions = 300 [json_name = "authorized_actions"];
|
||||
|
||||
// Output only. The authorized actions for the scope's collections.
|
||||
map<string, google.protobuf.ListValue> authorized_collection_actions = 310 [json_name = "authorized_collection_actions"];
|
||||
}
|
||||
|
||||
// The attributes of a vault typed Credential Store.
|
||||
message VaultCredentialStoreAttributes {
|
||||
// The complete url address of vault.
|
||||
google.protobuf.StringValue address = 10 [json_name = "address", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.address" that: "VaultAddress" }];
|
||||
|
||||
// The namespace of vault used by this store
|
||||
google.protobuf.StringValue namespace = 20 [json_name = "namespace", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.namespace" that: "Namespace" }];
|
||||
|
||||
// The PEM encoded CA cert to verify the vault server's ssl certificate
|
||||
google.protobuf.StringValue ca_cert = 30 [json_name = "ca_cert", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.ca_cert" that: "CaCert" }];
|
||||
|
||||
// The value to use as the SNI host when connecting to vault via TLS.
|
||||
google.protobuf.StringValue tls_server_name = 40 [json_name = "tls_server_name", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_server_name" that: "TlsServerName" }];
|
||||
|
||||
// When set to true verification of the TLS certificate is disabled.
|
||||
google.protobuf.BoolValue tls_skip_verify = 50 [json_name = "tls_skip_verify", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.tls_skip_verify" that: "TlsSkipVerify" }];
|
||||
|
||||
// Input only. The current vault token used by this credential store for creating new credentials.
|
||||
google.protobuf.StringValue token = 60 [json_name = "token", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.token" that: "Token" }];
|
||||
|
||||
// Output only. The hmac value of the vault token used by this credential store.
|
||||
string token_hmac = 70 [json_name = "token_hmac"];
|
||||
|
||||
// Input only. A PEM encoded client certificate for vault with an
|
||||
// optional private key included in the bundle. It is an error to include
|
||||
// the private key in this bundle as well as setting the certificate_key
|
||||
// field.
|
||||
google.protobuf.StringValue client_certificate = 80 [json_name = "client_certificate", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate" that: "Certificate" }];
|
||||
|
||||
// Input only. A client certificate private key.
|
||||
google.protobuf.StringValue client_certificate_key = 90 [json_name = "client_certificate_key", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = { this: "attributes.client_certificate_key" that: "CertificateKey" }];
|
||||
|
||||
// Output only. The hmac value of the private key used by the credential store.
|
||||
string client_certificate_key_hmac = 100 [json_name = "client_certificate_key_hmac"];
|
||||
}
|
||||
@@ -18,6 +18,35 @@ message HostSet{
|
||||
string host_catalog_id = 20 [json_name="host_catalog_id"];
|
||||
}
|
||||
|
||||
message CredentialLibrary{
|
||||
// The ID of the Credential Library.
|
||||
string id = 10;
|
||||
|
||||
// Output only. The name of the Credential Library.
|
||||
string name = 20;
|
||||
|
||||
// Output only. The description of the Credential Library.
|
||||
string description = 30;
|
||||
|
||||
// Output only. The Credential Store to which this Credential Library belongs.
|
||||
string credential_store_id = 40 [json_name="credential_store_id"];
|
||||
|
||||
// The library's purpose for this target.
|
||||
string purpose = 50;
|
||||
|
||||
// Output only. The type of the credential library.
|
||||
string type = 60;
|
||||
}
|
||||
|
||||
// A credential for a session.
|
||||
message SessionCredential {
|
||||
// Output only. The library which generated this credential.
|
||||
CredentialLibrary credential_library = 1;
|
||||
|
||||
// Output only. The secret of this credential base64 encoded.
|
||||
string secret = 2;
|
||||
}
|
||||
|
||||
// Target contains all fields related to a Target resource
|
||||
message Target {
|
||||
// Output only. The ID of the resource.
|
||||
@@ -63,6 +92,12 @@ message Target {
|
||||
// Optional boolean expression to filter the workers that are allowed to satisfy this request.
|
||||
google.protobuf.StringValue worker_filter = 140 [json_name="worker_filter", (custom_options.v1.generate_sdk_option) = true, (custom_options.v1.mask_mapping) = {this: "worker_filter" that: "WorkerFilter"}];
|
||||
|
||||
// The IDs of the credential libraries associated with this Target.
|
||||
repeated string credential_library_ids = 150 [json_name="credential_library_ids"];
|
||||
|
||||
// Output only. The credential libraries associated with this Target.
|
||||
repeated CredentialLibrary credential_libraries = 160 [json_name="credential_libraries"];
|
||||
|
||||
// The attributes that are applicable for the specific Target.
|
||||
google.protobuf.Struct attributes = 200 [(custom_options.v1.generate_sdk_option) = true];
|
||||
|
||||
@@ -149,4 +184,7 @@ message SessionAuthorization {
|
||||
|
||||
// Output only. The endpoint address that the worker will connect to, useful for setting TLS parameters.
|
||||
string endpoint = 100;
|
||||
|
||||
// Output only. The credentials for this session.
|
||||
repeated SessionCredential credentials = 110 [json_name="credentials"];
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
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/field_mask.proto";
|
||||
import "controller/api/resources/credentiallibraries/v1/credential_library.proto";
|
||||
|
||||
service CredentialLibraryService {
|
||||
// GetCredentialLibrary returns a stored Credential Library if present. The provided request
|
||||
// must include the Credential Store id. If missing, malformed or referencing a
|
||||
// non existing resource an error is returned.
|
||||
rpc GetCredentialLibrary(GetCredentialLibraryRequest) returns (GetCredentialLibraryResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/credential-libraries/{id}"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Gets a single Credential Library."
|
||||
};
|
||||
}
|
||||
|
||||
// ListCredentialLibraries returns a list of stored Credential Libraries which are in the
|
||||
// provided scope. The request must include the Credential Store id and if missing,
|
||||
// malformed, or referencing a non existing scope, an error is returned.
|
||||
rpc ListCredentialLibraries(ListCredentialLibrariesRequest) returns (ListCredentialLibrariesResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/credential-libraries"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Lists all Credential Library."
|
||||
};
|
||||
}
|
||||
|
||||
// CreateCredentialLibrary creates and stores an Credential Library in boundary. The
|
||||
// provided request must include the scope in which the Credential Library will be
|
||||
// created. If the scope id is missing, malformed or referencing a
|
||||
// non existing resource an error is returned. If a name is provided that is
|
||||
// in use in another Credential Library in the same scope, an error is returned.
|
||||
rpc CreateCredentialLibrary(CreateCredentialLibraryRequest) returns (CreateCredentialLibraryResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/credential-libraries"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Creates a single Credential Library."
|
||||
};
|
||||
}
|
||||
|
||||
// UpdateCredentialLibrary updates an existing Credential Library in boundary. The provided
|
||||
// Credential Library must not have any read only fields set. The update mask must be
|
||||
// included in the request and contain at least 1 mutable field. To unset
|
||||
// a field's value, include the field in the update mask and don't set it
|
||||
// in the provided user. An error is returned if the Credential Library id is missing
|
||||
// or reference a non existing resource. An error is also returned if the
|
||||
// request attempts to update the name to one that is already in use by
|
||||
// another Credential Library in the parent scope.
|
||||
rpc UpdateCredentialLibrary(UpdateCredentialLibraryRequest) returns (UpdateCredentialLibraryResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/credential-libraries/{id}"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Updates a Credential Library."
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteCredentialLibrary removes an Credential Library from Boundary. If the Credential Library id
|
||||
// is malformed or not provided an error is returned.
|
||||
rpc DeleteCredentialLibrary(DeleteCredentialLibraryRequest) returns (DeleteCredentialLibraryResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/credential-libraries/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Deletes a Credential Library"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetCredentialLibraryRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetCredentialLibraryResponse {
|
||||
resources.credentiallibraries.v1.CredentialLibrary item = 1;
|
||||
}
|
||||
|
||||
message ListCredentialLibrariesRequest {
|
||||
string credential_store_id = 1 [json_name = "scope_id"];
|
||||
string filter = 30 [json_name = "filter"];
|
||||
}
|
||||
|
||||
message ListCredentialLibrariesResponse {
|
||||
repeated resources.credentiallibraries.v1.CredentialLibrary items = 1;
|
||||
}
|
||||
|
||||
message CreateCredentialLibraryRequest {
|
||||
resources.credentiallibraries.v1.CredentialLibrary item = 1;
|
||||
}
|
||||
|
||||
message CreateCredentialLibraryResponse {
|
||||
string uri = 1;
|
||||
resources.credentiallibraries.v1.CredentialLibrary item = 2;
|
||||
}
|
||||
|
||||
message UpdateCredentialLibraryRequest {
|
||||
string id = 1;
|
||||
resources.credentiallibraries.v1.CredentialLibrary item = 2;
|
||||
google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"];
|
||||
}
|
||||
|
||||
message UpdateCredentialLibraryResponse {
|
||||
resources.credentiallibraries.v1.CredentialLibrary item = 1;
|
||||
}
|
||||
|
||||
message DeleteCredentialLibraryRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message DeleteCredentialLibraryResponse {}
|
||||
@@ -0,0 +1,126 @@
|
||||
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/field_mask.proto";
|
||||
import "controller/api/resources/credentialstores/v1/credential_store.proto";
|
||||
|
||||
service CredentialStoreService {
|
||||
// GetCredentialStore returns a stored Credential Store if present. The provided request
|
||||
// must include the Credential Store id. If missing, malformed or referencing a
|
||||
// non existing resource an error is returned.
|
||||
rpc GetCredentialStore(GetCredentialStoreRequest) returns (GetCredentialStoreResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/credential-stores/{id}"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Gets a single Credential Store."
|
||||
};
|
||||
}
|
||||
|
||||
// ListCredentialStores returns a list of stored Credential Stores which are in the
|
||||
// provided scope. The request must include the scope id and if missing,
|
||||
// malformed, or referencing a non existing scope, an error is returned.
|
||||
rpc ListCredentialStores(ListCredentialStoresRequest) returns (ListCredentialStoresResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/credential-stores"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Lists all Credential Stores."
|
||||
};
|
||||
}
|
||||
|
||||
// CreateCredentialStore creates and stores an Credential Store in boundary. The
|
||||
// provided request must include the scope in which the Credential Store will be
|
||||
// created. If the scope id is missing, malformed or referencing a
|
||||
// non existing resource an error is returned. If a name is provided that is
|
||||
// in use in another Credential Store in the same scope, an error is returned.
|
||||
rpc CreateCredentialStore(CreateCredentialStoreRequest) returns (CreateCredentialStoreResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/credential-stores"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Creates a single Credential Store."
|
||||
};
|
||||
}
|
||||
|
||||
// UpdateCredentialStore updates an existing Credential Store in boundary. The provided
|
||||
// Credential Store must not have any read only fields set. The update mask must be
|
||||
// included in the request and contain at least 1 mutable field. To unset
|
||||
// a field's value, include the field in the update mask and don't set it
|
||||
// in the provided user. An error is returned if the Credential Store id is missing
|
||||
// or reference a non existing resource. An error is also returned if the
|
||||
// request attempts to update the name to one that is already in use by
|
||||
// another Credential Store in the parent scope.
|
||||
rpc UpdateCredentialStore(UpdateCredentialStoreRequest) returns (UpdateCredentialStoreResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/credential-stores/{id}"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Updates a Credential Store."
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteCredentialStore removes a Credential Store from Boundary. If the Credential Store id
|
||||
// is malformed or not provided an error is returned.
|
||||
rpc DeleteCredentialStore(DeleteCredentialStoreRequest) returns (DeleteCredentialStoreResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/credential-stores/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Deletes a CredentialStore"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetCredentialStoreRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetCredentialStoreResponse {
|
||||
resources.credentialstores.v1.CredentialStore item = 1;
|
||||
}
|
||||
|
||||
message ListCredentialStoresRequest {
|
||||
string scope_id = 1 [json_name = "scope_id"];
|
||||
bool recursive = 20 [json_name = "recursive"];
|
||||
string filter = 30 [json_name = "filter"];
|
||||
}
|
||||
|
||||
message ListCredentialStoresResponse {
|
||||
repeated resources.credentialstores.v1.CredentialStore items = 1;
|
||||
}
|
||||
|
||||
message CreateCredentialStoreRequest {
|
||||
resources.credentialstores.v1.CredentialStore item = 1;
|
||||
}
|
||||
|
||||
message CreateCredentialStoreResponse {
|
||||
string uri = 1;
|
||||
resources.credentialstores.v1.CredentialStore item = 2;
|
||||
}
|
||||
|
||||
message UpdateCredentialStoreRequest {
|
||||
string id = 1;
|
||||
resources.credentialstores.v1.CredentialStore item = 2;
|
||||
google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"];
|
||||
}
|
||||
|
||||
message UpdateCredentialStoreResponse {
|
||||
resources.credentialstores.v1.CredentialStore item = 1;
|
||||
}
|
||||
|
||||
message DeleteCredentialStoreRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message DeleteCredentialStoreResponse {}
|
||||
@@ -149,6 +149,60 @@ service TargetService {
|
||||
};
|
||||
}
|
||||
|
||||
// AddTargetCredentialLibraries adds Credential Libraries to this Target.
|
||||
// The provided request must include the Target ID to which the Credential
|
||||
// Libraries will be added. All Credential Libraries added to the provided
|
||||
// Target must be a child of a Store that is in the same scope as this
|
||||
// Target. If the scope or Target IDs are missing, malformed, or reference
|
||||
// non-existing resources, an error is returned. An error is returned if a
|
||||
// Credential Library is attempted to be added to a target that is already
|
||||
// present on the Target.
|
||||
rpc AddTargetCredentialLibraries(AddTargetCredentialLibrariesRequest) returns (AddTargetCredentialLibrariesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/targets/{id}:add-credential-libraries"
|
||||
body: "*"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Adds existing Credential Libraries to a Target."
|
||||
};
|
||||
}
|
||||
|
||||
// SetTargetCredentialLibraries sets the Target's Credential Libraries.
|
||||
// Any existing Credential Libraries on the Target are deleted if they are
|
||||
// not included in this request. The provided request must include the scope,
|
||||
// and the Target ID on which the Credential Libraries will be set. All
|
||||
// Credential Libraries in the request must be a child of a Store that is
|
||||
// in the same scope as the provided Target. If any IDs are missing,
|
||||
// malformed, or references a non-existing resource, an error is returned.
|
||||
rpc SetTargetCredentialLibraries(SetTargetCredentialLibrariesRequest) returns (SetTargetCredentialLibrariesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/targets/{id}:set-credential-libraries"
|
||||
body: "*"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Sets the Credential Libraries on the Target."
|
||||
};
|
||||
}
|
||||
|
||||
// RemoveTargetCredentialLibraries removes the Credential Libraries from the
|
||||
// specified Target. The provided request must include the Target ID for the
|
||||
// Target from which the Credential Libraries will be removed. If the ID is
|
||||
// missing, or malformed, an error is returned. An error is returned if a
|
||||
// Credential Library is attempted to be removed from the Target when the
|
||||
// Target does not have the Credential Library.
|
||||
rpc RemoveTargetCredentialLibraries(RemoveTargetCredentialLibrariesRequest) returns (RemoveTargetCredentialLibrariesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/targets/{id}:remove-credential-libraries"
|
||||
body: "*"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Removes Credential Libraries from the Target."
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message GetTargetRequest {
|
||||
@@ -230,6 +284,59 @@ message RemoveTargetHostSetsResponse {
|
||||
api.resources.targets.v1.Target item = 1;
|
||||
}
|
||||
|
||||
message CredentialLibrary {
|
||||
// The id of the credential library.
|
||||
string id = 1;
|
||||
// The purpose of the credential library for this target. Currently this can
|
||||
// only be "application" or left empty (which defaults the value to
|
||||
// "application").
|
||||
string purpose = 2;
|
||||
}
|
||||
|
||||
// The ids from both credential_library_ids and credential_libraries are used.
|
||||
// When using credential_library_ids the default value "application" is used
|
||||
// for the purpose.
|
||||
message AddTargetCredentialLibrariesRequest {
|
||||
string id = 1;
|
||||
// Version is used to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 2;
|
||||
repeated string credential_library_ids = 3 [json_name="credential_library_ids"];
|
||||
repeated CredentialLibrary credential_libraries = 4 [json_name="credential_libraries"];
|
||||
}
|
||||
|
||||
message AddTargetCredentialLibrariesResponse {
|
||||
api.resources.targets.v1.Target item = 1;
|
||||
}
|
||||
|
||||
// The ids from both credential_library_ids and credential_libraries are used.
|
||||
// When using credential_library_ids the default value "application" is used
|
||||
// for the purpose.
|
||||
message SetTargetCredentialLibrariesRequest {
|
||||
string id = 1;
|
||||
// Version is used to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 2;
|
||||
repeated string credential_library_ids = 3 [json_name="credential_library_ids"];
|
||||
repeated CredentialLibrary credential_libraries = 4 [json_name="credential_libraries"];
|
||||
}
|
||||
|
||||
message SetTargetCredentialLibrariesResponse {
|
||||
api.resources.targets.v1.Target item = 1;
|
||||
}
|
||||
|
||||
message RemoveTargetCredentialLibrariesRequest {
|
||||
string id = 1;
|
||||
// Version is used to ensure this resource has not changed.
|
||||
// The mutation will fail if the version does not match the latest known good version.
|
||||
uint32 version = 2;
|
||||
repeated string credential_library_ids = 3 [json_name="credential_library_ids"];
|
||||
}
|
||||
|
||||
message RemoveTargetCredentialLibrariesResponse {
|
||||
api.resources.targets.v1.Target item = 1;
|
||||
}
|
||||
|
||||
message AuthorizeSessionRequest {
|
||||
// The ID of the target. Required unless some combination of scope_id/scope_name and name are set.
|
||||
string id = 1;
|
||||
|
||||
Reference in new issue
Block a user