Skip to content

Commit fb874df

Browse files
nileboxpmorie
authored andcommitted
Remove deprecated basic auth config support (#1431)
1 parent f4cd181 commit fb874df

File tree

10 files changed

+1
-85
lines changed

10 files changed

+1
-85
lines changed

pkg/apis/servicecatalog/types.go

-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ type ServiceBrokerAuthInfo struct {
100100
// The value is referenced from the 'token' field of the given secret. This value should only
101101
// contain the token value and not the `Bearer` scheme.
102102
Bearer *BearerTokenAuthConfig
103-
104-
// DEPRECATED: use `Basic` field for configuring basic authentication instead.
105-
// BasicAuthSecret is a reference to a Secret containing auth information the
106-
// catalog should use to authenticate to this ServiceBroker using basic auth.
107-
BasicAuthSecret *ObjectReference
108103
}
109104

110105
// BasicAuthConfig provides config for the basic authentication.

pkg/apis/servicecatalog/v1beta1/types.go

-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ type ServiceBrokerAuthInfo struct {
100100
// The value is referenced from the 'token' field of the given secret. This value should only
101101
// contain the token value and not the `Bearer` scheme.
102102
Bearer *BearerTokenAuthConfig `json:"bearer,omitempty"`
103-
104-
// DEPRECATED: use `Basic` field for configuring basic authentication instead.
105-
// BasicAuthSecret is a reference to a Secret containing auth information the
106-
// catalog should use to authenticate to this ServiceBroker using basic auth.
107-
BasicAuthSecret *ObjectReference `json:"basicAuthSecret,omitempty"`
108103
}
109104

110105
// BasicAuthConfig provides config for the basic authentication.

pkg/apis/servicecatalog/v1beta1/zz_generated.conversion.go

-2
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ func Convert_servicecatalog_ServiceBindingStatus_To_v1beta1_ServiceBindingStatus
792792
func autoConvert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthInfo(in *ServiceBrokerAuthInfo, out *servicecatalog.ServiceBrokerAuthInfo, s conversion.Scope) error {
793793
out.Basic = (*servicecatalog.BasicAuthConfig)(unsafe.Pointer(in.Basic))
794794
out.Bearer = (*servicecatalog.BearerTokenAuthConfig)(unsafe.Pointer(in.Bearer))
795-
out.BasicAuthSecret = (*servicecatalog.ObjectReference)(unsafe.Pointer(in.BasicAuthSecret))
796795
return nil
797796
}
798797

@@ -804,7 +803,6 @@ func Convert_v1beta1_ServiceBrokerAuthInfo_To_servicecatalog_ServiceBrokerAuthIn
804803
func autoConvert_servicecatalog_ServiceBrokerAuthInfo_To_v1beta1_ServiceBrokerAuthInfo(in *servicecatalog.ServiceBrokerAuthInfo, out *ServiceBrokerAuthInfo, s conversion.Scope) error {
805804
out.Basic = (*BasicAuthConfig)(unsafe.Pointer(in.Basic))
806805
out.Bearer = (*BearerTokenAuthConfig)(unsafe.Pointer(in.Bearer))
807-
out.BasicAuthSecret = (*ObjectReference)(unsafe.Pointer(in.BasicAuthSecret))
808806
return nil
809807
}
810808

pkg/apis/servicecatalog/v1beta1/zz_generated.deepcopy.go

-9
Original file line numberDiff line numberDiff line change
@@ -951,15 +951,6 @@ func (in *ServiceBrokerAuthInfo) DeepCopyInto(out *ServiceBrokerAuthInfo) {
951951
(*in).DeepCopyInto(*out)
952952
}
953953
}
954-
if in.BasicAuthSecret != nil {
955-
in, out := &in.BasicAuthSecret, &out.BasicAuthSecret
956-
if *in == nil {
957-
*out = nil
958-
} else {
959-
*out = new(ObjectReference)
960-
**out = **in
961-
}
962-
}
963954
return
964955
}
965956

pkg/apis/servicecatalog/validation/broker.go

-10
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ func validateClusterServiceBrokerSpec(spec *sc.ClusterServiceBrokerSpec, fldPath
8282
field.Required(fldPath.Child("authInfo", "bearer", "secretRef"), "a basic auth secret is required"),
8383
)
8484
}
85-
} else if spec.AuthInfo.BasicAuthSecret != nil {
86-
basicAuthSecret := spec.AuthInfo.BasicAuthSecret
87-
if basicAuthSecret != nil {
88-
for _, msg := range apivalidation.ValidateNamespaceName(basicAuthSecret.Namespace, false /* prefix */) {
89-
allErrs = append(allErrs, field.Invalid(fldPath.Child("authInfo", "basicAuthSecret", "namespace"), basicAuthSecret.Namespace, msg))
90-
}
91-
for _, msg := range apivalidation.NameIsDNSSubdomain(basicAuthSecret.Name, false /* prefix */) {
92-
allErrs = append(allErrs, field.Invalid(fldPath.Child("authInfo", "basicAuthSecret", "name"), basicAuthSecret.Name, msg))
93-
}
94-
}
9585
} else {
9686
// Authentication
9787
allErrs = append(

pkg/apis/servicecatalog/zz_generated.deepcopy.go

-9
Original file line numberDiff line numberDiff line change
@@ -951,15 +951,6 @@ func (in *ServiceBrokerAuthInfo) DeepCopyInto(out *ServiceBrokerAuthInfo) {
951951
(*in).DeepCopyInto(*out)
952952
}
953953
}
954-
if in.BasicAuthSecret != nil {
955-
in, out := &in.BasicAuthSecret, &out.BasicAuthSecret
956-
if *in == nil {
957-
*out = nil
958-
} else {
959-
*out = new(ObjectReference)
960-
**out = **in
961-
}
962-
}
963954
return
964955
}
965956

