-
Notifications
You must be signed in to change notification settings - Fork 10
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
Issue #5 - Implement BIND-level authentication #6
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,8 +148,8 @@ def start(self): | |
''' | ||
start_invoc = CltuUserToProviderPdu() | ||
|
||
if self._credentials: | ||
pass | ||
if self._auth_level in ['all']: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we set this to be |
||
start_invoc['cltuStartInvocation']['invokerCredentials']['used'] = self.make_credentials() | ||
else: | ||
start_invoc['cltuStartInvocation']['invokerCredentials']['unused'] = None | ||
|
||
|
@@ -189,8 +189,8 @@ def upload_cltu(self, tc_data, earliest_time=None, latest_time=None, delay=0, no | |
''' | ||
pdu = CltuUserToProviderPdu() | ||
|
||
if self._credentials: | ||
pass | ||
if self._auth_level in ['all']: | ||
pdu['cltuTransferDataInvocation']['invokerCredentials']['used'] = self.make_credentials() | ||
else: | ||
pdu['cltuTransferDataInvocation']['invokerCredentials']['unused'] = None | ||
|
||
|
@@ -237,8 +237,8 @@ def schedule_status_report(self, report_type='immediately', cycle=None): | |
''' | ||
pdu = CltuUserToProviderPdu() | ||
|
||
if self._credentials: | ||
pass | ||
if self._auth_level in ['all']: | ||
pdu['cltuScheduleStatusReportInvocation']['invokerCredentials']['used'] = self.make_credentials() | ||
else: | ||
pdu['cltuScheduleStatusReportInvocation']['invokerCredentials']['unused'] = None | ||
|
||
|
@@ -282,8 +282,8 @@ def throw_event(self, event_id, event_qualifier): | |
''' | ||
pdu = CltuUserToProviderPdu() | ||
|
||
if self._credentials: | ||
pass | ||
if self._auth_level in ['all']: | ||
pdu['cltuThrowEventInvocation']['invokerCredentials']['used'] = self.make_credentials() | ||
else: | ||
pdu['cltuThrowEventInvocation']['invokerCredentials']['unused'] = None | ||
|
||
|
@@ -327,7 +327,29 @@ def decode(self, message): | |
def _bind_return_handler(self, pdu): | ||
'''''' | ||
result = pdu['cltuBindReturn']['result'] | ||
responder_identifier = pdu['cltuBindReturn']['responderIdentifier'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the same across the 3 interfaces let's move the bulk of the logic to the common class between the 3. I realize there was probably a lot of duplication before as well though =) |
||
|
||
# Check that responder_id in the response matches what we know | ||
if responder_identifier != self._responder_id: | ||
# Invoke PEER-ABORT with unexpected responder id | ||
self.peer_abort(1) | ||
self._state = 'unbound' | ||
return | ||
|
||
if 'positive' in result: | ||
if self._peer_auth_level in ['bind', 'all']: | ||
responder_performer_credentials = pdu['cltuBindReturn']['performerCredentials']['used'] | ||
if not self._check_return_credentials(responder_performer_credentials, self._responder_id, | ||
self._peer_password): | ||
# Authentication failed. Ignore processing the return | ||
bliss.core.log.info('Bind unsuccessful. Authentication failed.') | ||
return | ||
|
||
if self._state == 'ready' or self._state == 'active': | ||
# Peer abort with protocol error (3) | ||
bliss.core.log.info('Bind unsuccessful. State already in READY or ACTIVE.') | ||
self.peer_abort(3) | ||
|
||
bliss.core.log.info('Bind successful') | ||
self._state = 'ready' | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need both of these. The auth level should cover outgoing/inbound auth in all 3 cases. I.e., 'Bind' level auth means the outgoing bind request is auth'ed and the receipt has auth info from the harness that we should decode