private void bindAuthenticationProviders ( Collection < Class < AuthenticationProvider > > authProviders , Set < String > tolerateFailures ) { // Bind each authentication provider within extension for ( Class < AuthenticationProvider > authenticationProvider : authProviders ) bindAuthenticationProvider ( authenticationProvider , tolerateFailures ) ; } /** * Returns a list of all currently-bound AuthenticationProvider instances. * * @return * A List of all currently-bound AuthenticationProvider. The List is * not modifiable. */ @ Provides public List < AuthenticationProvider > getAuthenticationProviders ( ) { return Collections . unmodifiableList ( boundAuthenticationProviders ) ; } /** * Binds the given provider class such that a listener is bound for each * listener interface implemented by the provider and such that all bound * listener instances can be obtained via injection. * * @param providerClass * The listener class to bind. */ private void bindListener ( Class < ? > providerClass ) { logger . debug ( "[{}] Binding listener \"{}\"." , boundListeners . size ( ) , providerClass . getName ( ) ) ; boundListeners . addAll ( ListenerFactory . createListeners ( providerClass ) ) ; } /** * Binds each of the the given Listener classes such that any * service requiring access to the Listener can obtain it via * injection. * * @param listeners * The Listener classes to bind. */ private void bindListeners ( Collection < Class < ? > > listeners ) { // Bind each listener within extension for ( Class < ? > listener : listeners ) bindListener ( listener ) ; } /** * Returns a list of all currently-bound Listener instances. * * @return * A List of all currently-bound Listener instances. The List is * not modifiable. */ @ Provides public List < Listener > getListeners ( ) { return Collections . unmodifiableList ( boundListeners ) ; } /** * Serves each of the given resources as a language resource. Language * resources are served from within the "/translations" directory as JSON * files, where the name of each JSON file is the language key. * * @param resources * A map of all language resources to serve, where the key of each * entry in the language key from which the name of the JSON file will * be derived. */ private void serveLanguageResources ( Map < String , Resource > resources ) { // Add all resources to language resource service for ( Map . Entry < String , Resource > translationResource : resources . entrySet ( ) ) { // Get path and resource from path/resource pair String path = translationResource . getKey ( ) ; Resource resource = translationResource . getValue ( ) ; // Derive key from path String languageKey = languageResourceService . getLanguageKey ( path ) ; if ( languageKey == null ) { logger . warn ( "Invalid language file name: \"{}\"" , path ) ; continue ; } // Add language resource languageResourceService . addLanguageResource ( languageKey , resource ) ; } } /** * Serves each of the given resources under the given prefix. The path of * each resource relative to the prefix is the key of its entry within the * map. * * @param prefix * The prefix under which each resource should be served. * * @param resources * A map of all resources to serve, where the key of each entry in the * map is the desired path of that resource relative to the prefix. */ private void serveStaticResources ( String prefix , Map < String , Resource > resources ) { // Add all resources under given prefix for ( Map . Entry < String , Resource > staticResource : resources . entrySet ( ) ) { // Get path and resource from path/resource pair String path = staticResource . getKey ( ) ; Resource resource = staticResource . getValue ( ) ; // Serve within namespace-derived path serve ( prefix + path ) . with ( new ResourceServlet ( resource ) ) ; } }
Binds each of the the given AuthenticationProvider classes such that any service requiring access to the AuthenticationProvider can obtain it via injection .