pkg/controller/controller.go

-13
Original file line numberDiff line numberDiff line change
@@ -445,19 +445,6 @@ func getAuthCredentialsFromClusterServiceBroker(client kubernetes.Interface, bro
445445
return &osb.AuthConfig{
446446
BearerConfig: bearerConfig,
447447
}, nil
448-
} else if authInfo.BasicAuthSecret != nil {
449-
secretRef := authInfo.BasicAuthSecret
450-
secret, err := client.Core().Secrets(secretRef.Namespace).Get(secretRef.Name, metav1.GetOptions{})
451-
if err != nil {
452-
return nil, err
453-
}
454-
basicAuthConfig, err := getBasicAuthConfig(secret)
455-
if err != nil {
456-
return nil, err
457-
}
458-
return &osb.AuthConfig{
459-
BasicAuthConfig: basicAuthConfig,
460-
}, nil
461448
}
462449
return nil, fmt.Errorf("empty auth info or unsupported auth mode: %s", authInfo)
463450
}

pkg/openapi/openapi_generated.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -1054,17 +1054,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
10541054
Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig"),
10551055
},
10561056
},
1057-
"basicAuthSecret": {
1058-
SchemaProps: spec.SchemaProps{
1059-
Description: "DEPRECATED: use `Basic` field for configuring basic authentication instead. BasicAuthSecret is a reference to a Secret containing auth information the catalog should use to authenticate to this ServiceBroker using basic auth.",
1060-
Ref: ref("github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ObjectReference"),
1061-
},
1062-
},
10631057
},
10641058
},
10651059
},
10661060
Dependencies: []string{
1067-
"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BasicAuthConfig", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ObjectReference"},
1061+
"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BasicAuthConfig", "github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.BearerTokenAuthConfig"},
10681062
},
10691063
"github.com/kubernetes-incubator/service-catalog/pkg/apis/servicecatalog/v1beta1.ServiceBrokerCondition": {
10701064
Schema: spec.Schema{

plugin/pkg/admission/broker/authsarcheck/admission.go

-3
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ func (s *sarcheck) Admit(a admission.Attributes) error {
9090
secretRef = clusterClusterServiceBroker.Spec.AuthInfo.Basic.SecretRef
9191
} else if clusterClusterServiceBroker.Spec.AuthInfo.Bearer != nil {
9292
secretRef = clusterClusterServiceBroker.Spec.AuthInfo.Bearer.SecretRef
93-
} else if clusterClusterServiceBroker.Spec.AuthInfo.BasicAuthSecret != nil {
94-
// TODO: this field is deprecated, remove in v1beta1
95-
secretRef = clusterClusterServiceBroker.Spec.AuthInfo.BasicAuthSecret
9693
}
9794
userInfo := a.GetUserInfo()
9895

plugin/pkg/admission/broker/authsarcheck/admission_test.go

-22
Original file line numberDiff line numberDiff line change
@@ -122,28 +122,6 @@ func TestAdmissionBroker(t *testing.T) {
122122
},
123123
allowed: true,
124124
},
125-
{
126-
name: "broker with basic auth, user authenticated (deprecated authinfo field)",
127-
broker: &servicecatalog.ClusterServiceBroker{
128-
ObjectMeta: metav1.ObjectMeta{
129-
Name: "test-broker",
130-
},
131-
Spec: servicecatalog.ClusterServiceBrokerSpec{
132-
URL: "http://example.com",
133-
AuthInfo: &servicecatalog.ServiceBrokerAuthInfo{
134-
BasicAuthSecret: &servicecatalog.ObjectReference{
135-
Namespace: "test-ns",
136-
Name: "test-secret",
137-
},
138-
},
139-
},
140-
},
141-
userInfo: &user.DefaultInfo{
142-
Name: "system:serviceaccount:test-ns:catalog",
143-
Groups: []string{"system:serviceaccount", "system:serviceaccounts:test-ns"},
144-
},
145-
allowed: true,
146-
},
147125
{
148126
name: "broker with bearer token, user authenticated",
149127
broker: &servicecatalog.ClusterServiceBroker{

0 commit comments

Comments
 (0)