-
Couldn't load subscription status.
- Fork 220
Added feature to connect using AWS IoT custom authorizer #224
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
Conversation
| """ | ||
| Builder functions to create a :class:`awscrt.mqtt.Connection`, configured for use with AWS IoT Core. | ||
| The following keyword arguments are common to all builder functions: | ||
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.
Logical change looks good but can we undo all these white space changes?
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.
Changing the whitespace up here affects how the docs are generated. Please undo this
| | ||
| port = _get(kwargs, 'port') | ||
| password = _get(kwargs, 'password') | ||
| use_customAuth = True if password is not None else False |
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.
trivial/style: use_customAuth -> use_custom_auth
| # prefer 443, even for direct MQTT connections, since it's less likely to be blocked by firewalls | ||
| if use_websockets or awscrt.io.is_alpn_available(): | ||
| # If a password is specified for a custom authorizd, force port 443 | ||
| if use_websockets or awscrt.io.is_alpn_available() or use_customAuth : |
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.
trivial/style: we use autopep8 to format our code. Unfortunately, we haven't hooked it up to CI in this repo yet
anyway, python3 -m pip install autopep8 and run python3 -m autopep8 --in-place awsiot/mqtt_connection_builder.py
| """ | ||
| This builder creates an :class:`awscrt.mqtt.Connection`, configured for an mTLS MQTT connection to AWS IoT. | ||
| TLS arguments are passed as filepaths. | ||
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.
again. stop removing blank lines from docstrings, it messes up the generated HTML docs
| websocket_handshake_transform=websocket_handshake_transform, | ||
| websocket_proxy_options=websocket_proxy_options, | ||
| **kwargs) | ||
| **kwargs) |
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.
trivial: put back blank line at end of file
| This builder creates an :class:`awscrt.mqtt.Connection`, configured for an TLS MQTT connection to AWS IoT without | ||
| using client side certificates and keys for authentication using AWS IoT custom authorizer and MQTT userid,passsword parameter. | ||
| This function takes all :mod:`common arguments<awsiot.mqtt_connection_builder>` | ||
| described at the top of this doc. |
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.
Be sure to document the new arguments
described at the top of this doc, as well as... Keyword Args: username (str): username for custom auth password (str): password for custom auth | @graebm Thanks for reviewing, do you need anything else from me? Not sure if the white space changes is a task for me |
| @janbroch can you make all of the changes that have been suggested? |
| Greetings! It looks like this PR hasn’t been active in longer than a week, add a comment or an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one. |
*Description of changes:
Made minor changes to the
mqtt_connection_builder.pyto allow connecting to an AWS IoT endpoint with a custom authorizer. I added one helper functiontls_custom_authto establish a tls connection without using client side certs/keys.I also changed the logic to force port 443 and set ALPN to
mqttwhen apasswordfield is specified in the connection parameters.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.