@@ -211,6 +211,59 @@ func TestDefaultModule_NewConfig(t *testing.T) {
211
211
OnUnauthenticatedRequest : DefaultAuthOnUnauthenticatedRequest ,
212
212
},
213
213
},
214
+ {
215
+ name : "service use oidc auth clientId with trailing whitespaces" ,
216
+ ingress : & extensions.Ingress {
217
+ ObjectMeta : metav1.ObjectMeta {
218
+ Namespace : "namespace" ,
219
+ Name : "ingress" ,
220
+ },
221
+ },
222
+ backend : extensions.IngressBackend {
223
+ ServiceName : "service" ,
224
+ ServicePort : intstr .FromInt (80 ),
225
+ },
226
+ service : & corev1.Service {
227
+ ObjectMeta : metav1.ObjectMeta {
228
+ Namespace : "namespace" ,
229
+ Name : "service" ,
230
+ Annotations : map [string ]string {
231
+ parser .GetAnnotationWithPrefix (AnnotationAuthType ): "oidc" ,
232
+ parser .GetAnnotationWithPrefix (AnnotationAuthIDPOIDC ): "{\" Issuer\" : \" Issuer\" ,\" AuthorizationEndpoint\" : \" AuthorizationEndpoint\" ,\" TokenEndpoint\" : \" TokenEndpoint\" ,\" UserInfoEndpoint\" : \" UserInfoEndpoint\" ,\" SecretName\" : \" oidc-secret\" ,\" AuthenticationRequestExtraParams\" : { \" param1\" : \" value1\" ,\" param2\" : \" value2\" }}" ,
233
+ },
234
+ },
235
+ },
236
+ secret : & corev1.Secret {
237
+ ObjectMeta : metav1.ObjectMeta {
238
+ Namespace : "namespace" ,
239
+ Name : "oidc-secret" ,
240
+ },
241
+ Data : map [string ][]byte {
242
+ "clientId" : []byte ("clientId\t \n " ),
243
+ "clientSecret" : []byte ("clientSecret" ),
244
+ },
245
+ },
246
+ protocol : "HTTPS" ,
247
+ expectedAuthCfg : Config {
248
+ Type : TypeOIDC ,
249
+ IDPOIDC : IDPOIDC {
250
+ Issuer : "Issuer" ,
251
+ AuthorizationEndpoint : "AuthorizationEndpoint" ,
252
+ AuthenticationRequestExtraParams : AuthenticationRequestExtraParams {
253
+ "param1" : "value1" ,
254
+ "param2" : "value2" ,
255
+ },
256
+ TokenEndpoint : "TokenEndpoint" ,
257
+ UserInfoEndpoint : "UserInfoEndpoint" ,
258
+ ClientId : "clientId" ,
259
+ ClientSecret : "clientSecret" ,
260
+ },
261
+ Scope : DefaultAuthScope ,
262
+ SessionCookie : DefaultAuthSessionCookie ,
263
+ SessionTimeout : DefaultAuthSessionTimeout ,
264
+ OnUnauthenticatedRequest : DefaultAuthOnUnauthenticatedRequest ,
265
+ },
266
+ },
214
267
{
215
268
name : "service use oidc auth" ,
216
269
ingress : & extensions.Ingress {
0 commit comments