@@ -168,28 +168,30 @@ func TestResolve_ConfigMapType(t *testing.T) {
168168 Namespace : "test-ns" ,
169169 },
170170 Data : map [string ]string {
171- "issuer" : "https://auth.example.com" ,
172- "audience" : "test-audience" ,
173- "jwksUrl" : "https://auth.example.com/.well-known/jwks.json" ,
174- "introspectionUrl" : "https://auth.example.com/introspect" ,
175- "clientId" : "test-client" ,
176- "clientSecret" : "test-secret" ,
177- "thvCABundlePath" : "/etc/ssl/ca.pem" ,
178- "jwksAuthTokenPath" : "/etc/auth/token" ,
179- "jwksAllowPrivateIP" : "true" ,
171+ "issuer" : "https://auth.example.com" ,
172+ "audience" : "test-audience" ,
173+ "jwksUrl" : "https://auth.example.com/.well-known/jwks.json" ,
174+ "introspectionUrl" : "https://auth.example.com/introspect" ,
175+ "clientId" : "test-client" ,
176+ "clientSecret" : "test-secret" ,
177+ "thvCABundlePath" : "/etc/ssl/ca.pem" ,
178+ "jwksAuthTokenPath" : "/etc/auth/token" ,
179+ "jwksAllowPrivateIP" : "true" ,
180+ "protectedResourceAllowPrivateIP" : "true" ,
180181 },
181182 },
182183 expected : & OIDCConfig {
183- Issuer : "https://auth.example.com" ,
184- Audience : "test-audience" ,
185- JWKSURL : "https://auth.example.com/.well-known/jwks.json" ,
186- IntrospectionURL : "https://auth.example.com/introspect" ,
187- ClientID : "test-client" ,
188- ClientSecret : "test-secret" ,
189- ThvCABundlePath : "/etc/ssl/ca.pem" ,
190- JWKSAuthTokenPath : "/etc/auth/token" ,
191- ResourceURL : "http://test-server.test-ns.svc.cluster.local:8080" ,
192- JWKSAllowPrivateIP : true ,
184+ Issuer : "https://auth.example.com" ,
185+ Audience : "test-audience" ,
186+ JWKSURL : "https://auth.example.com/.well-known/jwks.json" ,
187+ IntrospectionURL : "https://auth.example.com/introspect" ,
188+ ClientID : "test-client" ,
189+ ClientSecret : "test-secret" ,
190+ ThvCABundlePath : "/etc/ssl/ca.pem" ,
191+ JWKSAuthTokenPath : "/etc/auth/token" ,
192+ ResourceURL : "http://test-server.test-ns.svc.cluster.local:8080" ,
193+ JWKSAllowPrivateIP : true ,
194+ ProtectedResourceAllowPrivateIP : true ,
193195 },
194196 },
195197 {
@@ -227,6 +229,43 @@ func TestResolve_ConfigMapType(t *testing.T) {
227229 JWKSAllowPrivateIP : false ,
228230 },
229231 },
232+ {
233+ name : "configmap with jwksAllowPrivateIP independent of protectedResourceAllowPrivateIP" ,
234+ mcpServer : & mcpv1alpha1.MCPServer {
235+ ObjectMeta : metav1.ObjectMeta {
236+ Name : "independent-server" ,
237+ Namespace : "test-ns" ,
238+ },
239+ Spec : mcpv1alpha1.MCPServerSpec {
240+ ProxyPort : 8080 ,
241+ OIDCConfig : & mcpv1alpha1.OIDCConfigRef {
242+ Type : mcpv1alpha1 .OIDCConfigTypeConfigMap ,
243+ ConfigMap : & mcpv1alpha1.ConfigMapOIDCRef {
244+ Name : "independent-config" ,
245+ },
246+ },
247+ },
248+ },
249+ configMap : & corev1.ConfigMap {
250+ ObjectMeta : metav1.ObjectMeta {
251+ Name : "independent-config" ,
252+ Namespace : "test-ns" ,
253+ },
254+ Data : map [string ]string {
255+ "issuer" : "https://auth.example.com" ,
256+ "audience" : "test-audience" ,
257+ "jwksAllowPrivateIP" : "true" ,
258+ // protectedResourceAllowPrivateIP intentionally absent
259+ },
260+ },
261+ expected : & OIDCConfig {
262+ Issuer : "https://auth.example.com" ,
263+ Audience : "test-audience" ,
264+ ResourceURL : "http://independent-server.test-ns.svc.cluster.local:8080" ,
265+ JWKSAllowPrivateIP : true ,
266+ ProtectedResourceAllowPrivateIP : false ,
267+ },
268+ },
230269 {
231270 name : "configmap with insecureAllowHTTP enabled" ,
232271 mcpServer : & mcpv1alpha1.MCPServer {
@@ -513,22 +552,24 @@ func TestResolve_InlineType(t *testing.T) {
513552 LocalObjectReference : corev1.LocalObjectReference {Name : "inline-ca" },
514553 },
515554 },
516- JWKSAuthTokenPath : "/etc/auth/inline-token" ,
517- JWKSAllowPrivateIP : true ,
555+ JWKSAuthTokenPath : "/etc/auth/inline-token" ,
556+ JWKSAllowPrivateIP : true ,
557+ ProtectedResourceAllowPrivateIP : true ,
518558 },
519559 },
520560 },
521561 },
522562 expected : & OIDCConfig {
523- Issuer : "https://inline.example.com" ,
524- Audience : "inline-audience" ,
525- JWKSURL : "https://inline.example.com/.well-known/jwks.json" ,
526- IntrospectionURL : "https://inline.example.com/introspect" ,
527- ClientID : "inline-client" ,
528- ThvCABundlePath : "/config/certs/inline-ca/ca.crt" ,
529- JWKSAuthTokenPath : "/etc/auth/inline-token" ,
530- ResourceURL : "http://test-server.test-ns.svc.cluster.local:8080" ,
531- JWKSAllowPrivateIP : true ,
563+ Issuer : "https://inline.example.com" ,
564+ Audience : "inline-audience" ,
565+ JWKSURL : "https://inline.example.com/.well-known/jwks.json" ,
566+ IntrospectionURL : "https://inline.example.com/introspect" ,
567+ ClientID : "inline-client" ,
568+ ThvCABundlePath : "/config/certs/inline-ca/ca.crt" ,
569+ JWKSAuthTokenPath : "/etc/auth/inline-token" ,
570+ ResourceURL : "http://test-server.test-ns.svc.cluster.local:8080" ,
571+ JWKSAllowPrivateIP : true ,
572+ ProtectedResourceAllowPrivateIP : true ,
532573 },
533574 },
534575 {
@@ -586,6 +627,34 @@ func TestResolve_InlineType(t *testing.T) {
586627 InsecureAllowHTTP : true ,
587628 },
588629 },
630+ {
631+ name : "inline with protectedResourceAllowPrivateIP independent of jwksAllowPrivateIP" ,
632+ mcpServer : & mcpv1alpha1.MCPServer {
633+ ObjectMeta : metav1.ObjectMeta {
634+ Name : "protected-resource-server" ,
635+ Namespace : "test-ns" ,
636+ },
637+ Spec : mcpv1alpha1.MCPServerSpec {
638+ ProxyPort : 8080 ,
639+ OIDCConfig : & mcpv1alpha1.OIDCConfigRef {
640+ Type : mcpv1alpha1 .OIDCConfigTypeInline ,
641+ Inline : & mcpv1alpha1.InlineOIDCConfig {
642+ Issuer : "https://auth.example.com" ,
643+ Audience : "test-audience" ,
644+ ProtectedResourceAllowPrivateIP : true ,
645+ JWKSAllowPrivateIP : false ,
646+ },
647+ },
648+ },
649+ },
650+ expected : & OIDCConfig {
651+ Issuer : "https://auth.example.com" ,
652+ Audience : "test-audience" ,
653+ ResourceURL : "http://protected-resource-server.test-ns.svc.cluster.local:8080" ,
654+ ProtectedResourceAllowPrivateIP : true ,
655+ JWKSAllowPrivateIP : false ,
656+ },
657+ },
589658 {
590659 name : "inline with scopes" ,
591660 mcpServer : & mcpv1alpha1.MCPServer {
0 commit comments