How to use the gssapi.names.Name function in gssapi

To help you get started, we’ve selected a few gssapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github krbcontext / python-krbcontext / test / test_krbcontext.py View on Github external
def test_all_defaults(self, get_login):
        get_login.return_value = 'cqi'

        context = krbContext()

        expected_princ = gssapi.names.Name(get_login.return_value,
                                           gssapi.names.NameType.user)
        self.assertEqual(expected_princ,
                         context._cleaned_options['principal'])
        self.assertEqual(kctx.DEFAULT_CCACHE,
                         context._cleaned_options['ccache'])
        self.assertFalse(context._cleaned_options['using_keytab'])
github pythongssapi / python-gssapi / gssapi / sec_contexts.py View on Github external
Raises:
            MissingContextError
        """
        if not kwargs:
            default_val = True
        else:
            default_val = False

        for arg in self._INQUIRE_ARGS:
            kwargs[arg] = kwargs.get(arg, default_val)

        res = rsec_contexts.inquire_context(self, **kwargs)

        if (kwargs.get('initiator_name', False) and
                res.initiator_name is not None):
            init_name = Name(res.initiator_name)
        else:
            init_name = None

        if (kwargs.get('target_name', False) and
                res.target_name is not None):
            target_name = Name(res.target_name)
        else:
            target_name = None

        return tuples.InquireContextResult(init_name, target_name,
                                           res.lifetime, res.mech,
                                           res.flags, res.locally_init,
                                           res.complete)
github pythongssapi / python-gssapi / gssapi / creds.py View on Github external
mechs (bool): get the mechanisms associated with the credentials

        Returns:
            InquireCredResult: the information about the credentials,
                with None used when the corresponding argument was False

        Raises:
            MissingCredentialsError
            InvalidCredentialsError
            ExpiredCredentialsError
        """

        res = rcreds.inquire_cred(self, name, lifetime, usage, mechs)

        if res.name is not None:
            res_name = names.Name(res.name)
        else:
            res_name = None

        return tuples.InquireCredResult(res_name, res.lifetime,
                                        res.usage, res.mechs)