omniauth-atech 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,49 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Atech < OmniAuth::Strategies::OAuth2
6
+
7
+ # Set the site
8
+ option :client_options, {:site => 'https://identity.atechmedia.com'}
9
+
10
+ # Always request the 'email_address' when authenticating using Omniauth.
11
+ option :authorize_params, {:scope => 'email_address'}
12
+
13
+ # Set the UID
14
+ uid { raw_info['identifier'].to_s }
15
+
16
+ # Set the all the default info properties as best we can
17
+ info do
18
+ {
19
+ 'nickname' => raw_info['username'],
20
+ 'email' => email_address,
21
+ 'name' => "#{raw_info['name']['first']} #{raw_info['name']['last']}",
22
+ 'image' => raw_info['avatar_url'],
23
+ 'first_name' => raw_info['name']['first'],
24
+ 'last_name' => raw_info['name']['last'],
25
+ }
26
+ end
27
+
28
+ # Provide access to the user's raw info
29
+ extra do
30
+ {'raw_info' => raw_info}
31
+ end
32
+
33
+ # Return all the raw information for the user
34
+ def raw_info
35
+ @raw_info ||= begin
36
+ access_token.options[:mode] = :query
37
+ access_token.options[:param_name] = 'oauth_token'
38
+ access_token.get('oauth/api/profile').parsed
39
+ end
40
+ end
41
+
42
+ # Return the user's first e-mail address
43
+ def email_address
44
+ raw_info['email_addresses'] && raw_info['email_addresses'].first
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Atech
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-atech/version"
2
+ require 'omniauth/strategies/atech'
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-atech
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Cooke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-02 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.1'
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.1'
46
+ description: OmniAuth strategy for aTech Media
47
+ email:
48
+ - adam@atechmedia.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/omniauth/strategies/atech.rb
54
+ - lib/omniauth-atech/version.rb
55
+ - lib/omniauth-atech.rb
56
+ homepage: https://github.com/atech/omniauth-atech
57
+ licenses: []
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 1.8.23
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: OmniAuth strategy for aTech Media
80
+ test_files: []