@Override protected void configure() { bind(AuditLogHandler.class) .annotatedWith(Names.named( ExternalAuthenticationServer.NAMED_EXTERNAL_AUTH)) .toInstance(new AuditLogHandler(TEST_AUDIT_LOGGER)); } }
@Override protected final void configure() { bind(new TypeLiteral<Codec<AccessToken>>() { }).to(AccessTokenCodec.class).in(Scopes.SINGLETON); bind(new TypeLiteral<Codec<AccessTokenIdentifier>>() { }).to(AccessTokenIdentifierCodec.class).in(Scopes.SINGLETON); bind(new TypeLiteral<Codec<KeyIdentifier>>() { }).to(KeyIdentifierCodec.class).in(Scopes.SINGLETON); bindKeyManager(binder()); bind(TokenManager.class).in(Scopes.SINGLETON); bind(ExternalAuthenticationServer.class).in(Scopes.SINGLETON); MapBinder<String, Object> handlerBinder = MapBinder.newMapBinder(binder(), String.class, Object.class, Names.named("security.handlers.map")); handlerBinder.addBinding(ExternalAuthenticationServer.HandlerType.AUTHENTICATION_HANDLER) .toProvider(AuthenticationHandlerProvider.class).in(Scopes.SINGLETON); handlerBinder.addBinding(ExternalAuthenticationServer.HandlerType.GRANT_TOKEN_HANDLER) .to(GrantAccessToken.class).in(Scopes.SINGLETON); bind(AuditLogHandler.class) .annotatedWith(Names.named(ExternalAuthenticationServer.NAMED_EXTERNAL_AUTH)) .toInstance(new AuditLogHandler(EXTERNAL_AUTH_AUDIT_LOG)); bind(TokenValidator.class).to(AccessTokenValidator.class); bind(AccessTokenTransformer.class).in(Scopes.SINGLETON); expose(AccessTokenTransformer.class); expose(TokenValidator.class); expose(TokenManager.class); expose(ExternalAuthenticationServer.class); expose(new TypeLiteral<Codec<KeyIdentifier>>() { }); }