def auth_config(self, stage=None):
        """Create auth config based on stage."""
        if stage:
            section = 'stages.{}'.format(stage)
        else:
            section = 'stages.live'

        try:
            username = self.lookup(section, 'username')
            password = self.lookup(section, 'password')
        except MissingConfigurationError:
            username = self.lookup('auth', 'username')
            password = self.lookup('auth', 'password')

        if stage in self.known_auth_configurations:
            return AuthConfig(
                username, password,
                **self.known_auth_configurations[stage]
            )

        try:
            cognito_pool_id = self.lookup(section, 'cognito_pool_id')
            cognito_region = self.lookup(section, 'cognito_region')
        except MissingConfigurationError:
            m = arn_re.match(self.lookup(section, 'cognito_pool'))
            if not m:
                raise ConfigurationError('Cognito Pool value must be an ARN')

            cognito_pool_id = m.group('resource')
            cognito_region = m.group('region')

        cognito_client_id = self.lookup(section, 'cognito_client_id')
        return AuthConfig(
            username, password,
            cognito_pool_id, cognito_region, cognito_client_id,
        )