omniauth-geoloqi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +35 -0
- data/lib/omniauth-geoloqi.rb +2 -0
- data/lib/omniauth-geoloqi/version.rb +5 -0
- data/lib/omniauth/strategies/geoloqi.rb +61 -0
- data/omniauth-geoloqi.gemspec +17 -0
- metadata +71 -0
data/README.markdown
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
omniauth-geoloqi
|
2
|
+
===
|
3
|
+
Adapter for the [Omniauth](https://github.com/intridea/omniauth) gem. Requires version 1.0 or later.
|
4
|
+
|
5
|
+
Installation
|
6
|
+
---
|
7
|
+
|
8
|
+
gem install omniauth-geoloqi
|
9
|
+
|
10
|
+
Basic Usage (with Sinatra)
|
11
|
+
---
|
12
|
+
|
13
|
+
use Rack::Session::Cookie
|
14
|
+
use OmniAuth::Builder do
|
15
|
+
provider :geoloqi, 'YOUR CLIENT ID', 'YOUR CLIENT SECRET'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Direct user to '/auth/geoloqi' to start authorization.
|
19
|
+
|
20
|
+
get '/auth/geoloqi/callback' do
|
21
|
+
puts "THE RESULT HASH: #{request.env['omniauth.auth']}"
|
22
|
+
end
|
23
|
+
|
24
|
+
Found a bug?
|
25
|
+
---
|
26
|
+
Let us know! Send a pull request or a patch. Questions? Ask! We're here to help. File issues, we'll respond to them!
|
27
|
+
|
28
|
+
Authors
|
29
|
+
---
|
30
|
+
* Kyle Drake
|
31
|
+
|
32
|
+
TODO / Possible projects
|
33
|
+
---
|
34
|
+
* Integrate with Geoloqi ruby client
|
35
|
+
* Better examples
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Geoloqi < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "geoloqi"
|
7
|
+
|
8
|
+
option :client_options, {
|
9
|
+
:site => 'https://api.geoloqi.com',
|
10
|
+
:authorize_url => 'https://geoloqi.com/oauth/authorize',
|
11
|
+
:token_url => 'https://api.geoloqi.com/1/oauth/token'
|
12
|
+
}
|
13
|
+
|
14
|
+
option :access_token_options, {
|
15
|
+
:header_format => 'OAuth %s',
|
16
|
+
:param_name => 'access_token'
|
17
|
+
}
|
18
|
+
|
19
|
+
uid { access_token.params['user_id'] }
|
20
|
+
|
21
|
+
info do
|
22
|
+
{
|
23
|
+
:display_name => access_token.params['display_name'],
|
24
|
+
:username => access_token.params['username'],
|
25
|
+
:user_id => access_token.params['user_id'],
|
26
|
+
:is_anonymous => access_token.params['is_anonymous']
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
credentials do
|
31
|
+
{
|
32
|
+
'expires' => access_token.expires?,
|
33
|
+
'expires_at' => access_token.expires_at
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_access_token
|
38
|
+
super.tap do |token|
|
39
|
+
token.options.merge!(access_token_options)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def access_token_options
|
44
|
+
options.access_token_options.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }
|
45
|
+
end
|
46
|
+
|
47
|
+
def authorize_params
|
48
|
+
super.tap do |params|
|
49
|
+
params.merge!(:display => request.params['display']) if request.params['display']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# def raw_info
|
54
|
+
# access_token.options[:mode] = :query
|
55
|
+
# @raw_info ||= access_token.get('/1/account/profile').parsed
|
56
|
+
# end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
OmniAuth.config.add_camelization 'geoloqi', 'Geoloqi'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require './lib/omniauth-geoloqi/version'
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = 'omniauth-geoloqi'
|
4
|
+
s.version = OmniAuth::Geoloqi::VERSION
|
5
|
+
s.authors = ['Kyle Drake']
|
6
|
+
s.email = ['kyledrake@gmail.com']
|
7
|
+
s.homepage = 'http://github.com/geoloqi/omniauth-geoloqi'
|
8
|
+
s.summary = 'Geoloqi adapter for Omniauth'
|
9
|
+
s.description = 'Geoloqi adapter for Omniauth.'
|
10
|
+
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.require_paths = %w[lib]
|
13
|
+
s.rubyforge_project = s.name
|
14
|
+
s.required_rubygems_version = '>= 1.3.4'
|
15
|
+
|
16
|
+
s.add_dependency 'omniauth-oauth2', '> 1.0.0'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-geoloqi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kyle Drake
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-11-03 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: omniauth-oauth2
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.0.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
description: Geoloqi adapter for Omniauth.
|
28
|
+
email:
|
29
|
+
- kyledrake@gmail.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files: []
|
35
|
+
|
36
|
+
files:
|
37
|
+
- README.markdown
|
38
|
+
- lib/omniauth-geoloqi.rb
|
39
|
+
- lib/omniauth-geoloqi/version.rb
|
40
|
+
- lib/omniauth/strategies/geoloqi.rb
|
41
|
+
- omniauth-geoloqi.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://github.com/geoloqi/omniauth-geoloqi
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.3.4
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project: omniauth-geoloqi
|
66
|
+
rubygems_version: 1.5.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Geoloqi adapter for Omniauth
|
70
|
+
test_files: []
|
71
|
+
|