Beispiel #1
0
    def __init__(self, access_token: str):
        log.info("Setting up an AccessTokenAuthorizer. It will use an "
                 "auth type of Bearer and cannot handle 401s.")
        self.access_token = access_token
        self.header_val = "Bearer %s" % access_token

        self.access_token_hash = utils.sha256_string(self.access_token)
        log.debug(f'Bearer token has hash "{self.access_token_hash}"')
def test_sha256string():
    test_string = "foo"
    expected_sha = "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"

    assert utils.sha256_string(test_string) == expected_sha
Beispiel #3
0
def test_sha256string():
    test_string = "foo"
    expected_sha = "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f" "98a5e886266e7ae"

    assert utils.sha256_string(test_string) == expected_sha
Beispiel #4
0
 def access_token(self, value: Optional[str]) -> None:
     self._access_token = value
     if value:
         self._access_token_hash = utils.sha256_string(value)