casino-moped_authenticator 0.1.0 → 0.1.1
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: 994197499f08f5c429b3aa6e79aa9d01af8b8173
|
4
|
+
data.tar.gz: 02a902feebcf9201208bb55ddb816625e7751eeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 759af790db7a24563218980fd7d29eac4284a10bc746f3b1068edcc38b284ec6b33b75420921a87f6a1ab9007e5f9b45471fdef36c14e62b86923b5f117cb73b
|
7
|
+
data.tar.gz: 460dd330d559ab7f656333f9a37e8ee71b61f767abc7642158c729200ad6726b4bd4ededb10e06ee05cea1504748572a3dda03654f107f94c9a7f024ec7c6828
|
data/CHANGELOG.md
ADDED
@@ -51,11 +51,11 @@ class CASino::MopedAuthenticator
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def extra_attributes(user)
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
extra_attributes_option.each_with_object({}) do |(attribute_name, database_column), attributes|
|
55
|
+
value = user[database_column]
|
56
|
+
value = value.to_s if value.is_a?(Moped::BSON::ObjectId)
|
57
|
+
attributes[attribute_name] = value
|
57
58
|
end
|
58
|
-
attributes
|
59
59
|
end
|
60
60
|
|
61
61
|
def extra_attributes_option
|
@@ -108,6 +108,30 @@ module CASino
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
describe 'extra_attributes' do
|
112
|
+
let(:extra_attributes) {{
|
113
|
+
id: '_id',
|
114
|
+
email: 'mail_address',
|
115
|
+
roles: 'roles',
|
116
|
+
level: 'level',
|
117
|
+
}}
|
118
|
+
|
119
|
+
it 'returns the bson id as a string' do
|
120
|
+
create_user(
|
121
|
+
'test_attributes',
|
122
|
+
'$5$cegeasjoos$vPX5AwDqOTGocGjehr7k1IYp6Kt.U4FmMUa.1l6NrzD', # password: testpassword
|
123
|
+
mail_address: 'mail@example.org',
|
124
|
+
roles: ['admin', 'agent'],
|
125
|
+
level: 26,
|
126
|
+
)
|
127
|
+
data = subject.validate('test_attributes', 'testpassword')
|
128
|
+
expect(data[:extra_attributes][:email]).to eq 'mail@example.org'
|
129
|
+
expect(data[:extra_attributes][:roles]).to eq ['admin', 'agent']
|
130
|
+
expect(data[:extra_attributes][:level]).to eq 26
|
131
|
+
expect(data[:extra_attributes][:id]).to eq user_with_name('test_attributes')['_id'].to_s
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
111
135
|
end
|
112
136
|
|
113
137
|
def create_user(username, password, extra = {})
|
@@ -121,6 +145,10 @@ module CASino
|
|
121
145
|
session[options[:collection]].find(username: username).update(password: new_password)
|
122
146
|
end
|
123
147
|
|
148
|
+
def user_with_name(username)
|
149
|
+
session[options[:collection]].find(username: username).first
|
150
|
+
end
|
151
|
+
|
124
152
|
def session
|
125
153
|
@session ||= ::Moped::Session.connect(options[:database_url])
|
126
154
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casino-moped_authenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gergo Sulymosi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- .gitignore
|
148
148
|
- .rspec
|
149
149
|
- .travis.yml
|
150
|
+
- CHANGELOG.md
|
150
151
|
- Gemfile
|
151
152
|
- LICENSE.txt
|
152
153
|
- README.md
|