feat(authmethods): add well typed attribute options (#1972)

Add well typed attribute options to the authmethods proto
definitions, while hiding them from being rendered in
the openapiv2 spec.
This commit is contained in:
Johan Brandhorst-Satzkorn committed 2022-04-20 13:32:31 -04:00
1 parent ec25e7682c
commit 53481146fd
20 files changed
+1544 -1549

No files matched your search

@@ -7,9 +7,12 @@ option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/api/resour
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "google/api/visibility.proto";
import "controller/api/resources/scopes/v1/scope.proto";
import "controller/custom_options/v1/options.proto";
option (custom_options.v1.domain) = "auth";
// AuthMethod contains all fields related to an Auth Method resource
message AuthMethod {
// Output only. The ID of the Auth Method.
@@ -41,8 +44,20 @@ message AuthMethod {
// The Auth Method type.
string type = 90; // @gotags: `class:"public"`
// The attributes that are applicable for the specific Auth Method type.
google.protobuf.Struct attributes = 100 [(custom_options.v1.generate_sdk_option) = true];
oneof attrs {
// 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"];
PasswordAuthMethodAttributes password_auth_method_attributes = 101 [
(custom_options.v1.generate_sdk_option) = true,
(custom_options.v1.subtype) = "password",
(google.api.field_visibility).restriction = "INTERNAL"
];
OidcAuthMethodAttributes oidc_auth_methods_attributes = 102 [
(custom_options.v1.generate_sdk_option) = true,
(custom_options.v1.subtype) = "oidc",
(google.api.field_visibility).restriction = "INTERNAL"
];
}
// Output only. 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.
@@ -52,7 +67,7 @@ message AuthMethod {
repeated string authorized_actions = 300 [json_name = "authorized_actions"]; // @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"];
map<string, google.protobuf.ListValue> authorized_collection_actions = 310 [json_name = "authorized_collection_actions"]; // classified as public via taggable implementation
}
// The attributes of a password typed auth method.
@@ -191,4 +206,4 @@ message OidcAuthMethodAuthenticateTokenResponse {
// The status. This will always be "unknown". It will never be forwarded to
// the consumer.
string status = 10; // @gotags: `class:"public"`
}
}
@@ -6,9 +6,13 @@ 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/api/visibility.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";
import "controller/api/resources/authmethods/v1/auth_method.proto";
import "controller/custom_options/v1/options.proto";
option (custom_options.v1.domain) = "auth";
service AuthMethodService {
// GetAuthMethod returns a stored Auth Method if present. The provided request
@@ -165,8 +169,11 @@ message ChangeStateRequest {
// The mutation will fail if the version does not match the latest known good version.
uint32 version = 2;
// The attributes specific to this auth method's state.
google.protobuf.Struct attributes = 4;
oneof attrs {
// The attributes specific to this auth method's state.
google.protobuf.Struct attributes = 4 [(custom_options.v1.subtype) = "default"];
OidcChangeStateAttributes oidc_change_state_attributes = 5 [(custom_options.v1.subtype) = "oidc", (google.api.field_visibility).restriction = "INTERNAL"];
}
}
message ChangeStateResponse {