Skip to content

Fix Delegated Credentials Issues #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions gssapi/sec_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class SecurityContext(rsec_contexts.SecurityContext):
:class:`~gssapi.raw.sec_contexts.SecurityContext` class,
and thus may used with both low-level and high-level API methods.

This class may be pickled an unpickled.
This class may be pickled and unpickled (the attached delegated
credentials object will not be preserved, however).
"""

def __new__(cls, base=None, token=None,
Expand Down Expand Up @@ -106,7 +107,7 @@ def __init__(self, base=None, token=None,
self._channel_bindings = channel_bindings
self._creds = creds

self.delegated_creds = None
self._delegated_creds = None

else:
# we already have a context in progress, just inspect it
Expand Down Expand Up @@ -418,6 +419,18 @@ def lifetime(self):
"""The amount of time for which this context remains valid"""
return rsec_contexts.context_time(self)

@property
def delegated_creds(self):
"""The credentials delegated from the initiator to the acceptor

.. warning::

This value will not be preserved across picklings. These should
be separately exported and transfered.

"""
return self._delegated_creds

initiator_name = _utils.inquire_property(
'initiator_name', 'The :class:`Name` of the initiator of this context')
target_name = _utils.inquire_property(
Expand Down Expand Up @@ -511,7 +524,10 @@ def _acceptor_step(self, token):
res = rsec_contexts.accept_sec_context(token, self._creds,
self, self._channel_bindings)

self.delegated_creds = Credentials(res.delegated_creds)
if res.delegated_creds is not None:
self._delegated_creds = Credentials(res.delegated_creds)
else:
self._delegated_creds = None

self._complete = not res.more_steps

Expand Down