oa-vkontakte 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +16 -1
- data/lib/oa-vkontakte.rb +1 -1
- data/lib/oa-vkontakte/version.rb +1 -1
- data/lib/omniauth/strategies/{vkontakte_open_api.rb → vkontakte.rb} +2 -2
- data/lib/omniauth/strategies/{vkontakte_open_api → vkontakte}/view_helper.rb +2 -2
- data/lib/omniauth/vkontakte.rb +1 -1
- data/oa-vkontakte.gemspec +1 -1
- data/spec/omniauth/strategires/{vkontakte_open_api_spec.rb → vkontakte_spec.rb} +2 -2
- metadata +13 -13
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
Добавить в config/initializers/omniauth.rb:
|
10
10
|
|
11
11
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
12
|
-
provider :
|
12
|
+
provider :vkontakte, <ID приложения>, <Защищенный ключ приложения>
|
13
13
|
end
|
14
14
|
|
15
15
|
Если ещё не определен, добавить путь в config/routes.rb:
|
@@ -42,6 +42,21 @@
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
|
+
== Интеграция с Devise
|
46
|
+
|
47
|
+
Devise с версии 1.2.rc интегрирован с OmniAuth. Подключить к нему <tt>oa-vkontakte</tt> достаточно просто, дописав в <tt>config/initializers/devise.rb</tt>:
|
48
|
+
config.omniauth :vkontakte, <ID приложения>, <Защищенный ключ приложения>
|
49
|
+
Callback будет приходить действию Devise::OmniauthCallbacks#vkontakte, так что придется озаботиться его наличием. Это удобно сделать, поменяв контроллер для callback'ов OmniAuth в <tt>routes.rb</tt>:
|
50
|
+
devise_for :users, :controllers => { :omniauth_callbacks => "authentications" }
|
51
|
+
AuthenticationsController в этом случае выглядит как-то так:
|
52
|
+
class AuthenticationsController < Devise::OmniauthCallbacksController
|
53
|
+
def vkontakte
|
54
|
+
omniauth = request.env["omniauth.auth"]
|
55
|
+
# создание или аутентификация пользователя
|
56
|
+
...
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
45
60
|
== Ссылки
|
46
61
|
|
47
62
|
OmniAuth: http://github.com/intridea/omniauth
|
data/lib/oa-vkontakte.rb
CHANGED
data/lib/oa-vkontakte/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'omniauth/vkontakte'
|
2
|
-
require 'omniauth/strategies/
|
2
|
+
require 'omniauth/strategies/vkontakte/view_helper'
|
3
3
|
|
4
4
|
module OmniAuth
|
5
5
|
class Configuration
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
|
11
11
|
module OmniAuth
|
12
12
|
module Strategies
|
13
|
-
class
|
13
|
+
class Vkontakte
|
14
14
|
include OmniAuth::Strategy
|
15
15
|
include ViewHelper::PageHelper
|
16
16
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
module OmniAuth
|
3
3
|
module Strategies
|
4
|
-
class
|
4
|
+
class Vkontakte
|
5
5
|
class ViewHelper
|
6
6
|
module PageHelper
|
7
7
|
def vkontakte_login_page
|
@@ -114,7 +114,7 @@ HEADER
|
|
114
114
|
document.getElementById("vk_api_transport").appendChild(el);
|
115
115
|
}());
|
116
116
|
</script>
|
117
|
-
<div id="vk_login"
|
117
|
+
<div id="vk_login" onclick="vkLogin.doLogin();"></div>
|
118
118
|
BUTTON
|
119
119
|
end
|
120
120
|
|
data/lib/omniauth/vkontakte.rb
CHANGED
data/oa-vkontakte.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = %q{http://github.com/oruen/oa-vkontakte}
|
13
13
|
s.rubyforge_project = %q{oa-vkontakte}
|
14
14
|
|
15
|
-
s.add_dependency(%q<oa-core>, ["
|
15
|
+
s.add_dependency(%q<oa-core>, [">= 0.1.6"])
|
16
16
|
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
17
17
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
18
18
|
s.add_development_dependency(%q<rack-test>, ["~> 0.5.6"])
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
2
|
|
3
|
-
describe OmniAuth::Strategies::
|
3
|
+
describe OmniAuth::Strategies::Vkontakte, :type => :strategy do
|
4
4
|
|
5
5
|
include OmniAuth::Test::StrategyTestCase
|
6
6
|
|
7
7
|
def strategy
|
8
|
-
[OmniAuth::Strategies::
|
8
|
+
[OmniAuth::Strategies::Vkontakte, 1983892, '6FF1PUlZfEyutJxctvtd']
|
9
9
|
end
|
10
10
|
|
11
11
|
describe 'POST /auth/vkontakte_open_api/callback с логином и паролем' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-vkontakte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Recobra
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-26 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -24,14 +24,14 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 23
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 1
|
33
|
-
-
|
34
|
-
version: 0.1.
|
33
|
+
- 6
|
34
|
+
version: 0.1.6
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -96,12 +96,12 @@ files:
|
|
96
96
|
- Rakefile
|
97
97
|
- lib/oa-vkontakte.rb
|
98
98
|
- lib/oa-vkontakte/version.rb
|
99
|
-
- lib/omniauth/strategies/
|
100
|
-
- lib/omniauth/strategies/
|
99
|
+
- lib/omniauth/strategies/vkontakte.rb
|
100
|
+
- lib/omniauth/strategies/vkontakte/view_helper.rb
|
101
101
|
- lib/omniauth/vkontakte.rb
|
102
102
|
- oa-vkontakte.gemspec
|
103
103
|
- spec/oa-vkontakte_spec.rb
|
104
|
-
- spec/omniauth/strategires/
|
104
|
+
- spec/omniauth/strategires/vkontakte_spec.rb
|
105
105
|
- spec/spec_helper.rb
|
106
106
|
has_rdoc: true
|
107
107
|
homepage: http://github.com/oruen/oa-vkontakte
|
@@ -139,5 +139,5 @@ specification_version: 3
|
|
139
139
|
summary: OmniAuth extension for vkontakte.ru authentication
|
140
140
|
test_files:
|
141
141
|
- spec/oa-vkontakte_spec.rb
|
142
|
-
- spec/omniauth/strategires/
|
142
|
+
- spec/omniauth/strategires/vkontakte_spec.rb
|
143
143
|
- spec/spec_helper.rb
|