Git Product home page Git Product logo

flask-praetorian's Issues

Fix issue with eternal tokens and setting the JWT_*_LIFESPAN variables

Eternal tokens don't work because the value of the max interval is too great to add to the current time. So just use a very large interval instead of the maximum one.

Also, there isn't an easy way to parse a string to an Interval. So, instead of having the JWT_*_LIFESPAN variables expect to be an Interval, instead make them a dict that can be used to create an interval

Update README

  • Add build-status image
  • Replace 'included' text with...sigh...copy

Fix flake8 error

$ flake8 tests
tests/conftest.py:27:9: E722 do not use bare except'

Add a call to optional user method 'validate'

It should be possible for the User class used by the client code to have a validate method. This method could be used to make sure that a user is still active, hasn't changed username, etc.

The method should raise an exception if it fails

Add argon2 support

When passlib1.7 is released, add argon2 support so that it may be used as the encryption scheme. It should also become the default at that point.

Quickstart Typo

Hello, I'm going through the quickstart guide for the first time to give flask-praetorian a try. In the quickstart,

POST /auth HTTP/1.1
Host: localhost:5000
Content-Type: application/json
{
    "username": "TheDude",
    "password": "abides"
}

should be

POST /login

for the current example as it does not have /auth endpoint. The docs should also reflect that.

Figure out how to register /auth endpoint with swagger

Figure out what needs to be done so that the /auth endpoint inherited from flask_jwt is available to swagger for projects that use it to automatically document their api. Make sure that the swagger documentation includes some good explanation of how the endpoint works

Switch back to bcrpyt as the default

Turns out that argon2 has a dependency in Ubuntu for libffi-dev. Installing via pip will not resolve this dependency.

Try adding cffi as an explicit install requirement or some of the other approaches mentioned here:
Kozea/cairocffi#14

If there is not a solution that resolves all dependencies without having to install anything but python and pip on the system, switch the default back to bcrypt

Add verify_and_update support

We will need the ability to verify a password using it's encryption algorithm and then re-encrypt with a new algorithm. This is necessary if an application decides to switch encryption methods but still needs current passwords to function correctly.

fix warnings

When running the test suite, the following warnings come up:

  pytest-capturelog plugin has been merged into the core, please remove it from your requirements.

tests/test_base.py::TestPraetorian::()::test_encrypt_password
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:794: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.
    'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and '

tests/test_base.py::TestPraetorian::()::test_validate_jwt_data
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_base.py::TestPraetorian::()::test_encode_jwt_token
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_base.py::TestPraetorian::()::test_encode_eternal_jwt_token
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_base.py::TestPraetorian::()::test_refresh_jwt_token
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_base.py::TestPraetorian::()::test_read_token_from_header
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_base.py::TestPraetorian::()::test_pack_header_for_user
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_decorators.py::TestPraetorianDecorators::()::test_auth_required
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/work/flask-praetorian/tests/test_decorators.py:77: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    default_guard.access_lifespan
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2064: PendulumDeprecationWarning: The subtract_timedelta() method will be removed in version 2.0.
    return self.subtract_timedelta(other)
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_decorators.py::TestPraetorianDecorators::()::test_roles_required
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

tests/test_decorators.py::TestPraetorianDecorators::()::test_roles_accepted
  /Users/tbeck/.virtualenvs/praetorian/lib/python3.6/site-packages/pendulum/pendulum.py:2081: PendulumDeprecationWarning: The add_timedelta() method will be removed in version 2.0.
    return self.add_timedelta(other)

-- Docs: http://doc.pytest.org/en/latest/warnings.html

Rearrange docs a little bit

  • Make the link from README to the document pages more samless
  • Drop the links to the raw sphinx docs
  • Update badges in README
  • Fix conf.py inclusion of base package
  • Fixup setup.py while at it
  • Add classifiers to setup.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.