Auth Method API Handler for CRUDL (not updating password specific fields)(#239)
This commit is contained in:
1 parent
7fefd5e2fe
commit
b7bf76a9ba
15 files changed
+3676
-21
No files matched your search
@@ -0,0 +1,50 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.resources.auth.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/watchtower/internal/gen/controller/api/resources/auth;auth";
|
||||
|
||||
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/masks.proto";
|
||||
|
||||
// AuthMethod contains all fields related to a AuthMethod resource
|
||||
message AuthMethod {
|
||||
// The ID of the AuthMethod
|
||||
// Output only.
|
||||
string id = 1;
|
||||
|
||||
// Scope information for this resource
|
||||
// Output only.
|
||||
resources.scopes.v1.ScopeInfo scope = 2;
|
||||
|
||||
// Optional name for identification purposes
|
||||
google.protobuf.StringValue name = 3 [(custom_options.v1.mask_mapping) = {this:"name" that: "name"}];
|
||||
|
||||
// Optional user-set descripton for identification purposes
|
||||
google.protobuf.StringValue description = 4 [(custom_options.v1.mask_mapping) = {this:"description" that: "description"}];
|
||||
|
||||
// The time this resource was created
|
||||
// Output only.
|
||||
google.protobuf.Timestamp created_time = 5 [json_name="created_time"];
|
||||
|
||||
// The time this resource was last updated.
|
||||
// Output only.
|
||||
google.protobuf.Timestamp updated_time = 6 [json_name="updated_time"];
|
||||
|
||||
// The auth method type. This can be "password" or "oidc".
|
||||
string type = 7;
|
||||
|
||||
// The attributes that are applied for the specific Auth Method type.
|
||||
google.protobuf.Struct attributes = 8;
|
||||
}
|
||||
|
||||
message PasswordAuthMethodAttributes {
|
||||
// The minimum length allowed for user names for accounts in this auth method.
|
||||
uint32 min_user_name_length = 1;
|
||||
|
||||
// The minimum length allowed for passwords for accounts in this auth method.
|
||||
uint32 min_password_length = 2;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.api.services.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/watchtower/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/auth/v1/auth_method.proto";
|
||||
|
||||
service AuthMethodService {
|
||||
// GetAuthMethod returns a stored AuthMethod if present. The provided request
|
||||
// must include the org and auth method id for the auth method being retrieved. If
|
||||
// any of those ids are missing, malformed or reference a non existing
|
||||
// resource an error is returned.
|
||||
rpc GetAuthMethod(GetAuthMethodRequest) returns (GetAuthMethodResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/scopes/*/auth-methods/{id}"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Gets a single AuthMethod"
|
||||
};
|
||||
}
|
||||
|
||||
// ListAuthMethods returns a list of stored auth methods which exist inside the org
|
||||
// referenced inside the request. The request must include the org id for
|
||||
// the auth methods being retrieved. If the org id is missing, malformed, or
|
||||
// reference a non existing organization, an error is returned.
|
||||
rpc ListAuthMethods(ListAuthMethodsRequest) returns (ListAuthMethodsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/scopes/*/auth-methods"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Lists all AuthMethods"
|
||||
};
|
||||
}
|
||||
|
||||
// CreateAuthMethod creates and stores a user in watchtower. The provided
|
||||
// request must include the org id in which the user will be created.
|
||||
// If the org id is missing, malformed or references a non existing
|
||||
// org, an error is returned. If a name is provided that is in
|
||||
// use in another user in the same org, an error is returned.
|
||||
rpc CreateAuthMethod(CreateAuthMethodRequest) returns (CreateAuthMethodResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/scopes/*/auth-methods"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Creates a single AuthMethod"
|
||||
};
|
||||
}
|
||||
|
||||
// UpdateAuthMethod updates an existing user in watchtower. The provided
|
||||
// user 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 either the org
|
||||
// or user ids are 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 in this org.
|
||||
rpc UpdateAuthMethod(UpdateAuthMethodRequest) returns (UpdateAuthMethodResponse) {
|
||||
option (google.api.http) = {
|
||||
patch: "/v1/scopes/*/auth-methods/{id}"
|
||||
body: "item"
|
||||
response_body: "item"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Updates an AuthMethod"
|
||||
};
|
||||
}
|
||||
|
||||
// DeleteAuthMethod removes a user from Watchtower. If the provided org or user ids
|
||||
// are malformed or not provided an error is returned. No error is returned
|
||||
// if either ids reference resources that do not exist as the response itself
|
||||
// specifies if the resource existed before the DeleteAuthMethod request was
|
||||
// received.
|
||||
rpc DeleteAuthMethod(DeleteAuthMethodRequest) returns (DeleteAuthMethodResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/v1/scopes/*/auth-methods/{id}"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Deletes an AuthMethod"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetAuthMethodRequest {
|
||||
string id = 1;
|
||||
string view = 2;
|
||||
}
|
||||
|
||||
message GetAuthMethodResponse {
|
||||
resources.auth.v1.AuthMethod item = 1;
|
||||
}
|
||||
|
||||
message ListAuthMethodsRequest {
|
||||
string view = 1;
|
||||
}
|
||||
|
||||
message ListAuthMethodsResponse {
|
||||
repeated resources.auth.v1.AuthMethod items = 1;
|
||||
}
|
||||
|
||||
message CreateAuthMethodRequest {
|
||||
resources.auth.v1.AuthMethod item = 1;
|
||||
}
|
||||
|
||||
message CreateAuthMethodResponse {
|
||||
string uri = 1;
|
||||
resources.auth.v1.AuthMethod item = 2;
|
||||
}
|
||||
|
||||
message UpdateAuthMethodRequest {
|
||||
string id = 1;
|
||||
resources.auth.v1.AuthMethod item = 2;
|
||||
google.protobuf.FieldMask update_mask = 3;
|
||||
}
|
||||
|
||||
message UpdateAuthMethodResponse {
|
||||
resources.auth.v1.AuthMethod item = 1;
|
||||
}
|
||||
|
||||
message DeleteAuthMethodRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message DeleteAuthMethodResponse {
|
||||
bool existed = 1;
|
||||
}
|
||||
Reference in new issue
Block a user