2020-08-06 12:50:20 -07:00
syntax = "proto3" ;
package controller.api.services.v1 ;
2020-08-10 17:15:02 -04:00
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/api/services;services" ;
2020-08-06 12:50:20 -07:00
import "protoc-gen-openapiv2/options/annotations.proto" ;
import "google/api/annotations.proto" ;
import "google/protobuf/field_mask.proto" ;
2020-10-12 18:03:15 -04:00
import "google/protobuf/struct.proto" ;
2020-08-07 12:55:02 -04:00
import "controller/api/resources/authmethods/v1/auth_method.proto" ;
2020-08-06 12:50:20 -07:00
service AuthMethodService {
2020-09-29 13:17:59 -07:00
// GetAuthMethod returns a stored Auth Method if present. The provided request
// must include the Auth Method id. If missing, malformed or referencing a
2021-04-08 20:54:32 -04:00
// non existing resource an error is returned.
2020-08-06 12:50:20 -07:00
rpc GetAuthMethod ( GetAuthMethodRequest ) returns ( GetAuthMethodResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
get : "/v1/auth-methods/{id}"
2020-08-06 12:50:20 -07:00
response_body : "item"
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
2020-09-29 13:17:59 -07:00
summary : "Gets a single Auth Method."
2020-08-06 12:50:20 -07:00
};
}
2020-09-29 13:17:59 -07:00
// ListAuthMethods returns a list of stored Auth Methods 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.
2020-08-06 12:50:20 -07:00
rpc ListAuthMethods ( ListAuthMethodsRequest ) returns ( ListAuthMethodsResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
get : "/v1/auth-methods"
2020-08-06 12:50:20 -07:00
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
2020-09-29 13:17:59 -07:00
summary : "Lists all Auth Methods."
2020-08-06 12:50:20 -07:00
};
}
2020-09-29 13:17:59 -07:00
// 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
// 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.
2020-08-06 12:50:20 -07:00
rpc CreateAuthMethod ( CreateAuthMethodRequest ) returns ( CreateAuthMethodResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
post : "/v1/auth-methods"
2020-08-06 12:50:20 -07:00
body : "item"
response_body : "item"
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
2020-09-29 13:17:59 -07:00
summary : "Creates a single Auth Method."
2020-08-06 12:50:20 -07:00
};
}
2020-09-29 13:17:59 -07:00
// UpdateAuthMethod updates an existing Auth Method in boundary. The provided
// Auth Method must not have any read only fields set. The update mask must be
2020-08-06 12:50:20 -07:00
// 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
2020-09-29 13:17:59 -07:00
// 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.
2020-08-06 12:50:20 -07:00
rpc UpdateAuthMethod ( UpdateAuthMethodRequest ) returns ( UpdateAuthMethodResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
patch : "/v1/auth-methods/{id}"
2020-08-06 12:50:20 -07:00
body : "item"
response_body : "item"
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
2020-09-29 13:17:59 -07:00
summary : "Updates an Auth Method."
2020-08-06 12:50:20 -07:00
};
}
2020-09-29 13:17:59 -07:00
// DeleteAuthMethod removes an Auth Method from Boundary. If the Auth Method id
// is malformed or not provided an error is returned.
2020-08-06 12:50:20 -07:00
rpc DeleteAuthMethod ( DeleteAuthMethodRequest ) returns ( DeleteAuthMethodResponse ) {
option ( google.api.http ) = {
2020-09-02 19:43:41 -07:00
delete : "/v1/auth-methods/{id}"
2020-08-06 12:50:20 -07:00
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
summary : "Deletes an AuthMethod"
};
}
2020-10-12 18:03:15 -04:00
2021-04-08 20:54:32 -04:00
// ChangeState changes the state of an Auth Method from Boundary.
rpc ChangeState ( ChangeStateRequest ) returns ( ChangeStateResponse ) {
2020-10-12 18:03:15 -04:00
option ( google.api.http ) = {
2021-04-08 20:54:32 -04:00
post : "/v1/auth-methods/{id}:change-state"
2020-10-12 18:03:15 -04:00
body : "*"
response_body : "item"
};
2021-02-10 15:43:59 -05:00
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
2021-04-08 20:54:32 -04:00
summary : "Changes the state of an OIDC AuthMethod"
2021-02-10 15:43:59 -05:00
};
2021-04-08 20:54:32 -04:00
}
2021-03-24 16:07:43 -04:00
2021-04-08 20:54:32 -04:00
// 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 : "*"
};
option ( grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation ) = {
summary : "Authenticate a user to an scope and retrieve an authentication token."
};
2021-02-10 15:43:59 -05:00
}
2020-08-06 12:50:20 -07:00
}
message GetAuthMethodRequest {
2021-10-27 09:37:14 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-08-06 12:50:20 -07:00
}
message GetAuthMethodResponse {
2020-08-07 12:55:02 -04:00
resources.authmethods.v1.AuthMethod item = 1 ;
2020-08-06 12:50:20 -07:00
}
message ListAuthMethodsRequest {
2021-04-08 20:54:32 -04:00
string scope_id = 1 [ json_name = "scope_id" ];
bool recursive = 20 [ json_name = "recursive" ];
string filter = 30 [ json_name = "filter" ];
2020-08-06 12:50:20 -07:00
}
message ListAuthMethodsResponse {
2020-08-07 12:55:02 -04:00
repeated resources.authmethods.v1.AuthMethod items = 1 ;
2020-08-06 12:50:20 -07:00
}
message CreateAuthMethodRequest {
2020-08-07 12:55:02 -04:00
resources.authmethods.v1.AuthMethod item = 1 ;
2020-08-06 12:50:20 -07:00
}
message CreateAuthMethodResponse {
2021-10-27 09:37:14 -04:00
string uri = 1 ; // @gotags: `class:"public"`
2020-08-07 12:55:02 -04:00
resources.authmethods.v1.AuthMethod item = 2 ;
2020-08-06 12:50:20 -07:00
}
message UpdateAuthMethodRequest {
2021-10-27 09:37:14 -04:00
string id = 1 ; // @gotags: `class:"public"`
2020-08-18 17:38:38 -07:00
resources.authmethods.v1.AuthMethod item = 2 ;
2021-04-08 20:54:32 -04:00
google.protobuf.FieldMask update_mask = 3 [ json_name = "update_mask" ];
2020-08-06 12:50:20 -07:00
}
message UpdateAuthMethodResponse {
2020-08-07 12:55:02 -04:00
resources.authmethods.v1.AuthMethod item = 1 ;
2020-08-06 12:50:20 -07:00
}
message DeleteAuthMethodRequest {
string id = 1 ;
}
2020-09-08 23:57:26 -04:00
message DeleteAuthMethodResponse {}
2020-10-12 18:03:15 -04:00
2021-04-08 20:54:32 -04:00
// 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 ;
// 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.
2021-04-12 08:49:22 -07:00
bool disable_discovered_config_validation = 2 [ json_name = "disable_discovered_config_validation" ];
2021-04-08 20:54:32 -04:00
}
message ChangeStateRequest {
2021-10-27 09:37:14 -04:00
string id = 1 ; // @gotags: `class:"public"`
2021-04-08 20:54:32 -04:00
// 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 ;
// The attributes specific to this auth method's state.
google.protobuf.Struct attributes = 4 ;
}
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.
message PasswordLoginAttributes {
string login_name = 1 [ json_name = "login_name" ];
2020-10-12 18:03:15 -04:00
string password = 2 ;
}
2021-04-08 20:54:32 -04:00
// 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.
google.protobuf.Struct roundtrip_payload = 1 [ json_name = "roundtrip_payload" ];
// Cached marshaled payload. This is not ingressed from the client; anything found will be thrown out.
string cached_roundtrip_payload = 2 ;
}
// The layout of the struct for "attributes" field in AuthenticateRequest for a
// oidc type's token command. This message isn't directly referenced anywhere
// but is used here to define the expected field names and types.
message OidcTokenAttributes {
// The token id for the request. This is the token id that was returned from
// the oidc type's start command
string token_id = 1 ;
}
2020-10-12 18:03:15 -04:00
message AuthenticateRequest {
// The ID of the Auth Method in the system that should be used for authentication.
2021-09-30 12:55:47 -04:00
string auth_method_id = 1 [ json_name = "auth_method_id" ]; // @gotags: `class:"public"`
2021-04-08 20:54:32 -04:00
// 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.
2021-10-27 09:37:14 -04:00
string token_type = 2 [ json_name = "token_type" ]; // @gotags: `class:"public"`
2021-03-24 16:07:43 -04:00
// Attributes are passed to the Auth Method; the valid keys and values depend on the type of Auth Method as well as the command.
2021-04-08 20:54:32 -04:00
google.protobuf.Struct attributes = 4 [ json_name = "attributes" ];
2021-03-24 16:07:43 -04:00
// The command to perform.
2021-09-30 12:55:47 -04:00
string command = 5 [ json_name = "command" ]; // @gotags: `class:"public"`
2021-09-17 18:23:24 -07:00
// Deprecated fields
reserved "credentials" ;
reserved 3 ;
2020-10-12 18:03:15 -04:00
}
message AuthenticateResponse {
2021-04-08 20:54:32 -04:00
reserved 1 , 2 ; // Old item and token_type
reserved "item" , "token_type" ;
// Valid keys and values depend on the type of Auth Method as well as the command.
google.protobuf.Struct attributes = 4 [ json_name = "attributes" ];
// The command that was performed.
2021-09-30 12:55:47 -04:00
string command = 5 [ json_name = "command" ]; // @gotags: `class:"public"`
2021-02-10 15:43:59 -05:00
}