Omit private key from session output
This commit is contained in:
1 parent
4669c95999
commit
5370111336
3 files changed
+9
-1
No files matched your search
@@ -85,6 +85,10 @@ type structInfo struct {
|
||||
|
||||
// createResponseTypes controls for which structs response types are created
|
||||
createResponseTypes bool
|
||||
|
||||
// fieldFilter is a set of field names that will not result in generated API
|
||||
// fields
|
||||
fieldFilter []string
|
||||
}
|
||||
|
||||
var inputStructs = []*structInfo{
|
||||
@@ -367,6 +371,7 @@ var inputStructs = []*structInfo{
|
||||
},
|
||||
pathArgs: []string{"session"},
|
||||
createResponseTypes: true,
|
||||
fieldFilter: []string{"private_key"},
|
||||
},
|
||||
{
|
||||
inProto: &sessions.SessionState{},
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/gen/controller/protooptions"
|
||||
"github.com/hashicorp/boundary/sdk/strutil"
|
||||
|
||||
"github.com/iancoleman/strcase"
|
||||
)
|
||||
@@ -41,6 +42,9 @@ func parsePBs() {
|
||||
in.generatedStructure.name = string(desc.Name())
|
||||
for i := 0; i < desc.Fields().Len(); i++ {
|
||||
fd := desc.Fields().Get(i)
|
||||
if strutil.StrListContains(in.fieldFilter, string(fd.Name())) {
|
||||
continue
|
||||
}
|
||||
fi := fieldInfo{
|
||||
Name: strcase.ToCamel(string(fd.Name())),
|
||||
ProtoName: string(fd.Name()),
|
||||
|
||||
@@ -31,7 +31,6 @@ type Session struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
WorkerInfo []*WorkerInfo `json:"worker_info,omitempty"`
|
||||
Certificate []byte `json:"certificate,omitempty"`
|
||||
PrivateKey []byte `json:"private_key,omitempty"`
|
||||
|
||||
responseBody *bytes.Buffer
|
||||
responseMap map[string]interface{}
|
||||
|
||||
Reference in new issue
Block a user