-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 #3145 from tardyp/authz_smokes
Fix login issues on py3 and recent chrome
- Loading branch information
Showing
25 changed files
with
276 additions
and
85 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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This file is part of Buildbot. Buildbot is free software: you can | ||
# redistribute it and/or modify it under the terms of the GNU General Public | ||
# License as published by the Free Software Foundation, version 2. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Copyright Buildbot Team Members | ||
|
||
from __future__ import absolute_import | ||
from __future__ import print_function | ||
|
||
from twisted.python.compat import nativeString | ||
from twisted.python.compat import networkString | ||
|
||
|
||
# patch for http://twistedmatrix.com/trac/ticket/9127 | ||
# unfortunately the impacted code is deeply inside render method, so we need to patch the whole | ||
# render method | ||
|
||
def render(self, request): | ||
""" | ||
Send www-authenticate headers to the client | ||
""" | ||
def generateWWWAuthenticate(scheme, challenge): | ||
_l = [] | ||
for k, v in challenge.items(): | ||
_l.append(networkString("%s=%s" % (nativeString(k), quoteString(nativeString(v))))) | ||
return b" ".join([scheme, b", ".join(_l)]) | ||
|
||
def quoteString(s): | ||
return '"%s"' % (s.replace('\\', '\\\\').replace('"', '\\"'),) | ||
|
||
request.setResponseCode(401) | ||
for fact in self._credentialFactories: | ||
challenge = fact.getChallenge(request) | ||
request.responseHeaders.addRawHeader( | ||
b'www-authenticate', | ||
generateWWWAuthenticate(fact.scheme, challenge)) | ||
if request.method == b'HEAD': | ||
return b'' | ||
return b'Unauthorized' | ||
|
||
|
||
def patch(): | ||
from twisted.web._auth.wrapper import UnauthorizedResource | ||
UnauthorizedResource.render = render |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix :py:class:`UserPasswordAuth` authentication on ``py3`` and recent browsers. (:issue:`3162`, :issue:`3163`). | ||
The ``py3`` fix also requires Twisted https://github.com/twisted/twisted/pull/773. |
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
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# this file will contains the different generic functions which | ||
# will be called by the different tests | ||
# inspired by this methodology | ||
# http://www.lindstromhenrik.com/using-protractor-with-coffeescript/ | ||
|
||
|
||
class BasePage | ||
# accessors for elements that all pages have have (menu, login, etc) | ||
constructor: () -> | ||
|
||
clickWhenClickable: (element) -> | ||
browser.wait -> | ||
element.click().then (-> | ||
true | ||
), -> | ||
element.getLocation().then (l)-> | ||
element.getSize().then (s)-> | ||
console.log 'not clickable', s, l | ||
false | ||
|
||
logOut: -> | ||
element.all(By.css('.avatar img')).click() | ||
element.all(By.linkText('Logout')).click() | ||
anonymousButton = element(By.css('.dropdown')) | ||
expect(anonymousButton.getText()).toContain("Anonymous") | ||
|
||
loginUser: (user, password) -> | ||
browser.get("http://#{user}:#{password}@localhost:8010/auth/login") | ||
anonymousButton = element(By.css('.dropdown')) | ||
expect(anonymousButton.getText()).not.toContain("Anonymous") | ||
|
||
|
||
module.exports = BasePage |
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
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
Oops, something went wrong.