omniauth-hackcentral 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 11d0d03d6bdac969a81433e89a26275151e9affc
4
+ data.tar.gz: 344a2586ebcdef241f085a2e8292da4e5cc796be
5
+ SHA512:
6
+ metadata.gz: 0c610a33e2c77606ce2dc50bf6ae4d2fa95cbebb226832f9e536b954fca18a7356ade16a8344582e9f8969701890932fe455905c5452cb9fb71af8292d8e5c6d
7
+ data.tar.gz: ddf7d339e3d8fe460cb879c0b3a101c123bfd2654641de8488ed498ec337efef7bdca91d9cd73987ef46bf30a44ea5d96b4a720aedaf3772cf53615036b9fa70
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,38 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-hackcentral (0.0.0)
5
+ omniauth (~> 1.0)
6
+ omniauth-oauth2 (~> 1.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ hashie (3.3.2)
14
+ jwt (1.2.0)
15
+ multi_json (1.10.1)
16
+ multi_xml (0.5.5)
17
+ multipart-post (2.0.0)
18
+ oauth2 (1.0.0)
19
+ faraday (>= 0.8, < 0.10)
20
+ jwt (~> 1.0)
21
+ multi_json (~> 1.3)
22
+ multi_xml (~> 0.5)
23
+ rack (~> 1.2)
24
+ omniauth (1.2.2)
25
+ hashie (>= 1.2, < 4)
26
+ rack (~> 1.0)
27
+ omniauth-oauth2 (1.2.0)
28
+ faraday (>= 0.8, < 0.10)
29
+ multi_json (~> 1.3)
30
+ oauth2 (~> 1.0)
31
+ omniauth (~> 1.2)
32
+ rack (1.5.2)
33
+
34
+ PLATFORMS
35
+ ruby
36
+
37
+ DEPENDENCIES
38
+ omniauth-hackcentral!
@@ -0,0 +1,19 @@
1
+ # OmniAuth HackCentral
2
+
3
+ This is the offical OmniAuth strategy for authenticating to HackCentral. To use it, you'll need to sign up for an OAuth Application ID and Application Secret on the [HackCentral Applications Page](https://google.com).
4
+
5
+ ## Basic Usage
6
+
7
+ Add to Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-hackcentral'
11
+ ```
12
+
13
+ Now are you are ready to use!
14
+
15
+ ```ruby
16
+ use OmniAuth::Builder do
17
+ provider :hackcentral, ENV['HACKCENTRAL_APPLICATION_ID'], ENV['HACKCENTRAL_APP_SECRET']
18
+ end
19
+ ```
@@ -0,0 +1 @@
1
+ require "omniauth/strategies/hackcentral"
@@ -0,0 +1,55 @@
1
+ require "omniauth/strategies/oauth2"
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class HackCentral < OmniAuth::Strategies::OAuth2
6
+
7
+ option :name, "hackcentral"
8
+
9
+ option :client_options, {
10
+ authorize_url: "https://hackcentral.co/oauth/authorize",
11
+ token_url: "https://hackcentral.co/oauth/token",
12
+ site: "https://hackcentral.co"
13
+ }
14
+
15
+ def request_phase
16
+ super
17
+ end
18
+
19
+ def authorize_params
20
+ super.tap do |params|
21
+ %w[scope client_options].each do |v|
22
+ if request.params[v]
23
+ params[v.to_sym] = request.params[v]
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ def callback_url
30
+ options[:redirect_uri] || super
31
+ end
32
+
33
+ info do
34
+ {
35
+ name: raw_info["user"]["name"],
36
+ admin: raw_info["user"]["admin"],
37
+ mlh: raw_info["user"]["mlh"],
38
+ id: raw_info["user"]["id"]
39
+ }
40
+ end
41
+
42
+ uid { raw_info["user"]["id"].to_s }
43
+
44
+ extra do
45
+ { raw_info: raw_info }
46
+ end
47
+
48
+ def raw_info
49
+ @raw_info ||= access_token.get("/api/v1/user").parsed
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ OmniAuth.config.add_camelization "hackcentral", "HackCentral"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "omniauth-hackcentral"
5
+ gem.version = '0.5.0'
6
+ gem.authors = ["Jon Moss"]
7
+ gem.email = ["me@jonathanmoss.me"]
8
+ gem.homepage = "https://github.com/hackcentral/omniauth-hackcentral"
9
+ gem.summary = %q{OmniAuth strategy for HackCentral}
10
+ gem.description = %q{OmniAuth strategy for HackCentral, see https://github.com/hackcentral/omniauth-hackcentral for examples and more information.}
11
+ gem.license = 'MIT'
12
+
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ gem.require_paths = ["lib"]
16
+
17
+ gem.add_dependency 'omniauth', '~> 1.0'
18
+ gem.add_dependency 'omniauth-oauth2', '~> 1.1'
19
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-hackcentral
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon Moss
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ description: OmniAuth strategy for HackCentral, see https://github.com/hackcentral/omniauth-hackcentral
42
+ for examples and more information.
43
+ email:
44
+ - me@jonathanmoss.me
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - README.md
52
+ - lib/omniauth-hackcentral.rb
53
+ - lib/omniauth/strategies/hackcentral.rb
54
+ - omniauth-hackcentral.gemspec
55
+ homepage: https://github.com/hackcentral/omniauth-hackcentral
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.4.2
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: OmniAuth strategy for HackCentral
79
+ test_files: []