@Test public void checkEndpointAuthenticationFilterRegistrationUnusedVitamAuthentication() throws Exception { when(resourceInfo.getResourceMethod()) .thenReturn(this.getClass().getMethod("UnusedVitamAuthenticationMethod")); BasicAuthenticationFilter instance = new BasicAuthenticationFilter(configuration); instance.configure(resourceInfo, featureContext); verify(featureContext, never()).register(any(), anyInt()); }
@Override public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) { VitamAuthentication authentication = resourceInfo.getResourceMethod().getAnnotation(VitamAuthentication.class); if (authentication == null) { LOGGER.debug(String .format("Ignore @%s non annotated method %s for the class %s", VitamAuthentication.class.getName(), resourceInfo.getResourceMethod().getName(), resourceInfo.getResourceClass().getName())); return; } LOGGER .debug(String.format( "Registering VitamAuthentication filters with '%s' authentication level for %s annotated method %s.%s", authentication.authentLevel(), VitamAuthentication.class.getName(), resourceInfo.getResourceClass().getName(), resourceInfo.getResourceMethod().getName())); featureContext .register(new EndpointAuthenticationFilter(authentication.authentLevel(), configuration), Priorities.AUTHORIZATION + 10); }
BasicAuthenticationFilter implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) { VitamAuthentication authentication = resourceInfo.getResourceMethod().getAnnotation(VitamAuthentication.class); if (authentication == null) { LOGGER.debug(String .format("Ignore @%s non annotated method %s for the class %s", VitamAuthentication.class.getName(), resourceInfo.getResourceMethod().getName(), resourceInfo.getResourceClass().getName())); return; } LOGGER .debug(String.format( "Registering VitamAuthentication filters with '%s' authentication level for %s annotated method %s.%s", authentication.authentLevel(), VitamAuthentication.class.getName(), resourceInfo.getResourceClass().getName(), resourceInfo.getResourceMethod().getName())); featureContext .register(new EndpointAuthenticationFilter(authentication.authentLevel(), configuration), Priorities.AUTHORIZATION + 10); } }
BasicAuthenticationFilter implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) { VitamAuthentication authentication = resourceInfo.getResourceMethod().getAnnotation(VitamAuthentication.class); if (authentication == null) { LOGGER.debug(String .format("Ignore @%s non annotated method %s for the class %s", VitamAuthentication.class.getName(), resourceInfo.getResourceMethod().getName(), resourceInfo.getResourceClass().getName())); return; } LOGGER .debug(String.format( "Registering VitamAuthentication filters with '%s' authentication level for %s annotated method %s.%s", authentication.authentLevel(), VitamAuthentication.class.getName(), resourceInfo.getResourceClass().getName(), resourceInfo.getResourceMethod().getName())); featureContext .register(new EndpointAuthenticationFilter(authentication.authentLevel(), configuration), Priorities.AUTHORIZATION + 10); } BasicAuthenticationFilter(DefaultVitamApplicationConfiguration configuration); }
BasicAuthenticationFilter implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) { VitamAuthentication authentication = resourceInfo.getResourceMethod().getAnnotation(VitamAuthentication.class); if (authentication == null) { LOGGER.debug(String .format("Ignore @%s non annotated method %s for the class %s", VitamAuthentication.class.getName(), resourceInfo.getResourceMethod().getName(), resourceInfo.getResourceClass().getName())); return; } LOGGER .debug(String.format( "Registering VitamAuthentication filters with '%s' authentication level for %s annotated method %s.%s", authentication.authentLevel(), VitamAuthentication.class.getName(), resourceInfo.getResourceClass().getName(), resourceInfo.getResourceMethod().getName())); featureContext .register(new EndpointAuthenticationFilter(authentication.authentLevel(), configuration), Priorities.AUTHORIZATION + 10); } BasicAuthenticationFilter(DefaultVitamApplicationConfiguration configuration); @Override void configure(ResourceInfo resourceInfo, FeatureContext featureContext); }
BasicAuthenticationFilter implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext featureContext) { VitamAuthentication authentication = resourceInfo.getResourceMethod().getAnnotation(VitamAuthentication.class); if (authentication == null) { LOGGER.debug(String .format("Ignore @%s non annotated method %s for the class %s", VitamAuthentication.class.getName(), resourceInfo.getResourceMethod().getName(), resourceInfo.getResourceClass().getName())); return; } LOGGER .debug(String.format( "Registering VitamAuthentication filters with '%s' authentication level for %s annotated method %s.%s", authentication.authentLevel(), VitamAuthentication.class.getName(), resourceInfo.getResourceClass().getName(), resourceInfo.getResourceMethod().getName())); featureContext .register(new EndpointAuthenticationFilter(authentication.authentLevel(), configuration), Priorities.AUTHORIZATION + 10); } BasicAuthenticationFilter(DefaultVitamApplicationConfiguration configuration); @Override void configure(ResourceInfo resourceInfo, FeatureContext featureContext);  }