@@ -56,15 +56,51 @@ type BrokerSpec struct {
56
56
// BrokerAuthInfo is a union type that contains information on one of the authentication methods
57
57
// the the service catalog and brokers may support, according to the OpenServiceBroker API
58
58
// specification (https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md).
59
- //
60
- // Note that we currently restrict a single broker to have only one of these fields
61
- // set on it.
62
59
type BrokerAuthInfo struct {
60
+ // Basic provides configuration for basic authentication.
61
+ Basic * BasicAuthConfig
62
+ // BearerTokenAuthConfig provides configuration to send an opaque value as a bearer token.
63
+ // The value is referenced from the 'token' field of the given secret. This value should only
64
+ // contain the token value and not the `Bearer` scheme.
65
+ Bearer * BearerTokenAuthConfig
66
+
67
+ // DEPRECATED: use `Basic` field for configuring basic authentication instead.
63
68
// BasicAuthSecret is a reference to a Secret containing auth information the
64
69
// catalog should use to authenticate to this Broker using basic auth.
65
70
BasicAuthSecret * v1.ObjectReference
66
71
}
67
72
73
+ // BasicAuthConfig provides config for the basic authentication.
74
+ type BasicAuthConfig struct {
75
+ // SecretRef is a reference to a Secret containing information the
76
+ // catalog should use to authenticate to this Broker.
77
+ //
78
+ // Required at least one of the fields:
79
+ // - Secret.Data["username"] - username used for authentication
80
+ // - Secret.Data["password"] - password or token needed for authentication
81
+ SecretRef * v1.ObjectReference
82
+ }
83
+
84
+ // BearerTokenAuthConfig provides config for the bearer token authentication.
85
+ type BearerTokenAuthConfig struct {
86
+ // SecretRef is a reference to a Secret containing information the
87
+ // catalog should use to authenticate to this Broker.
88
+ //
89
+ // Required field:
90
+ // - Secret.Data["token"] - bearer token for authentication
91
+ SecretRef * v1.ObjectReference
92
+ }
93
+
94
+ const (
95
+ // BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets
96
+ BasicAuthUsernameKey = "username"
97
+ // BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets
98
+ BasicAuthPasswordKey = "password"
99
+
100
+ // BearerTokenKey is the key of the bearer token for SecretTypeBearerTokenAuth secrets
101
+ BearerTokenKey = "token"
102
+ )
103
+
68
104
// BrokerStatus represents the current status of a Broker.
69
105
type BrokerStatus struct {
70
106
Conditions []BrokerCondition
0 commit comments