@@ -300,11 +300,10 @@ public void registerTenantResolverInterceptor(Capabilities capabilities, OidcRec
300300 .getAnnotations (TENANT_NAME )
301301 .stream ()
302302 .map (AnnotationInstance ::target )
303- // ignored field injection points and injection setters
304- // as we don't want to count in the TenantIdentityProvider injection point
305- .filter (t -> t .kind () == METHOD )
306- .map (AnnotationTarget ::asMethod )
307- .anyMatch (m -> !m .isConstructor () && !m .hasAnnotation (DotNames .INJECT ));
303+ // ignore field injection points and injection setters
304+ // as we don't want to count in the TenantIdentityProvider injection point;
305+ // if class is the target, we know it cannot be a TenantIdentityProvider as we produce it ourselves
306+ .anyMatch (t -> isMethodWithTenantAnnButNotInjPoint (t ) || t .kind () == CLASS );
308307 if (foundTenantResolver ) {
309308 // register method interceptor that will be run before security checks
310309 bindingProducer .produce (
@@ -315,6 +314,10 @@ public void registerTenantResolverInterceptor(Capabilities capabilities, OidcRec
315314 }
316315 }
317316
317+ private static boolean isMethodWithTenantAnnButNotInjPoint (AnnotationTarget t ) {
318+ return t .kind () == METHOD && !t .asMethod ().isConstructor () && !t .hasAnnotation (DotNames .INJECT );
319+ }
320+
318321 private static boolean detectUserInfoRequired (BeanRegistrationPhaseBuildItem beanRegistrationPhaseBuildItem ) {
319322 return isInjected (beanRegistrationPhaseBuildItem , USER_INFO_NAME , null );
320323 }
@@ -356,14 +359,6 @@ private static boolean isApplicationPackage(String injectionPointTargetInfo) {
356359 && !injectionPointTargetInfo .startsWith (SMALLRYE_JWT_PACKAGE );
357360 }
358361
359- private static String toTargetName (AnnotationTarget target ) {
360- if (target .kind () == CLASS ) {
361- return target .asClass ().name ().toString ();
362- } else {
363- return target .asMethod ().declaringClass ().name ().toString () + "#" + target .asMethod ().name ();
364- }
365- }
366-
367362 public static class IsEnabled implements BooleanSupplier {
368363 OidcBuildTimeConfig config ;
369364
0 commit comments