Skip to content

Commit

Permalink
gen stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bosorawis committed Nov 1, 2024
1 parent a1d3b4a commit 772cac2
Show file tree
Hide file tree
Showing 12 changed files with 445 additions and 388 deletions.
24 changes: 24 additions & 0 deletions api/authmethods/option.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/authmethods/password_auth_method_attributes.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/auth/password/auth_method.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewAuthMethod(ctx context.Context, scopeId string, opt ...Option) (*AuthMet
Description: opts.withDescription,
MinLoginNameLength: 3,
MinPasswordLength: 8,
AuthTokenTtl: int32(opts.withTokenTTL),
AuthTokenTtl: opts.withTokenTTL,
},
}
return a, nil
Expand Down
4 changes: 2 additions & 2 deletions internal/auth/password/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type options struct {
password string
withPassword bool
withOrderByCreateTime bool
withTokenTTL int
withTokenTTL uint32
ascending bool
withStartPageAfterItem pagination.Item
}
Expand All @@ -41,7 +41,7 @@ func getDefaultOptions() options {

// WithTokenTTL provides optional TTL configuration for tokens returned from
// this auth_method
func WithTokenTTL(ttlSeconds int) Option {
func WithTokenTTL(ttlSeconds uint32) Option {
return func(o *options) {
if ttlSeconds > 0 {
o.withTokenTTL = ttlSeconds
Expand Down
159 changes: 80 additions & 79 deletions internal/auth/password/store/password.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions internal/daemon/controller/handlers/authmethods/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,5 +225,9 @@ func toStoragePwAuthMethod(ctx context.Context, scopeId string, item *pb.AuthMet
if pwAttrs.GetMinPasswordLength() != 0 {
u.MinPasswordLength = pwAttrs.GetMinPasswordLength()
}

if pwAttrs.GetAuthTokenTtl() != 0 {
u.AuthTokenTtl = pwAttrs.GetAuthTokenTtl()
}
return u, nil
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright (c) HashiCorp, Inc.
-- SPDX-License-Identifier: BUSL-1.1

begin;

alter table auth_password_method
Expand Down
6 changes: 3 additions & 3 deletions internal/gen/controller.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11215,19 +11215,19 @@
"properties": {
"@type": {
"type": "string",
"description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics."
"description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics."
}
},
"additionalProperties": {},
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
"description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }"
},
"google.protobuf.NullValue": {
"type": "string",
"enum": [
"NULL_VALUE"
],
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
}
},
"securityDefinitions": {
Expand Down
2 changes: 1 addition & 1 deletion internal/gen/testing/event/testing.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"NULL_VALUE"
],
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"testing.event.v1.TestAuthMethodService.TestAuthenticateBody": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ message PasswordAuthMethodAttributes {
that: "MinPasswordLength"
}
]; // @gotags: `class:"public"`

// The TTL of auth tokens returned from authenticating against this auth method
uint32 auth_token_ttl = 30 [
json_name = "auth_token_ttl",
(custom_options.v1.generate_sdk_option) = true,
(custom_options.v1.mask_mapping) = {
this: "attributes.auth_token_ttl"
that: "AuthTokenTtl"
}
]; // @gotags: `class:"public"`
}

// The attributes of an OIDC typed auth method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,100 +12,100 @@ import "controller/storage/timestamp/v1/timestamp.proto";
option go_package = "github.com/hashicorp/boundary/internal/auth/password/store;store";

message AuthMethod {
// @inject_tag: `gorm:"primary_key"`
// @gotags: `gorm:"primary_key"`
string public_id = 1;

// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
// @gotags: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 2;

// The update_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
// @gotags: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp update_time = 3;

// name is optional. If set, it must be unique within scope_id.
// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
string name = 4 [(custom_options.v1.mask_mapping) = {
this: "Name"
that: "name"
}];

// description is optional.
// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
string description = 5 [(custom_options.v1.mask_mapping) = {
this: "Description"
that: "description"
}];

// The scope_id of the owning scope. Must be set.
// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string scope_id = 6;

// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
uint32 version = 7;

// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string password_conf_id = 8;

// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
uint32 min_login_name_length = 9 [(custom_options.v1.mask_mapping) = {
this: "MinLoginNameLength"
that: "attributes.min_login_name_length"
}];

// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
uint32 min_password_length = 10 [(custom_options.v1.mask_mapping) = {
this: "MinPasswordLength"
that: "attributes.min_password_length"
}];

// auth_token_ttl is a TTL (in seconds) for tokens that are returned from
// authenticating against this auth method.
// @inject_tag: `gorm:"default:null"`
int32 auth_token_ttl = 11 [(custom_options.v1.mask_mapping) = {
// @gotags: `gorm:"default:null"`
uint32 auth_token_ttl = 11 [(custom_options.v1.mask_mapping) = {
this: "AuthTokenTtl"
that: "auth_token_ttl"
that: "attributes.auth_token_ttl"
}];

// is_primary_auth_method is a read-only output field which indicates if the
// auth method is set as the scope's primary auth method.
// @inject_tag: `gorm:"->"`
// @gotags: `gorm:"->"`
bool is_primary_auth_method = 20;
}

message Account {
// @inject_tag: `gorm:"primary_key"`
// @gotags: `gorm:"primary_key"`
string public_id = 1;

// The create_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
// @gotags: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp create_time = 2;

// The update_time is set by the database.
// @inject_tag: `gorm:"default:current_timestamp"`
// @gotags: `gorm:"default:current_timestamp"`
timestamp.v1.Timestamp update_time = 3;

// name is optional. If set, it must be unique within scope_id.
// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
string name = 4 [(custom_options.v1.mask_mapping) = {
this: "Name"
that: "name"
}];

// description is optional.
// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
string description = 5 [(custom_options.v1.mask_mapping) = {
this: "Description"
that: "description"
}];

// @inject_tag: `gorm:"default:null"`
// @gotags: `gorm:"default:null"`
uint32 version = 6;

// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string auth_method_id = 7;

// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string login_name = 8 [(custom_options.v1.mask_mapping) = {
this: "LoginName"
that: "attributes.login_name"
Expand All @@ -116,12 +116,12 @@ message Account {
}

message Credential {
// @inject_tag: `gorm:"primary_key"`
// @gotags: `gorm:"primary_key"`
string private_id = 1;
// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string password_account_id = 2;
// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string password_conf_id = 3;
// @inject_tag: `gorm:"not_null"`
// @gotags: `gorm:"not_null"`
string password_method_id = 4;
}
Loading

0 comments on commit 772cac2

Please sign in to comment.