forked from pallets-eco/flask-security-3.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pallets-eco#352 from fuhrysteve/develop
X-Forwarded-For can contain multiple IP addresses
- Loading branch information
Showing
4 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,11 @@ env/ | |
|
||
*.db | ||
*cache* | ||
|
||
# vim | ||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
*.un~ | ||
Session.vim | ||
.netrwhist | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,19 @@ def test_trackable_flag(app, client): | |
assert user.last_login_ip == 'untrackable' | ||
assert user.current_login_ip == '127.0.0.1' | ||
assert user.login_count == 2 | ||
|
||
|
||
def test_trackable_with_multiple_ips_in_headers(app, client): | ||
e = '[email protected]' | ||
authenticate(client, email=e) | ||
logout(client) | ||
authenticate(client, email=e, headers={ | ||
'X-Forwarded-For': '99.99.99.99, 88.88.88.88'}) | ||
|
||
with app.app_context(): | ||
user = app.security.datastore.find_user(email=e) | ||
assert user.last_login_at is not None | ||
assert user.current_login_at is not None | ||
assert user.last_login_ip == 'untrackable' | ||
assert user.current_login_ip == '88.88.88.88' | ||
assert user.login_count == 2 |