mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-07 11:22:21 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99ac732d10 | ||
|
|
e8b0c62818 | ||
|
|
1108f1670c | ||
|
|
3575a2df18 |
@@ -3,6 +3,14 @@ Flask-Security Changelog
|
|||||||
|
|
||||||
Here you can see the full list of changes between each Flask-Security release.
|
Here you can see the full list of changes between each Flask-Security release.
|
||||||
|
|
||||||
|
Version 1.6.2
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Released April 4th 2013
|
||||||
|
|
||||||
|
- Fixed bug with http basic auth
|
||||||
|
|
||||||
|
|
||||||
Version 1.6.1
|
Version 1.6.1
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ copyright = u'2012, Matt Wright'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '1.6.1'
|
version = '1.6.2'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = version
|
release = version
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
:license: MIT, see LICENSE for more details.
|
:license: MIT, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '1.6.1'
|
__version__ = '1.6.2'
|
||||||
|
|
||||||
from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
|
from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
|
||||||
from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore
|
from .datastore import SQLAlchemyUserDatastore, MongoEngineUserDatastore, PeeweeUserDatastore
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
:license: MIT, see LICENSE for more details.
|
:license: MIT, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from collections import namedtuple
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from flask import current_app, Response, request, redirect, _request_ctx_stack
|
from flask import current_app, Response, request, redirect, _request_ctx_stack
|
||||||
@@ -30,6 +31,8 @@ _default_unauthorized_html = """
|
|||||||
or your browser doesn't understand how to supply the credentials required.</p>
|
or your browser doesn't understand how to supply the credentials required.</p>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
BasicAuth = namedtuple('BasicAuth', 'username, password')
|
||||||
|
|
||||||
|
|
||||||
def _get_unauthorized_response(text=None, headers=None):
|
def _get_unauthorized_response(text=None, headers=None):
|
||||||
text = text or _default_unauthorized_html
|
text = text or _default_unauthorized_html
|
||||||
@@ -67,7 +70,7 @@ def _check_token():
|
|||||||
|
|
||||||
|
|
||||||
def _check_http_auth():
|
def _check_http_auth():
|
||||||
auth = request.authorization or dict(username=None, password=None)
|
auth = request.authorization or BasicAuth(username=None, password=None)
|
||||||
user = _security.datastore.find_user(email=auth.username)
|
user = _security.datastore.find_user(email=auth.username)
|
||||||
|
|
||||||
if user and utils.verify_and_update_password(auth.password, user):
|
if user and utils.verify_and_update_password(auth.password, user):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Flask-Security',
|
name='Flask-Security',
|
||||||
version='1.6.1',
|
version='1.6.2',
|
||||||
url='https://github.com/mattupstate/flask-security',
|
url='https://github.com/mattupstate/flask-security',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
author='Matt Wright',
|
author='Matt Wright',
|
||||||
|
|||||||
@@ -142,6 +142,13 @@ class DefaultSecurityTests(SecurityTest):
|
|||||||
})
|
})
|
||||||
self.assertIn('HTTP Authentication', r.data)
|
self.assertIn('HTTP Authentication', r.data)
|
||||||
|
|
||||||
|
def test_http_auth_no_authorization(self):
|
||||||
|
r = self._get('/http', headers={})
|
||||||
|
self.assertIn('<h1>Unauthorized</h1>', r.data)
|
||||||
|
self.assertIn('WWW-Authenticate', r.headers)
|
||||||
|
self.assertEquals('Basic realm="Login Required"',
|
||||||
|
r.headers['WWW-Authenticate'])
|
||||||
|
|
||||||
def test_invalid_http_auth_invalid_username(self):
|
def test_invalid_http_auth_invalid_username(self):
|
||||||
r = self._get('/http', headers={
|
r = self._get('/http', headers={
|
||||||
'Authorization': 'Basic ' + base64.b64encode("bogus:bogus")
|
'Authorization': 'Basic ' + base64.b64encode("bogus:bogus")
|
||||||
|
|||||||
Reference in New Issue
Block a user