org.glassfish.hk2.api.InjectionResolver Java Examples

The following examples show how to use org.glassfish.hk2.api.InjectionResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SingularityAuthFeature.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
  context.register(
    new AbstractBinder() {

      @Override
      public void configure() {
        bind(SingularityMultiMethodAuthenticator.class)
          .to(
            new TypeLiteral<Authenticator<ContainerRequestContext, SingularityUser>>() {}
          )
          .in(Singleton.class);
        bind(SingularityAuthedUserFactory.class)
          .to(SingularityAuthedUserFactory.class)
          .in(Singleton.class);
        bind(SingularityAuthFactoryProvider.class)
          .to(ValueFactoryProvider.class)
          .in(Singleton.class);
        bind(SingularityAuthParamInjectionResolver.class)
          .to(new TypeLiteral<InjectionResolver<Auth>>() {})
          .in(Singleton.class);
      }
    }
  );
  return true;
}
 
Example #2
Source File: Application.java    From ameba with MIT License 6 votes vote down vote up
private void registerBinder() {
    register(new AbstractBinder() {
        @Override
        protected void configure() {
            bind(Application.this).to(Application.class).proxy(false);
            bind(mode).to(Application.Mode.class).proxy(false);
            bind(ConfigurationInjectionResolver.class)
                    .to(new GenericType<InjectionResolver<Named>>() {
                    }).in(Singleton.class);
            bind(ValueConfigurationInjectionResolver.class)
                    .to(new GenericType<InjectionResolver<Value>>() {
                    }).in(Singleton.class);
        }
    });
    register(Requests.BindRequest.class);
    register(SysEventListener.class);
}
 
Example #3
Source File: TokenFeature.java    From robe with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean configure(FeatureContext context) {
    context.register(new AbstractBinder() {
        @Override
        public void configure() {
            bind(TokenAuthenticator.class)
                    .in(Singleton.class);
            bind(TokenFactory.class)
                    .in(Singleton.class);
            bind(TokenFactoryProvider.class)
                    .to(ValueFactoryProvider.class)
                    .in(Singleton.class);
            bind(TokenParamInjectionResolver.class)
                    .to(new TypeLiteral<InjectionResolver<RobeAuth>>() {
                    })
                    .in(Singleton.class);
        }
    });
    return true;
}
 
Example #4
Source File: SecurityCheckFactoryProvider.java    From commafeed with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
	bind(SecurityCheckFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
	bind(SecurityCheckInjectionResolver.class).to(new TypeLiteral<InjectionResolver<SecurityCheck>>() {
	}).in(Singleton.class);
	bind(userService).to(UserService.class);
}
 
Example #5
Source File: RateLimitBundle.java    From ratelimitj with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(new RateLimiterFactoryProvider(requestRateLimiterFactory)).to(RateLimiterFactoryProvider.class);
    bind(RateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(RateLimitingFactoryProvider.RateLimitingInjectionResolver.class)
            .to(new TypeLiteral<InjectionResolver<RateLimiting>>() {}).in(Singleton.class);
}
 
Example #6
Source File: HmacAuthFeature.java    From jersey-hmac-auth with Apache License 2.0 5 votes vote down vote up
protected void configure() {
    bind(PrincipalFactory.class)
            .to(PrincipalFactory.class)
            .to(new TypeLiteral<Factory<P>>() {})
            .in(Singleton.class);
    bind(PrincipalValueFactoryProvider.class)
            .to(AbstractValueFactoryProvider.class)
            .to(ValueFactoryProvider.class)
            .in(Singleton.class);
    bind(PrincipalInjectionResolver.class)
            .to(new TypeLiteral<ParamInjectionResolver<HmacAuth>>() {})
            .to(new TypeLiteral<InjectionResolver<HmacAuth>>() {})
            .in(Singleton.class);
}
 
