warden-oauth2-strategies 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b19bf4bebd18153ebe1cca675986f8792d62101
|
4
|
+
data.tar.gz: b38ed60cfdcb9735f42de0f202ca4ca87aee8123
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df28174f8ac1d2935ade911f23e965953d8101891c33ae1d70e7118c6ad2092a1856118b2be2f99470a197949845df77386cd0bdd494f475e28fa34bb5a6d971
|
7
|
+
data.tar.gz: 3b410cf14da8fe3a3b9c322f98d08df551a60685830c998972ef39b9867e66f9cf9a2d998ee9147714f10a7043dde218aaf523935f468f73a70e176ac4b880c4
|
@@ -16,10 +16,15 @@ module Warden
|
|
16
16
|
def client_authenticated
|
17
17
|
if params['username'] && params['password']
|
18
18
|
valid_client = client.valid?(username: params['username'], password: params['password'])
|
19
|
-
valid_client
|
19
|
+
if valid_client
|
20
|
+
super
|
21
|
+
else
|
22
|
+
fail('invalid_client')
|
23
|
+
self.error_description = 'Incorrect username or password'
|
24
|
+
end
|
20
25
|
else
|
21
26
|
fail('invalid_request')
|
22
|
-
self.error_description = '
|
27
|
+
self.error_description = 'Empty username or password'
|
23
28
|
end
|
24
29
|
end
|
25
30
|
end
|
@@ -32,15 +32,16 @@ describe Warden::OAuth2::Strategies::ResourceOwnerPasswordCredentials do
|
|
32
32
|
client_model.stub(locate: client_instance)
|
33
33
|
subject.stub(:params).and_return('client_id' => 'awesome', 'username' => 'someuser', 'password' => 'incorrect')
|
34
34
|
subject._run!
|
35
|
-
subject.message.should == 'invalid_client'
|
36
35
|
subject.error_status.should == 401
|
36
|
+
subject.message.should == 'invalid_client'
|
37
|
+
subject.error_description.should_not be_empty
|
37
38
|
end
|
38
39
|
it 'should fail if username and password are not provided' do
|
39
40
|
client_model.stub(locate: double)
|
40
41
|
subject.stub(:params).and_return('client_id' => 'awesome')
|
41
42
|
subject._run!
|
42
|
-
subject.message.should == 'invalid_request'
|
43
43
|
subject.error_status.should == 400
|
44
|
+
subject.message.should == 'invalid_request'
|
44
45
|
subject.error_description.should_not be_empty
|
45
46
|
end
|
46
47
|
it 'should pass username and password to validation check' do
|