public function getAuthenticator(MappingInterface $mapping = null)
    {

        // query whether or not a mapping has been passed
        if ($mapping != null) {
            // query whether or not we've an authentication manager with the passed key
            if (isset($this->authenticators[$authenticatorSerial = $mapping->getAuthenticatorSerial()])) {
                return $this->authenticators[$authenticatorSerial];
            }

            // throw an exception if not
            throw new AuthenticationException(sprintf('Can\'t find authenticator serial %s', $authenticatorSerial));
        }

        // try to find the default authenticator instead
        foreach ($this->authenticators as $authenticator) {
            if ($authenticator->isDefaultAuthenticator()) {
                return $authenticator;
            }
        }

        // throw an exception if we can't find a default authenticator also
        throw new AuthenticationException('Can\'t find a default authenticator');
    }