I'm following http://symfony.com/doc/current/cookbook/security/voters.html and attempting to make a custom voter that denies access for requests that don't contain a valid API key and digest in the header (influenced by http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html - I'm not building an authentication provider because I need to use the FOSUserBundle provider for the same request).
I'd like to store my api keys / secrets in the in-memory user provider to begin with and likely migrate this to a custom mongodb provider at a later date. So I need a way of injecting the user provider into my voter. I've already injected the service container, but can the user providers can be accessed from it?
My service definition:
services:
security.access.api_client_voter:
class: Acme\RestBundle\Security\Authorization\Voter\ApiClientVoter
arguments: [@service_container, %kernel.cache_dir%/security/nonces]
public: false
tags:
- { name: monolog.logger, channel: authentication }
- { name: security.voter }
So my question is, how do I inject the in-memory provider? The WSSE example in the cookbook seems to use an auth provider factory to replace the string 'security.providers.in_memory', but as I'm just using a voter, is this necessary? If it is necessary, what would my factory look like?