services:
    _defaults:
        autowire: false
        autoconfigure: false
        public: true

    # Authenticators
    Claroline\AuthenticationBundle\Security\Authentication\Authenticator:
        arguments:
            - '%secret%'
            - '@security.token_storage'
            - '@Claroline\AppBundle\Persistence\ObjectManager'
            - '@security.encoder_factory'
            - '@Claroline\CoreBundle\Listener\AuthenticationSuccessListener'
            - '@Claroline\AppBundle\Event\StrictDispatcher'

    Claroline\AuthenticationBundle\Security\Authentication\Guard\IpAuthenticator:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'

    Claroline\AuthenticationBundle\Security\Authentication\Guard\ApiTokenAuthenticator:
        arguments:
            - '@Claroline\AppBundle\Persistence\ObjectManager'

    # OAuth
    Claroline\AuthenticationBundle\Security\Oauth\Hwi\ResourceOwnerFactory:
        arguments:
            - '@Claroline\AuthenticationBundle\Manager\OauthManager'
            - '@security.http_utils'
            - '@session'
            - '@guzzle_client.hwi_oauth.methods_client'

    Claroline\AuthenticationBundle\Security\Oauth\AuthenticationFailureHandler:
        arguments:
            - '@router'
            - '@translator'

    Claroline\AuthenticationBundle\Security\Oauth\LogoutHandler:
        arguments:
            - '@session'
            - '@Claroline\AuthenticationBundle\Security\Oauth\Hwi\ResourceOwnerFactory'
            - '@Claroline\AppBundle\Event\StrictDispatcher'

    Claroline\AuthenticationBundle\Security\Oauth\OauthUserProvider:
        arguments:
            - '@doctrine.orm.entity_manager'
            - '@session'
            - '@Claroline\CoreBundle\Library\Configuration\PlatformConfigurationHandler'

    Claroline\AuthenticationBundle\Security\Logout\LogoutHandler:
        arguments:
            - '@Claroline\AppBundle\Event\StrictDispatcher'

    guzzle_client.hwi_oauth:
        class: Http\Adapter\Guzzle6\Client
        factory:
            - Http\Adapter\Guzzle6\Client
            - createWithConfig
        arguments:
            - timeout: 10
              verify_peer: true
              max_redirects: 5
              ignore_errors: true

    guzzle_client.hwi_oauth.message_factory:
        class: Http\Message\MessageFactory\GuzzleMessageFactory

    guzzle_client.hwi_oauth.methods_client:
        class: Http\Client\Common\HttpMethodsClient
        arguments:
            - '@guzzle_client.hwi_oauth'
            - '@guzzle_client.hwi_oauth.message_factory'
