proto/api: improve auth method service API docs (#4616)

This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2024-04-09 14:14:30 -07:00
1 parent 61299276c4
commit 31f4b73584
6 files changed
+1149 -678

No files matched your search

@@ -7,24 +7,26 @@ package controller.api.resources.authmethods.v1;
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/options.proto";
import "google/api/field_behavior.proto";
import "google/api/visibility.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resources/authmethods;authmethods";
option (custom_options.v1.domain) = "auth";
// AuthMethod contains all fields related to an Auth Method resource
// AuthMethod contains all fields related to an auth method resource
message AuthMethod {
// Output only. The ID of the Auth Method.
string id = 10; // @gotags: `class:"public" eventstream:"observation"`
// The ID of the auth method.
string id = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; // @gotags: `class:"public" eventstream:"observation"`
// The ID of the Scope of which this Auth Method is a part.
// The ID of the Scope of which this auth method is a part.
string scope_id = 20 [json_name = "scope_id"]; // @gotags: `class:"public" eventstream:"observation"`
// Output only. Scope information for this Auth method.
resources.scopes.v1.ScopeInfo scope = 30;
// Scope information for this Auth method.
resources.scopes.v1.ScopeInfo scope = 30 [(google.api.field_behavior) = OUTPUT_ONLY];
// Optional name for identification purposes.
google.protobuf.StringValue name = 40 [
@@ -44,24 +46,89 @@ message AuthMethod {
}
]; // @gotags: `class:"public"`
// Output only. The time this resource was created.
google.protobuf.Timestamp created_time = 60 [json_name = "created_time"]; // @gotags: `class:"public" eventstream:"observation"`
// The time this resource was created.
google.protobuf.Timestamp created_time = 60 [
json_name = "created_time",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public" eventstream:"observation"`
// Output only. The time this resource was last updated.
google.protobuf.Timestamp updated_time = 70 [json_name = "updated_time"]; // @gotags: `class:"public" eventstream:"observation"`
// The time this resource was last updated.
google.protobuf.Timestamp updated_time = 70 [
json_name = "updated_time",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public" eventstream:"observation"`
// 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.
// Version is not required when you create an auth method.
uint32 version = 80; // @gotags: `class:"public"`
// The Auth Method type.
// The auth method type.
string type = 90; // @gotags: `class:"public" eventstream:"observation"`
oneof attrs {
// The attributes that are applicable for the specific Auth Method type.
// The attributes that are applicable for the specific auth method type.
google.protobuf.Struct attributes = 100 [
(custom_options.v1.generate_sdk_option) = true,
(custom_options.v1.subtype) = "default"
(custom_options.v1.subtype) = "default",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"min_login_name_length\": 10, \"min_password_length\": 16}",
description:
"The attributes that are applicable for the specific auth method type. "
"The schema of this field depends on the type of the auth method "
"that you create want to create.\n"
"For password auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"min_login_name_length\": \"min_login_name_length\",\n"
" \"min_password_length\": \"min_password_length\"\n"
"}\n"
"```\n"
"For OIDC auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"issuer\": \"issuer\",\n"
" \"client_id\": \"client_id\",\n"
" \"client_secret\": \"client_secret\",\n"
" \"max_age\": 3600,\n"
" \"signing_algorithms\": [],\n"
" \"api_url_prefix\": \"api_url_prefix\",\n"
" \"idp_ca_certs\": [],\n"
" \"allowed_audiences\": [],\n"
" \"claims_scopes\": [],\n"
" \"account_claim_maps\": [],\n"
" \"disable_discovered_config_validation\": false,\n"
" \"prompts\": []\n"
"}\n"
"```\n"
"For LDAP auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"start_tls\": false,\n"
" \"insecure_tls\": false,\n"
" \"discover_dn\": false,\n"
" \"anon_group_search\": false,\n"
" \"upn_domain\": \"upn_domain\",\n"
" \"urls\": [],\n"
" \"user_dn\": \"user_dn\",\n"
" \"user_attr\": \"user_attr\",\n"
" \"user_filter\": \"user_filter\",\n"
" \"enable_groups\": false,\n"
" \"group_dn\": \"group_dn\",\n"
" \"group_attr\": \"group_attr\",\n"
" \"group_filter\": \"group_filter\",\n"
" \"certificates\": [],\n"
" \"client_certificate\": \"client_certificate\",\n"
" \"client_certificate_key\": \"client_certificate_key\",\n"
" \"bind_dn\": \"bind_dn\",\n"
" \"bind_password\": \"bind_password\",\n"
" \"use_token_groups\": false,\n"
" \"account_attribute_maps\": [],\n"
" \"maximum_page_size\": 1000,\n"
" \"dereference_aliases\": \"never\"\n"
"}\n"
"```\n"
}
];
PasswordAuthMethodAttributes password_auth_method_attributes = 101 [
(custom_options.v1.generate_sdk_option) = true,
@@ -80,20 +147,29 @@ message AuthMethod {
];
}
// Output only. Whether this auth method is the primary auth method for it's scope.
// Whether this auth method is the primary auth method for it's scope.
// To change this value update the primary_auth_method_id field on the scope.
bool is_primary = 110 [json_name = "is_primary"]; // @gotags: `class:"public" eventstream:"observation"`
bool is_primary = 110 [
json_name = "is_primary",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public" eventstream:"observation"`
// Output only. The available actions on this resource for this user.
repeated string authorized_actions = 300 [json_name = "authorized_actions"]; // @gotags: `class:"public"`
// The available actions on this resource for this user.
repeated string authorized_actions = 300 [
json_name = "authorized_actions",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// Output only. The authorized actions for the scope's collections.
map<string, google.protobuf.ListValue> authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; // classified as public via taggable implementation
// The authorized actions for the scope's collections.
map<string, google.protobuf.ListValue> authorized_collection_actions = 310 [
json_name = "authorized_collection_actions",
(google.api.field_behavior) = OUTPUT_ONLY
]; // classified as public via taggable implementation
}
// The attributes of a password typed auth method.
message PasswordAuthMethodAttributes {
// The minimum length allowed for user names for Accounts in this Auth Method.
// The minimum length allowed for user names for accounts in this auth method.
uint32 min_login_name_length = 10 [
json_name = "min_login_name_length",
(custom_options.v1.generate_sdk_option) = true,
@@ -103,7 +179,7 @@ message PasswordAuthMethodAttributes {
}
]; // @gotags: `class:"public"`
// The minimum length allowed for passwords for Accounts in this Auth Method.
// The minimum length allowed for passwords for accounts in this auth method.
uint32 min_password_length = 20 [
json_name = "min_password_length",
(custom_options.v1.generate_sdk_option) = true,
@@ -116,9 +192,12 @@ message PasswordAuthMethodAttributes {
// The attributes of an OIDC typed auth method.
message OidcAuthMethodAttributes {
// Output only. The state of the auth method. Will be "inactive",
// The state of the auth method. Will be "inactive",
// "active-private", or "active-public".
string state = 10 [json_name = "state"]; // @gotags: `class:"public"`
string state = 10 [
json_name = "state",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// The issuer URL. Boundary expects only the schema, host, and port and will
// strip off ".well-known/openid-configuration" if present. This will be
@@ -143,19 +222,23 @@ message OidcAuthMethodAttributes {
}
]; // @gotags: `class:"public"`
// Input only. The client's secret.
// The client's secret.
google.protobuf.StringValue client_secret = 40 [
json_name = "client_secret",
(custom_options.v1.generate_sdk_option) = true,
(custom_options.v1.mask_mapping) = {
this: "attributes.client_secret"
that: "ClientSecret"
}
},
(google.api.field_behavior) = INPUT_ONLY
]; // @gotags: `class:"secret"`
// Output only. The HMAC'd value of the clients secret to indicate whether
// The HMAC'd value of the clients secret to indicate whether
// the client secret has changed.
string client_secret_hmac = 50 [json_name = "client_secret_hmac"]; // @gotags: `class:"public"`
string client_secret_hmac = 50 [
json_name = "client_secret_hmac",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// The OIDC "max_age" parameter sent to the Authorization Server indicating
// a maximum acceptable time in seconds since the user's last authentication
@@ -192,9 +275,12 @@ message OidcAuthMethodAttributes {
}
]; // @gotags: `class:"public"`
// Output only. The callback URL that should be configured on the
// The callback URL that should be configured on the
// Authorization Server to use during the authentication flow.
string callback_url = 90 [json_name = "callback_url"]; // @gotags: `class:"public"`
string callback_url = 90 [
json_name = "callback_url",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// Optional PEM-encoded X.509 CA certificates that can be used as trust anchors
// when connecting to an OIDC provider.
@@ -321,7 +407,7 @@ message OidcAuthMethodAuthenticateTokenResponse {
// The attributes of an LDAP typed auth method.
message LdapAuthMethodAttributes {
// Output only. The state of the auth method. Will be "inactive",
// The state of the auth method. Will be "inactive",
// "active-private", or "active-public".
string state = 10 [
json_name = "state",
@@ -329,7 +415,8 @@ message LdapAuthMethodAttributes {
(custom_options.v1.mask_mapping) = {
this: "attributes.state"
that: "OperationalState"
}
},
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// start_tls if true, issues a StartTLS command after establishing an
@@ -516,7 +603,7 @@ message LdapAuthMethodAttributes {
}
]; // @gotags: `class:"public"`
// Input only. The client_certificate_key (optional) is the plain-text of the
// The client_certificate_key (optional) is the plain-text of the
// certificate key data encoded as PEM.
google.protobuf.StringValue client_certificate_key = 170 [
json_name = "client_certificate_key",
@@ -524,12 +611,16 @@ message LdapAuthMethodAttributes {
(custom_options.v1.mask_mapping) = {
this: "attributes.client_certificate_key",
that: "ClientCertificateKey"
}
},
(google.api.field_behavior) = INPUT_ONLY
]; // @gotags: `class:"secret"`
// Output only. The HMAC'd value of the client certificate key to indicate
// The HMAC'd value of the client certificate key to indicate
// whether the certificate key has changed.
string client_certificate_key_hmac = 180 [json_name = "client_certificate_key_hmac"]; // @gotags: `class:"public"`
string client_certificate_key_hmac = 180 [
json_name = "client_certificate_key_hmac",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
// bind_dn (optional) is the distinguished name of entry to bind when
// performing user and group search. Example:
@@ -543,7 +634,7 @@ message LdapAuthMethodAttributes {
}
]; // @gotags: `class:"public"`
// Input only. The bind_password (optional) is the password to use along with
// The bind_password (optional) is the password to use along with
// binddn when performing user search.
google.protobuf.StringValue bind_password = 200 [
json_name = "bind_password",
@@ -551,12 +642,16 @@ message LdapAuthMethodAttributes {
(custom_options.v1.mask_mapping) = {
this: "attributes.bind_password",
that: "BindPassword"
}
},
(google.api.field_behavior) = INPUT_ONLY
]; // @gotags: `class:"secret"`
// Output only. The HMAC'd value of the bind password to indicate
// The HMAC'd value of the bind password to indicate
// whether the password has changed.
string bind_password_hmac = 210 [json_name = "bind_password_hmac"]; // @gotags: `class:"public"`
string bind_password_hmac = 210 [
json_name = "bind_password_hmac",
(google.api.field_behavior) = OUTPUT_ONLY
]; // @gotags: `class:"public"`
bool use_token_groups = 220 [
json_name = "use_token_groups",
@@ -41,7 +41,7 @@ service AuthMethodService {
}
// ListAuthMethods returns a list of stored auth methods which are in the
// provided scope. The request must include the scope id and if missing,
// provided scope. The request must include the scope ID and if missing,
// malformed, or referencing a non existing scope, an error is returned.
rpc ListAuthMethods(ListAuthMethodsRequest) returns (ListAuthMethodsResponse) {
option (google.api.http) = {get: "/v1/auth-methods"};
@@ -50,7 +50,7 @@ service AuthMethodService {
// CreateAuthMethod creates and stores an auth method in Boundary. The
// provided request must include the scope in which the auth method will be
// created. If the scope id is missing, malformed or referencing a
// 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 auth method in the same scope, an error is returned.
rpc CreateAuthMethod(CreateAuthMethodRequest) returns (CreateAuthMethodResponse) {
@@ -66,7 +66,7 @@ service AuthMethodService {
// auth method 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 auth method id is missing
// in the provided user. An error is returned if the auth method 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 auth method in the parent scope.
@@ -107,7 +107,7 @@ service AuthMethodService {
}
message GetAuthMethodRequest {
// Id of the auth method being requested.
// ID of the auth method being requested.
string id = 1; // @gotags: `class:"public" eventstream:"observation"`
}
@@ -116,7 +116,7 @@ message GetAuthMethodResponse {
}
message ListAuthMethodsRequest {
// The scope id in which to list auth methods.
// The scope ID in which to list auth methods.
string scope_id = 1 [json_name = "scope_id"]; // @gotags: `class:"public" eventstream:"observation"`
// Whether to recursively list auth methods in the provided scope's child scopes.
bool recursive = 20 [json_name = "recursive"]; // @gotags: `class:"public" eventstream:"observation"`
@@ -170,7 +170,9 @@ message CreateAuthMethodResponse {
}
message UpdateAuthMethodRequest {
// The ID of the auth method that should be updated
string id = 1; // @gotags: `class:"public" eventstream:"observation"`
// A subset of the auth method containing the fields to update.
resources.authmethods.v1.AuthMethod item = 2;
google.protobuf.FieldMask update_mask = 3 [json_name = "update_mask"];
}
@@ -180,17 +182,18 @@ message UpdateAuthMethodResponse {
}
message DeleteAuthMethodRequest {
// The ID of the auth method to delete.
string id = 1; // @gotags: `class:"public" eventstream:"observation"`
}
message DeleteAuthMethodResponse {}
// Attributes specific to changing the state of an oidc auth method.
// Attributes specific to changing the state of an OIDC auth method.
message OidcChangeStateAttributes {
// state must be `inactive`, `active-private`, or `active-public`
string state = 1; // @gotags: `class:"public"`
// This flag is only useful for an oidc auth method. It should not be used
// unless the oidc provider's config is incorrectly set and is stopping the
// This flag is only useful for an OIDC auth method. It should not be used
// unless the OIDC provider's config is incorrectly set and is stopping the
// activation of this auth method.
bool disable_discovered_config_validation = 2 [json_name = "disable_discovered_config_validation"]; // @gotags: `class:"public"`
}
@@ -203,7 +206,23 @@ message ChangeStateRequest {
oneof attrs {
// The attributes specific to this auth method's state.
google.protobuf.Struct attributes = 4 [(custom_options.v1.subtype) = "default"];
google.protobuf.Struct attributes = 4 [
(custom_options.v1.subtype) = "default",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"state\": \"active-public\", \"disable_discovered_config_validation\": false}",
description:
"The attributes that are applicable for the specific auth method type. "
"The schema of this field depends on the type of the auth method. "
"The only supported auth method type is OIDC.\n"
"For OIDC auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"state\": \"active-public\",\n"
" \"disable_discovered_config_validation\": false\n"
"}\n"
"```\n"
}
];
OidcChangeStateAttributes oidc_change_state_attributes = 5 [
(custom_options.v1.subtype) = "oidc",
(google.api.field_visibility).restriction = "INTERNAL"
@@ -215,14 +234,15 @@ message ChangeStateResponse {
resources.authmethods.v1.AuthMethod item = 1;
}
// The layout of the struct for "attributes" field in AuthenticateRequest for a password type. This message isn't directly referenced anywhere but is used here to define the expected field names and
// types.
// The layout of the struct for "attributes" field in AuthenticateRequest for a password type.
// This message isn't directly referenced anywhere but is used here to define the expected
// field names and types.
message PasswordLoginAttributes {
string login_name = 1 [json_name = "login_name"]; // @gotags: `class:"sensitive"`
string password = 2; // @gotags: `class:"secret"`
}
// The layout of the struct for "attributes" field in AuthenticateRequest for a oidc type's start command. This message isn't directly referenced anywhere but is used here to define the expected field
// The layout of the struct for "attributes" field in AuthenticateRequest for a OIDC type's start command. This message isn't directly referenced anywhere but is used here to define the expected field
// names and types.
message OidcStartAttributes {
// An object which will be marshaled as JSON and roundtripped in the token command call.
@@ -253,7 +273,53 @@ message AuthenticateRequest {
string type = 6 [json_name = "type"]; // @gotags: `class:"public" eventstream:"observation"`
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;
google.protobuf.Struct attributes = 4 [
json_name = "attributes",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"login\": \"login\", \"password\": \"password\"}",
description:
"The attributes that are used to authenticate to the auth method. "
"The schema of this field depends on the type of the auth method. "
"For password auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"login\": \"login\",\n"
" \"password\": \"password\"\n"
"}\n"
"```\n"
"For LDAP auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"login_name\": \"login_name\",\n"
" \"password\": \"password\"\n"
"}\n"
"```\n"
"For OIDC auth methods, the parameters are:\n"
"```json\n"
"{\n"
" \"roundtrip_payload\": {}\n"
"}\n"
"```\n"
"OIDC authentication requires multiple calls to this endpoint. "
"After the initial call and successful authentication, the OIDC "
"provider must redirect the user to the `callback` command:\n"
"```json\n"
"{\n"
" \"code\": \"code\",\n"
" \"state\": \"state\",\n"
" \"error\": \"error\",\n"
" \"error_description\": \"error_description\",\n"
" \"error_uri\": \"error_uri\"\n"
"}\n"
"```\n"
"Once this has succeded, the issued auth token can be retrieved by using the `token` command:\n"
"```json\n"
"{\n"
" \"token_id\": \"token_id_from_initial_response\"\n"
"}\n"
"```\n"
}
];
// 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"];
@@ -262,7 +328,7 @@ message AuthenticateRequest {
controller.api.resources.authmethods.v1.OidcAuthMethodAuthenticateTokenRequest oidc_auth_method_authenticate_token_request = 10 [(google.api.field_visibility).restriction = "INTERNAL"];
LdapLoginAttributes ldap_login_attributes = 11 [(google.api.field_visibility).restriction = "INTERNAL"];
}
// The command to perform.
// The command to perform. One of "login", "callback", or "token".
string command = 5 [json_name = "command"]; // @gotags: `class:"public"`
// Deprecated fields
@@ -277,7 +343,41 @@ message AuthenticateResponse {
string type = 3; // @gotags: `class:"public" eventstream:"observation"`
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"];
google.protobuf.Struct attributes = 4 [
json_name = "attributes",
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
example: "{\"login\": \"login\", \"password\": \"password\"}",
description:
"The response attributes that are used to authenticate to the auth method. "
"The schema of this field depends on the type of the auth method. "
"For password, OIDC and LDAP auth methods, the response is an auth token:\n"
"```json\n"
"{\n"
" \"id\": \"token_id\",\n"
" \"scope_id\": \"scope_id\",\n"
" \"token\": \"token_string\",\n"
" \"user_id\": \"user_id\",\n"
" \"auth_method_id\": \"auth_method_id\",\n"
" \"account_id\": \"account_id\",\n"
" \"created_time\": \"token_created_time\",\n"
" \"updated_time\": \"token_updated_time\",\n"
" \"approximate_last_used_time\": \"token_approximate_last_used_time\",\n"
" \"expiration_time\": \"token_expiration_time\"\n"
"}\n"
"```\n"
"For OIDC auth methods, the initial parameters are:\n"
"```json\n"
"{\n"
" \"auth_url\": \"OIDC_auth_url\",\n"
" \"token_id\": \"OIDC_token_id\"\n"
"}\n"
"```\n"
"The `auth_url` is the URL that authenticating user should open "
"in the browser to authenticate with the OIDC provider. "
"The `token_id` should be used in subsequent calls to the `authenticate` endpoint "
"to retrieve the auth token.\n"
}
];
// 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"];