Skip to content

Add automatic access token rotation for workspace apps#347

Merged
RodneyU215 merged 21 commits into
masterfrom
roach/automatic-token-rotation
Sep 12, 2018
Merged

Add automatic access token rotation for workspace apps#347
RodneyU215 merged 21 commits into
masterfrom
roach/automatic-token-rotation

Conversation

@Roach

@Roach Roach commented Sep 5, 2018

Copy link
Copy Markdown
Contributor

Summary

With workspace apps comes the ability to use short-lived, expiring, tokens. This patch adds the ability for the client to automatically refresh access tokens after expiration and call your app's refresh callback to update said tokens in your app's datastore.

More info: https://api.slack.com/changelog/2018-08-workspace-token-rotation

Docs are still in progress.

Requirements (place an x in each [ ])

Roach added 4 commits August 27, 2018 23:51
Added token refresh method, automatic refresh on invalid_auth
Added expires_at to requester object to store token TTL
updated rtm_connect to check for token type
split HTTP request helper into builder and submitter methods
fixed token expiration ts, moved rtm_connect token type check into client
Added tests
@Roach Roach self-assigned this Sep 5, 2018

@aoberoi aoberoi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get a chance to look through the tests just yet. But I think there are enough comments here that the implementation might change significantly, so I didn't think it would be worth reviewing them just yet.

Comment thread README.rst Outdated
Comment thread README.rst Outdated
Comment thread README.rst Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/slackrequest.py Outdated
Comment thread slackclient/slackrequest.py Outdated
Comment thread slackclient/slackrequest.py Outdated
Comment thread slackclient/slackrequest.py Outdated
Comment thread slackclient/slackrequest.py Outdated
Removed unused token attribute
Added enterprise_id to token updater (commented out)
@codecov

codecov Bot commented Sep 6, 2018

Copy link
Copy Markdown

Codecov Report

Merging #347 into master will increase coverage by 1.97%.
The diff coverage is 84.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #347      +/-   ##
==========================================
+ Coverage    74.4%   76.38%   +1.97%     
==========================================
  Files          10       10              
  Lines         379      415      +36     
  Branches       67       74       +7     
==========================================
+ Hits          282      317      +35     
+ Misses         88       87       -1     
- Partials        9       11       +2
Impacted Files Coverage Δ
slackclient/slackrequest.py 100% <100%> (ø) ⬆️
slackclient/exceptions.py 54.54% <100%> (+4.54%) ⬆️
slackclient/client.py 66.66% <81.63%> (+14.2%) ⬆️
slackclient/server.py 84.09% <82.6%> (-1.71%) ⬇️
slackclient/channel.py 100% <0%> (+23.8%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05dacba...5d99132. Read the comment docs.

Comment thread slackclient/slackrequest.py Outdated
Comment thread README.rst
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/server.py Outdated
Comment thread slackclient/server.py Outdated
Comment thread tests/test_slackclient.py
Comment thread slackclient/slackrequest.py Outdated
Comment thread slackclient/client.py Outdated
Comment thread slackclient/client.py Outdated
@aoberoi

aoberoi commented Sep 10, 2018

Copy link
Copy Markdown
Contributor

my review from the last 2 days is complete and up to date with all the latest code changes. the only unresolved issue from the previous reviews is this one: #347 (comment)

@CLAassistant

CLAassistant commented Sep 11, 2018

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread slackclient/server.py Outdated
self.reconnect_count = 0

reply = self.api_requester.do(self.token, connect_method, timeout=timeout, post_data=kwargs)
reply = self.api_requester.do(self.token, connect_method, kwargs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put the timeout argument back in and name the post_data argument.

@RodneyU215 RodneyU215 merged commit 0d3677a into master Sep 12, 2018
@RodneyU215 RodneyU215 deleted the roach/automatic-token-rotation branch May 7, 2019 20:32
c-goosen pushed a commit to c-goosen/python-slackclient that referenced this pull request Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants