Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: improve anon/auth token logic (#148)
* core: TokenAuth request_token fix missing auth the method is intended to request authenticated token, per pydocs, but was passing an headers which was always missing Authorization. * core: use token in auth in subsequent requests if a token was saved in auth, it shall be used in subsequent requests. This avoid a situation where: to upload a blob, first is done anonymously, then retry with token then upload a manifest, avoid the attempt to upload anonymously if a token was present in the previous flow * core: if 401 on 2nd attempt, avoid anon tokens in the first flow using auth backend for token: 1. try do_request with no auths at all 2. the attempt to gain an anon token is success, but then the request fails with 401 3. at this point, in the third attempt, give chance to the flow to request a token but avoid any anon tokens. Please note: this happens effectively only on the first run of the flow. Subsequent do_request flow invocations should just succeed now on the 1st request by re-using the token --simplified behaviour introduced with this proposal * guard as headers is Optional * implement review request * Revert "implement review request" This reverts commit 102381c. This reverts commit 1e891d2. This reverts commit 6e22667. this was taken care in #153 This reverts commit 10e010b. * implement review comment about anon/req token from: #148 (comment) > And if the basic auth is there, skip over asking for an anon token as it stands, in case the basic auth are present, these are exchanged for the request token. Signed-off-by: tarilabs <[email protected]> --------- Signed-off-by: tarilabs <[email protected]>
- Loading branch information