Hotfix/#754 client secret basic remove quote plus#755
Conversation
|
Are you willing to change this to do not use the |
|
Yes I will do. However, would it be more flexible to add an optional argument where you can specify the pre-encoding (before base64) of the user-pass instead of a boolean to quote_plus or not. |
…sic-remove-quote_plus' into hotfix/CZ-NIC#754-ClientSecretBasic-remove-quote_plus # Conflicts: # src/oic/utils/authn/client.py # tests/test_client.py
Codecov Report
@@ Coverage Diff @@
## master #755 +/- ##
==========================================
- Coverage 63.66% 63.65% -0.02%
==========================================
Files 64 64
Lines 11826 11822 -4
Branches 2091 2091
==========================================
- Hits 7529 7525 -4
Misses 3701 3701
Partials 596 596
Continue to review full report at Codecov.
|
| if "encoding" in kwargs: | ||
| encoding = kwargs["encoding"] | ||
| else: | ||
| encoding = "utf-8" | ||
|
|
||
| if "url_encoded" in kwargs: | ||
| url_encoded = kwargs["url_encoded"] | ||
| else: | ||
| url_encoded = True |
There was a problem hiding this comment.
I would rather define the kwargs with their default values in the method signature (and also document in the docstring).
There was a problem hiding this comment.
Hm, it looks like adding the annotation triggers complains from mypy. I am not sure if there is an easy way out of here.
Will have a look.
There are some other quality issues that need to be solved.
There was a problem hiding this comment.
OK, the mypy complain is because of the cis arg that is not in the superclass. One way to fix this is to remove the typing annotations. The other way is to make the signature the same (by making the cis a kwarg rather than arg).
I would go with the latter. If you are not willing to do that, make a separate issue and I will deal with that and you can base your PR on top of that.
|
Issues
======
- Added 1
See the complete overview on Codacy |
tpazderka
left a comment
There was a problem hiding this comment.
Looks good code-wise.
There are still two reported errors from mypy that need to be fixed:
tests/test_client.py:88: error: Incompatible types in assignment (expression has type "bytes", variable has type "str")
303tests/test_client.py:90: error: Argument 1 to "join" of "bytes" has incompatible type "Tuple[str, str]"; expected "Iterable[Union[ByteString, memoryview]]"
I don't see any problem with this code |
|
|
||
| http_args = csb.construct(cis, **kwargs) | ||
|
|
||
| user, passwd = user.encode(encoding), passwd.encode(encoding) |
There was a problem hiding this comment.
This assigns bytes to what was preciously str, mypy doesn't like that it may cause programming errors.
It should be solved by using a new variable, or encoding directly in L90.
There was a problem hiding this comment.
That should actually solve both mypy complains...
CHANGELOG.md.