Exemple #1
0
    def get_authentication_provider(self, authentication_provider, **kwargs):
        """
        Get the specified authentication provider

        :calls: `GET /api/v1/accounts/:account_id/authentication_providers/:id \
        <https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show>`_

        :param authentication_provider: The object or ID of the authentication provider
        :type authentication_provider:
            :class:`canvasapi.authentication_provider.AuthenticationProvider` or int

        :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider`
        """
        from canvasapi.authentication_provider import AuthenticationProvider
        authentication_providers_id = obj_or_id(
            authentication_provider, "authentication provider", (
                AuthenticationProvider,
            )
        )

        response = self._requester.request(
            'GET',
            'accounts/{}/authentication_providers/{}'.format(self.id, authentication_providers_id),
            _kwargs=combine_kwargs(**kwargs)
        )

        return AuthenticationProvider(self._requester, response.json())
Exemple #2
0
    def get_authentication_providers(self, authentication_providers_id,
                                     **kwargs):
        """
        Get the specified authentication provider

        :calls: `GET /api/v1/accounts/:account_id/authentication_providers/:id \
        <https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show>`_

        :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider`
        """
        from canvasapi.authentication_provider import AuthenticationProvider

        response = self._requester.request(
            'GET', 'accounts/%s/authentication_providers/%s' %
            (self.id, authentication_providers_id), **combine_kwargs(**kwargs))

        return AuthenticationProvider(self._requester, response.json())
Exemple #3
0
    def add_authentication_providers(self, **kwargs):
        """
        Add external authentication providers for the account

        :calls: `POST /api/v1/accounts/:account_id/authentication_providers \
        <https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.create>`_

        :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider`
        """
        from canvasapi.authentication_provider import AuthenticationProvider

        response = self._requester.request(
            'POST', 'accounts/%s/authentication_providers' % (self.id),
            **combine_kwargs(**kwargs))
        authentication_providers_json = response.json()
        authentication_providers_json.update({'account_id': self.id})

        return AuthenticationProvider(self._requester,
                                      authentication_providers_json)