Example #7
Source File: TokenFactoryProvider.java    From robe with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(new PrincipalClassProvider<>(principalClass)).to(PrincipalClassProvider.class);
    bind(TokenFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(TokenParamInjectionResolver.class).to(new TypeLiteral<InjectionResolver<RobeAuth>>() {
    }).in(Singleton.class);
}
 
Example #8
Source File: InjectableProviderScanner.java    From robe with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void scanAndAdd(Environment environment, Injector injector, Reflections reflections) {
    Set<Class<? extends InjectionResolver>> resolvers = reflections.getSubTypesOf(InjectionResolver.class);
    for (Class<? extends InjectionResolver> resolver : resolvers) {
        //TODO: Check if it is valid usage.
        environment.jersey().register(resolver);
        LOGGER.info("Added InjectableResolver: " + resolver);
    }
}
 
Example #9
Source File: AuthResolver.java    From keywhiz with Apache License 2.0 5 votes vote down vote up
@Override protected void configure() {
  bind(clientAuthFactory);
  bind(automationClientAuthFactory);
  bind(userAuthFactory);
  bind(AuthValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
  bind(AuthInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Auth>>() {}).in(Singleton.class);
}
 
Example #10
Source File: JerseyServletProvider.java    From vespa with Apache License 2.0 5 votes vote down vote up
private static Binder componentInjectorBinder(RestApiContext restApiContext) {
    final ComponentGraphProvider componentGraphProvider = new ComponentGraphProvider(restApiContext.getInjectableComponents());
    final TypeLiteral<InjectionResolver<Component>> componentAnnotationType = new TypeLiteral<InjectionResolver<Component>>() {
    };

    return new AbstractBinder() {
        @Override
        public void configure() {
            bind(componentGraphProvider).to(componentAnnotationType);
        }
    };
}
 
Example #11
Source File: Pac4JValueFactoryProvider.java    From jax-rs-pac4j with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(profile).to(ProfileFactoryBuilder.class);
    bind(optProfile).to(OptionalProfileFactoryBuilder.class);
    bind(manager).to(ProfileManagerFactoryBuilder.class);

    bind(Pac4JProfileValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);

    bind(ProfileInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfile>>() {
    }).in(Singleton.class);
    bind(ProfileManagerInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Pac4JProfileManager>>() {
    }).in(Singleton.class);
}
 
Example #12
Source File: RateLimit429EnforcerFilterTest.java    From ratelimitj with Apache License 2.0 5 votes vote down vote up
@Override
protected void configure() {
    bind(TestRateLimitingFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(TestRateLimitingFactoryProvider.TestRateLimitingInjectionResolver.class).to(
            new TypeLiteral<InjectionResolver<RateLimiting>>() {
            }
    ).in(Singleton.class);
}
 
Example #13
Source File: SearchFactoryProvider.java    From robe with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void configure() {
    bind(SearchFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
    bind(SearchParamInjectionResolver.class).to(new TypeLiteral<InjectionResolver<SearchParam>>() {
    }).in(Singleton.class);
}
 
Example #14
Source File: AuthValueFactoryProvider.java    From dropwizard-simpleauth with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
  bind(AuthValueFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
  bind(AuthInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Auth>>() {
  }).in(Singleton.class);
}
 
Example #15
Source File: AuthInjectionBinder.java    From shiro-jersey with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    bind(AuthParamInjectionResolver.class).in(Singleton.class)
        .to(new TypeLiteral<InjectionResolver<Auth>>() {});
}
 
Example #16
Source File: AuthInjectionBinder.java    From shiro-jersey with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
    bind(AuthParamInjectionResolver.class).in(Singleton.class)
        .to(new TypeLiteral<InjectionResolver<Auth>>() {});
}
 
Example #17
Source File: SessionHelperFactoryProvider.java    From commafeed with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {
	bind(SessionHelperFactoryProvider.class).to(ValueFactoryProvider.class).in(Singleton.class);
	bind(SessionHelperInjectionResolver.class).to(new TypeLiteral<InjectionResolver<Context>>() {
	}).in(Singleton.class);
}