mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Disable API authentication with username and password when two-factor authentication is enabled for the user (#35001).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@21436 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -48,6 +48,15 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
def test_api_should_deny_http_basic_auth_if_twofa_is_active
|
||||
user = User.generate! do |user|
|
||||
user.password = 'my_password'
|
||||
user.update(twofa_scheme: 'totp')
|
||||
end
|
||||
get '/users/current.xml', :headers => credentials(user.login, 'my_password')
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
def test_api_should_accept_http_basic_auth_using_api_key
|
||||
user = User.generate!
|
||||
token = Token.create!(:user => user, :action => 'api')
|
||||
|
||||
Reference in New Issue
Block a user