negval-omniauth-yandex 0.0.2lite

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.swp
2
+ *.swo
3
+ Gemfile.lock
4
+ coverage
5
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Yandex OAuth strategy for OmniAuth
2
+
3
+ This gem contains the unofficial Yandex OAuth2 strategy for [OmniAuth](http://github.com/intridea/omniauth).
4
+
5
+ ## Installation
6
+
7
+ gem "omniauth-yandex"
8
+
9
+ Also, you have to obtain API key for your app at Yandex [OAuth app registration page](https://oauth.yandex.ru/client/new)
10
+
11
+ ## Basic Usage
12
+
13
+ use OmniAuth::Builder do
14
+ provider :yandex, ENV['YANDEX_KEY'], ENV['YANDEX_PRIVATE_KEY']
15
+ end
16
+
17
+
18
+ ## Links
19
+
20
+ * http://api.yandex.ru/oauth/
21
+
22
+ ## License
23
+
24
+ Copyright (c) 2011 by Kirill Shatrov, [Evrone.com](http://evrone.com/)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,51 @@
1
+ require 'omniauth/strategies/oauth2'
2
+ require 'json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+
7
+ # Authenticate to Yandex.ru utilizing OAuth 2.0
8
+ # http://api.yandex.ru/oauth/
9
+
10
+ class Yandex < OmniAuth::Strategies::OAuth2
11
+ option :name, "yandex"
12
+
13
+ option :client_options, {
14
+ :site => 'https://oauth.yandex.ru/',
15
+ :token_url => '/token',
16
+ :authorize_url => '/authorize'
17
+ }
18
+
19
+ uid do
20
+ raw_info[:uid]
21
+ end
22
+
23
+ extra do
24
+ {:raw_info => raw_info}
25
+ end
26
+
27
+ def callback_url
28
+ if options.authorize_options.respond_to? :callback_url
29
+ options.authorize_options.callback_url
30
+ else
31
+ super
32
+ end
33
+ end
34
+
35
+ private
36
+
37
+ def raw_info
38
+ @raw_info ||= begin
39
+ # Get user info from Ya.ru API
40
+ # http://api.yandex.ru/yaru/doc/ref/concepts/discovery.xml
41
+ json_data = access_token.get("https://login.yandex.ru/info?format=json").body
42
+ data = JSON.parse(json_data)
43
+ {
44
+ :uid => data["id"],
45
+ }
46
+ end
47
+ end
48
+
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Yandex
3
+ VERSION = "0.0.2lite"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "omniauth"
2
+ require "omniauth-yandex/version"
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ autoload :Yandex, "omniauth/strategies/yandex"
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "omniauth-yandex/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "negval-omniauth-yandex"
6
+ s.version = Omniauth::Yandex::VERSION
7
+ s.authors = ["Kir Shatrov"]
8
+ s.email = ["shatrov@me.com"]
9
+ s.homepage = "https://github.com/kirs/omniauth-yandex"
10
+ s.summary = %q{OmniAuth strategy for Yandex.ru}
11
+ s.description = %q{OmniAuth strategy for Yandex.ru}
12
+
13
+ s.rubyforge_project = "omniauth-yandex"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'omniauth', '~> 1.0'
21
+ s.add_dependency 'omniauth-oauth2', '~> 1.0'
22
+ s.add_dependency 'xml-simple'
23
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: negval-omniauth-yandex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2lite
5
+ prerelease: 5
6
+ platform: ruby
7
+ authors:
8
+ - Kir Shatrov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth2
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: xml-simple
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: OmniAuth strategy for Yandex.ru
63
+ email:
64
+ - shatrov@me.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - README.md
72
+ - Rakefile
73
+ - lib/omniauth-yandex.rb
74
+ - lib/omniauth-yandex/version.rb
75
+ - lib/omniauth/strategies/yandex.rb
76
+ - omniauth-yandex.gemspec
77
+ homepage: https://github.com/kirs/omniauth-yandex
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>'
93
+ - !ruby/object:Gem::Version
94
+ version: 1.3.1
95
+ requirements: []
96
+ rubyforge_project: omniauth-yandex
97
+ rubygems_version: 1.8.24
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: OmniAuth strategy for Yandex.ru
101
+ test_files: []
102
+ has_rdoc: