omniauth-arcgis 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ require 'omniauth-arcgis/version'
2
+ require 'omniauth/strategies/arcgis'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module ArcGIS
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,48 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class ArcGIS < OmniAuth::Strategies::OAuth2
6
+ option :name, 'arcgis'
7
+
8
+ option :client_options, {
9
+ :site => 'https://www.arcgis.com',
10
+ :authorize_url => 'https://www.arcgis.com/sharing/oauth2/authorize',
11
+ :token_url => 'https://www.arcgis.com/sharing/oauth2/token'
12
+ }
13
+
14
+ # Force the access token response to be parsed as JSON even though the content type header response is text/plain
15
+ option :token_params, {
16
+ :parse => :json
17
+ }
18
+
19
+ # AGO doesn't support the state parameter yet
20
+ option :provider_ignores_state, true
21
+
22
+ uid {
23
+ raw_info['id']
24
+ }
25
+
26
+ info do
27
+ info = raw_info['user'] || {}
28
+ info = deep_symbolize(info)
29
+ info[:name] = info[:fullName]
30
+ info
31
+ end
32
+
33
+ extra do
34
+ {
35
+ :subscriptionInfo => raw_info['subscriptionInfo'],
36
+ :appInfo => raw_info['appInfo'],
37
+ :allSSL => raw_info['allSSL']
38
+ }
39
+ end
40
+
41
+ def raw_info
42
+ @raw_info ||= access_token.get('/sharing/portals/self', {:parse => :json, :params => {:f => 'json', :token => access_token.token}}).parsed
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ OmniAuth.config.add_camelization 'arcgis', 'ArcGIS'
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-arcgis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Aaron Parecki
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.1
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.1.1
30
+ description: ArcGIS Online adapter for OmniAuth.
31
+ email:
32
+ - aparecki@esri.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/omniauth-arcgis.rb
38
+ - lib/omniauth/strategies/arcgis.rb
39
+ - lib/omniauth-arcgis/version.rb
40
+ homepage: https://github.com/Esri/omniauth-arcgis
41
+ licenses:
42
+ - Apache 2.0
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.23
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: ArcGIS Online adapter for OmniAuth
65
+ test_files: []
66
+ has_rdoc: