@@ -134,6 +134,13 @@ func getServerConfigFromEnv() (*auth_providers.Server, error) {
134
134
apiPath , aOk := os .LookupEnv (auth_providers .EnvKeyfactorAPIPath )
135
135
clientId , cOk := os .LookupEnv (auth_providers .EnvKeyfactorClientID )
136
136
clientSecret , csOk := os .LookupEnv (auth_providers .EnvKeyfactorClientSecret )
137
+ audience , _ := os .LookupEnv (auth_providers .EnvKeyfactorAuthAudience )
138
+ scopesCSV , _ := os .LookupEnv (auth_providers .EnvKeyfactorAuthScopes )
139
+ var scopes []string
140
+ if scopesCSV != "" {
141
+ scopes = strings .Split (scopesCSV , "," )
142
+ }
143
+
137
144
tokenUrl , tOk := os .LookupEnv (auth_providers .EnvKeyfactorAuthTokenURL )
138
145
skipVerify , svOk := os .LookupEnv (auth_providers .EnvKeyfactorSkipVerify )
139
146
var skipVerifyBool bool
@@ -160,24 +167,44 @@ func getServerConfigFromEnv() (*auth_providers.Server, error) {
160
167
}
161
168
162
169
if isBasicAuth {
163
- log .Debug ().
164
- Str ("username" , username ).
165
- Str ("password" , hashSecretValue (password )).
166
- Str ("domain" , domain ).
167
- Str ("hostname" , hostname ).
170
+
171
+ log .Debug ().Str ("hostname" , hostname ).
168
172
Str ("apiPath" , apiPath ).
169
173
Bool ("skipVerify" , skipVerifyBool ).
170
- Msg ("call: basicAuthNoParamsConfig.Authenticate() " )
174
+ Msg ("setting up basic auth client base configuration " )
171
175
basicAuthNoParamsConfig .WithCommandHostName (hostname ).
172
176
WithCommandAPIPath (apiPath ).
173
177
WithSkipVerify (skipVerifyBool )
174
178
175
- bErr := basicAuthNoParamsConfig .
179
+ log .Debug ().
180
+ Str ("username" , username ).
181
+ Str ("password" , hashSecretValue (password )).
182
+ Str ("domain" , domain ).
183
+ Msg ("setting up basic auth configuration" )
184
+ _ = basicAuthNoParamsConfig .
176
185
WithUsername (username ).
177
186
WithPassword (password ).
178
- WithDomain (domain ).
179
- Authenticate ()
180
- log .Debug ().Msg ("complete: basicAuthNoParamsConfig.Authenticate()" )
187
+ WithDomain (domain )
188
+
189
+ log .Debug ().
190
+ Str ("username" , basicAuthNoParamsConfig .Username ).
191
+ Str ("password" , hashSecretValue (password )).
192
+ Str ("domain" , basicAuthNoParamsConfig .Domain ).
193
+ Str ("hostname" , basicAuthNoParamsConfig .CommandHostName ).
194
+ Str ("apiPath" , basicAuthNoParamsConfig .CommandAPIPath ).
195
+ Bool ("skipVerify" , basicAuthNoParamsConfig .CommandAuthConfig .SkipVerify ).
196
+ Msg (fmt .Sprintf ("%s basicAuthNoParamsConfig.Authenticate()" , DebugFuncCall ))
197
+
198
+ bErr := basicAuthNoParamsConfig .Authenticate ()
199
+ log .Debug ().
200
+ Str ("username" , basicAuthNoParamsConfig .Username ).
201
+ Str ("password" , hashSecretValue (password )).
202
+ Str ("domain" , basicAuthNoParamsConfig .Domain ).
203
+ Str ("hostname" , basicAuthNoParamsConfig .CommandHostName ).
204
+ Str ("apiPath" , basicAuthNoParamsConfig .CommandAPIPath ).
205
+ Bool ("skipVerify" , basicAuthNoParamsConfig .CommandAuthConfig .SkipVerify ).
206
+ Msg ("complete: basicAuthNoParamsConfig.Authenticate()" )
207
+
181
208
if bErr != nil {
182
209
log .Error ().Err (bErr ).Msg ("unable to authenticate with provided credentials" )
183
210
return nil , bErr
@@ -186,16 +213,36 @@ func getServerConfigFromEnv() (*auth_providers.Server, error) {
186
213
return basicAuthNoParamsConfig .GetServerConfig (), nil
187
214
} else if isOAuth {
188
215
log .Debug ().
189
- Str ("clientId" , clientId ).
190
- Str ("clientSecret" , hashSecretValue (clientSecret )).
191
- Str ("tokenUrl" , tokenUrl ).
192
216
Str ("hostname" , hostname ).
193
217
Str ("apiPath" , apiPath ).
194
218
Bool ("skipVerify" , skipVerifyBool ).
195
- Msg ("call: oAuthNoParamsConfig.Authenticate() " )
219
+ Msg ("setting up oAuth client base configuration " )
196
220
_ = oAuthNoParamsConfig .CommandAuthConfig .WithCommandHostName (hostname ).
197
221
WithCommandAPIPath (apiPath ).
198
222
WithSkipVerify (skipVerifyBool )
223
+
224
+ log .Debug ().
225
+ Str ("clientId" , clientId ).
226
+ Str ("clientSecret" , hashSecretValue (clientSecret )).
227
+ Str ("tokenUrl" , tokenUrl ).
228
+ Str ("audience" , audience ).
229
+ Strs ("scopes" , scopes ).
230
+ Msg ("setting up oAuth configuration" )
231
+ _ = oAuthNoParamsConfig .WithClientId (clientId ).
232
+ WithClientSecret (clientSecret ).
233
+ WithTokenUrl (tokenUrl ).
234
+ WithAudience (audience ).
235
+ WithScopes (scopes )
236
+
237
+ log .Debug ().
238
+ Str ("clientId" , oAuthNoParamsConfig .ClientID ).
239
+ Str ("clientSecret" , hashSecretValue (oAuthNoParamsConfig .ClientSecret )).
240
+ Str ("tokenUrl" , oAuthNoParamsConfig .TokenURL ).
241
+ Str ("hostname" , oAuthNoParamsConfig .CommandHostName ).
242
+ Str ("apiPath" , oAuthNoParamsConfig .CommandAPIPath ).
243
+ Bool ("skipVerify" , oAuthNoParamsConfig .SkipVerify ).
244
+ Str ("caCert" , oAuthNoParamsConfig .CommandCACert ).
245
+ Msg (fmt .Sprintf ("%s oAuthNoParamsConfig.Authenticate()" , DebugFuncCall ))
199
246
oErr := oAuthNoParamsConfig .Authenticate ()
200
247
log .Debug ().Msg ("complete: oAuthNoParamsConfig.Authenticate()" )
201
248
if oErr != nil {
0 commit comments