Esempio n. 1
0
def bearer_token_handler(token):
    try:
        identity = from_bearer_token(token)
    except Exception:
        login_failure_count.inc()
        logger.error("Failed to validate bearer token value", exc_info=True)
        abort(401, "Failed to validate bearer token value")

    return {"uid": identity}
Esempio n. 2
0
def bearer_token_handler(token):
    try:
        identity = from_bearer_token(token)
        validate(identity)
    except Exception as e:
        login_failure_count.inc()
        logger.debug("Failed to validate bearer token value", exc_info=True)
        return None

    return {"uid": identity}
Esempio n. 3
0
    def test_validation_with_invalid_identity(self):
        identity = from_bearer_token("InvalidPassword")

        with self.assertRaises(ValueError):
            validate(identity)
Esempio n. 4
0
 def _build_id(self):
     identity = from_bearer_token(self.shared_secret)
     return identity