casdoor / casdoor-python-sdk

Python client SDK for Casdoor
https://pypi.org/project/casdoor
Apache License 2.0
34 stars 36 forks source link

fix: Fix self.algorithms data type #6

Closed fuh closed 2 years ago

fuh commented 2 years ago

Requires list data type

casbin-bot commented 2 years ago

@Steve0x2a @seriouszyx @Abingcbc @ComradeProgrammer please review

ffyuanda commented 2 years ago

Hmm, guess we can turn self.algorithms to singular instead (remove the 's' -> self.algorithm). Since this attribute should be a str.

fuh commented 2 years ago

jwt.decode() method in PyJWT requires a list data type.

def decode(
        self,
        jwt: str,
        key: str = "",
        algorithms: Optional[List[str]] = None,
        options: Optional[Dict] = None,
        **kwargs,
    ) -> Dict[str, Any]:
ffyuanda commented 2 years ago

@fuh uhhhh, sure!

Though digging into the source dependencies, the signature suggests it could be [Any | None].

def _verify_signature(
        self,
        signing_input,
        header,
        signature,
        key="",
        algorithms=None,
    )

But yeah, let's go ahead and change it to a list. Though you might want to test things out using $CASDOOR_PYTHON_SDK/src/tests/test_oauth.py, you should set up your own Casdoor instance to test it.

This repo is lack of maintenance, if you see anything suspicious, we might be able to try to work through it :)

hsluoyz commented 2 years ago

@fuh @ffyuanda is this PR ready to merge?

ffyuanda commented 2 years ago

@hsluoyz LGTM

hsluoyz commented 2 years ago

@fuh can you also fix this? https://github.com/casdoor/casdoor-python-sdk/issues/10

hsluoyz commented 2 years ago

@fuh can you resolve the conflicts?

image

hsluoyz commented 2 years ago

@Steve0x2a can you make a PR to fix it?