Merge remote-tracking branch 'origin/main' into plugin-hostcatalogs

This commit is contained in:
Jeff Mitchell committed 2021-10-27 21:57:30 -04:00
commit b1a72bd445
69 files changed
+1213 -277

No files matched your search

@@ -452,9 +452,9 @@ type OidcAuthMethodAuthenticateStartResponse struct {
unknownFields protoimpl.UnknownFields
// The returned authentication URL
AuthUrl string `protobuf:"bytes,10,opt,name=auth_url,proto3" json:"auth_url,omitempty"`
AuthUrl string `protobuf:"bytes,10,opt,name=auth_url,proto3" json:"auth_url,omitempty" class:"public"` // @gotags: `class:"public"`
// The returned token ID
TokenId string `protobuf:"bytes,30,opt,name=token_id,proto3" json:"token_id,omitempty"`
TokenId string `protobuf:"bytes,30,opt,name=token_id,proto3" json:"token_id,omitempty" class:"public"` // @gotags: `class:"public"`
}
func (x *OidcAuthMethodAuthenticateStartResponse) Reset() {
@@ -510,13 +510,13 @@ type OidcAuthMethodAuthenticateCallbackRequest struct {
unknownFields protoimpl.UnknownFields
// The returned code
Code string `protobuf:"bytes,10,opt,name=code,proto3" json:"code,omitempty"`
Code string `protobuf:"bytes,10,opt,name=code,proto3" json:"code,omitempty" class:"secret"` // @gotags: `class:"secret"`
// The returned state
State string `protobuf:"bytes,20,opt,name=state,proto3" json:"state,omitempty"`
State string `protobuf:"bytes,20,opt,name=state,proto3" json:"state,omitempty" class:"public"` // @gotags: `class:"public"`
// Error parameters, if they are returned
Error string `protobuf:"bytes,30,opt,name=error,proto3" json:"error,omitempty"`
ErrorDescription string `protobuf:"bytes,40,opt,name=error_description,proto3" json:"error_description,omitempty"`
ErrorUri string `protobuf:"bytes,50,opt,name=error_uri,proto3" json:"error_uri,omitempty"`
Error string `protobuf:"bytes,30,opt,name=error,proto3" json:"error,omitempty" class:"public"` // @gotags: `class:"public"`
ErrorDescription string `protobuf:"bytes,40,opt,name=error_description,proto3" json:"error_description,omitempty" class:"public"` // @gotags: `class:"public"`
ErrorUri string `protobuf:"bytes,50,opt,name=error_uri,proto3" json:"error_uri,omitempty" class:"public"` // @gotags: `class:"public"`
}
func (x *OidcAuthMethodAuthenticateCallbackRequest) Reset() {
@@ -593,7 +593,7 @@ type OidcAuthMethodAuthenticateCallbackResponse struct {
unknownFields protoimpl.UnknownFields
// The final redirection URL
FinalRedirectUrl string `protobuf:"bytes,10,opt,name=final_redirect_url,proto3" json:"final_redirect_url,omitempty"`
FinalRedirectUrl string `protobuf:"bytes,10,opt,name=final_redirect_url,proto3" json:"final_redirect_url,omitempty" class:"public"` // @gotags: `class:"public"`
}
func (x *OidcAuthMethodAuthenticateCallbackResponse) Reset() {
@@ -642,7 +642,7 @@ type OidcAuthMethodAuthenticateTokenRequest struct {
unknownFields protoimpl.UnknownFields
// The ID of the pending token
TokenId string `protobuf:"bytes,10,opt,name=token_id,proto3" json:"token_id,omitempty"`
TokenId string `protobuf:"bytes,10,opt,name=token_id,proto3" json:"token_id,omitempty" class:"private"` // @gotags: `class:"private"`
}
func (x *OidcAuthMethodAuthenticateTokenRequest) Reset() {
@@ -693,7 +693,7 @@ type OidcAuthMethodAuthenticateTokenResponse struct {
// The status. This will always be "unknown". It will never be forwarded to
// the consumer.
Status string `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty"`
Status string `protobuf:"bytes,10,opt,name=status,proto3" json:"status,omitempty" class:"public"` // @gotags: `class:"public"`
}
func (x *OidcAuthMethodAuthenticateTokenResponse) Reset() {
@@ -45,6 +45,10 @@ func (req *AuthMethod) Tags() ([]encrypt.PointerTag, error) {
Pointer: "/Attributes/Fields/signing_algorithms",
Classification: encrypt.PublicClassification,
},
{
Pointer: "/Attributes/Fields/idp_ca_certs",
Classification: encrypt.PublicClassification,
},
{
Pointer: "/Attributes/Fields/api_url_prefix",
Classification: encrypt.PublicClassification,
@@ -6,9 +6,9 @@ import (
"testing"
"time"
"github.com/hashicorp/boundary/sdk/pbs/controller/api"
"github.com/hashicorp/boundary/sdk/wrapper"
"github.com/hashicorp/eventlogger"
"github.com/hashicorp/eventlogger/filters/encrypt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/structpb"
@@ -19,11 +19,7 @@ func TestAuthMethod_Tags(t *testing.T) {
ctx := context.Background()
now := time.Now()
wrapper := wrapper.TestWrapper(t)
testEncryptingFilter := &encrypt.Filter{
Wrapper: wrapper,
HmacSalt: []byte("salt"),
HmacInfo: []byte("info"),
}
testEncryptingFilter := api.NewEncryptFilter(t, wrapper)
tests := []struct {
name string
@@ -49,6 +45,7 @@ func TestAuthMethod_Tags(t *testing.T) {
"client_secret_hmac": structpb.NewStringValue("public-client_secret_hmac"),
"max_age": structpb.NewStringValue("public-max_age"),
"signing_algorithms": structpb.NewStringValue("public-signing_algorithms"),
"idp_ca_certs": structpb.NewStringValue("public-signing_algorithms"),
"api_url_prefix": structpb.NewStringValue("public-api_url_prefix"),
"callback_url": structpb.NewStringValue("public-callback_url"),
"allowed_audiences": structpb.NewStringValue("public-allowed_audiences"),
@@ -87,6 +84,7 @@ func TestAuthMethod_Tags(t *testing.T) {
"client_secret_hmac": structpb.NewStringValue("public-client_secret_hmac"),
"max_age": structpb.NewStringValue("public-max_age"),
"signing_algorithms": structpb.NewStringValue("public-signing_algorithms"),
"idp_ca_certs": structpb.NewStringValue("public-signing_algorithms"),
"api_url_prefix": structpb.NewStringValue("public-api_url_prefix"),
"callback_url": structpb.NewStringValue("public-callback_url"),
"allowed_audiences": structpb.NewStringValue("public-allowed_audiences"),
@@ -119,7 +117,7 @@ func TestAuthMethod_Tags(t *testing.T) {
ScopeId: "scope-id",
Name: &wrapperspb.StringValue{Value: "name"},
Description: &wrapperspb.StringValue{Value: "description"},
Type: "oidc",
Type: "password",
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
"min_login_name_length": structpb.NewStringValue("public-min_login_name_length"),
@@ -145,7 +143,7 @@ func TestAuthMethod_Tags(t *testing.T) {
ScopeId: "scope-id",
Name: &wrapperspb.StringValue{Value: "name"},
Description: &wrapperspb.StringValue{Value: "description"},
Type: "oidc",
Type: "password",
Attributes: &structpb.Struct{
Fields: map[string]*structpb.Value{
"min_login_name_length": structpb.NewStringValue("public-min_login_name_length"),
+23
View File
@@ -0,0 +1,23 @@
package api
import (
"reflect"
"testing"
"github.com/hashicorp/eventlogger/filters/encrypt"
wrapping "github.com/hashicorp/go-kms-wrapping"
"google.golang.org/protobuf/types/known/fieldmaskpb"
)
// NewEncryptFilter is a copy of event.NewEncryptFilter since importing it would
// case circular deps. The primary reason for this test func is to make sure
// the proper IgnoreTypes are included for testing.
func NewEncryptFilter(t *testing.T, w wrapping.Wrapper) *encrypt.Filter {
t.Helper()
return &encrypt.Filter{
Wrapper: w,
IgnoreTypes: []reflect.Type{
reflect.TypeOf(&fieldmaskpb.FieldMask{}),
},
}
}