class TokenDelegationHandlersProvider implements Provider<List<TokenDelegationHandler>> {

    public List<TokenDelegationHandler> get() {
        if (!stsInstanceConfig.delegationRelationshipsSupported()) {
            return Collections.emptyList();
        } else {
            if (stsInstanceConfig.getSoapDelegationConfig().getCustomDelegationTokenHandlers().isEmpty()) {
                /*
                Entering this branch means that the user did not specify the class names of any TokenDelegationHandler
                implementations, so I will simply return the List containing and instance of the DefaultTokenDelegationHandler,
                which will approve the delegation token if it has been previously validated.
                 */
                return (List) Lists.newArrayList(new DefaultTokenDelegationHandler());
            } else {
                List customDelegationHandlers = new ArrayList<TokenDelegationHandler>();
                for (String className : stsInstanceConfig.getSoapDelegationConfig().getCustomDelegationTokenHandlers()) {
                    try {
                        final TokenDelegationHandler customHandler =
                                Class.forName(className).asSubclass(TokenDelegationHandler.class).newInstance();
                        customDelegationHandlers.add(new CustomDelegationHandlerWrapper(
                                customHandler,
                                threadLocalAMTokenCache,
                                !stsInstanceConfig.getSoapDelegationConfig().getValidatedDelegatedTokenConfiguration().isEmpty(),
                                logger));
                    } catch (Exception e) {
                        logger.error("Exception caught instantiating class " + className
                                + " as a custom TokenDelegationHandler implementation. The exception: " + e);
                    }
                }
                return customDelegationHandlers;
            }
        }
    }

    @Inject  TokenDelegationHandlersProvider(SoapSTSInstanceConfig stsInstanceConfig, ThreadLocalAMTokenCache threadLocalAMTokenCache, Logger logger);

}