lam_auth 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  Аутентификация для спецпроектов [Lookatme](http://www.lookatme.ru) и [The Village](http://www.the-village.ru)
2
2
 
3
+ [Описание механизма аутентификации](https://github.com/downloads/macovsky/lam_auth/Look%20At%20Me%20&%20The%20Village%20OAuth.pdf)
4
+
3
5
  ## Установка
4
6
 
5
7
  gem install lam_auth
@@ -45,10 +47,11 @@
45
47
  },
46
48
  "first_name" => "Шляпа",
47
49
  "birthday" => "13-12-1979",
48
- "login" => "macovsky"}
50
+ "login" => "macovsky"
51
+ }
49
52
  ```
50
53
 
51
- В модели пользователя нужно подключить `LamAuth`:
54
+ В модели пользователя нужно подключить модуль `LamAuth::Model`:
52
55
 
53
56
  ```ruby
54
57
  class User < ActiveRecord::Base
@@ -141,3 +144,4 @@ end
141
144
  ```ruby
142
145
  before_filter :authenticate!
143
146
  ```
147
+
@@ -1,3 +1,3 @@
1
1
  module LamAuth
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
data/lib/lam_auth.rb CHANGED
@@ -14,16 +14,16 @@ module LamAuth
14
14
  def config
15
15
  {
16
16
  'lookatme' => {
17
- 'prefix' => 'lam',
17
+ 'prefix' => 'lam',
18
18
  'url' => 'http://www.lookatme.ru',
19
19
  'api' => 'LAM',
20
20
  'api_url' => 'http://www.lookatme.ru/api/js/LAM.Login.js',
21
21
  },
22
22
  'village' => {
23
- 'prefix' => 'village',
23
+ 'prefix' => 'village',
24
24
  'url' => 'http://www.the-village.ru',
25
25
  'api' => 'VLG',
26
- 'api_url' => 'http://assets0.the-village.ru/api/js/VLG.Login.js',
26
+ 'api_url' => 'http://www.the-village.ru/api/js/VLG.Login.js',
27
27
  }
28
28
  }[site]
29
29
  end
@@ -31,11 +31,11 @@ module LamAuth
31
31
  def site
32
32
  %w{lookatme village}.include?(app['site']) ? app['site'] : 'lookatme'
33
33
  end
34
-
34
+
35
35
  def url
36
36
  config['url']
37
37
  end
38
-
38
+
39
39
  def cookie_id
40
40
  "#{config['prefix']}_#{app['app_id']}"
41
41
  end
@@ -44,11 +44,11 @@ module LamAuth
44
44
  hash = parse_cookie_to_hash(cookie)
45
45
  valid_hash?(hash) && hash['access_token']
46
46
  end
47
-
47
+
48
48
  def parse_cookie_to_hash(data)
49
49
  Rack::Utils.parse_query(Rack::Utils.unescape(data.to_s.gsub('"', '')))
50
50
  end
51
-
51
+
52
52
  def valid_hash?(hash)
53
53
  Digest::MD5.hexdigest(hash.except('sig').sort.map{|v| v.join('=')}.join + app['secret']) == hash['sig']
54
54
  end
metadata CHANGED
@@ -1,36 +1,25 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lam_auth
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.1
5
5
  prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Max Macovsky
14
9
  - Anton Platonov
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2012-08-21 00:00:00 -07:00
20
- default_executable:
13
+ date: 2013-10-22 00:00:00.000000000 Z
21
14
  dependencies: []
22
-
23
- description: ""
24
- email:
15
+ description: ''
16
+ email:
25
17
  - robotector@gmail.com
26
18
  - platosha@lookatme.ru
27
19
  executables: []
28
-
29
20
  extensions: []
30
-
31
21
  extra_rdoc_files: []
32
-
33
- files:
22
+ files:
34
23
  - .gitignore
35
24
  - Gemfile
36
25
  - README.md
@@ -43,42 +32,28 @@ files:
43
32
  - lib/lam_auth/helpers.rb
44
33
  - lib/lam_auth/model.rb
45
34
  - lib/lam_auth/version.rb
46
- has_rdoc: true
47
35
  homepage: http://github.com/macovsky/lam_auth
48
36
  licenses: []
49
-
50
37
  post_install_message:
51
38
  rdoc_options: []
52
-
53
- require_paths:
39
+ require_paths:
54
40
  - lib
55
- required_ruby_version: !ruby/object:Gem::Requirement
41
+ required_ruby_version: !ruby/object:Gem::Requirement
56
42
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
64
- required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
48
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
73
53
  requirements: []
74
-
75
54
  rubyforge_project:
76
- rubygems_version: 1.6.2
55
+ rubygems_version: 1.8.23
77
56
  signing_key:
78
57
  specification_version: 3
79
- summary: !binary |
80
- 0JDRg9GC0LXQvdGC0LjRhNC40LrQsNGG0LjRjyDQtNC70Y8g0YHQv9C10YbQ
81
- v9GA0L7QtdC60YLQvtCyIExvb2thdG1l
82
-
58
+ summary: Аутентификация для спецпроектов Lookatme
83
59
  test_files: []
84
-