omniauth-dash 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +7 -0
- data/README.md +40 -0
- data/Rakefile +12 -0
- data/examples/config.ru +36 -0
- data/lib/omniauth/strategies/dash.rb +17 -0
- data/lib/omniauth-dash/version.rb +5 -0
- data/lib/omniauth-dash.rb +2 -0
- data/omniauth-dash.gemspec +24 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10d4bc1afe7edcc0e43ef6ff32dc50b47355adb9
|
4
|
+
data.tar.gz: db1a8b36004c96697f74f73067bea8d19de020ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a6186fccebfe0c223fc3006dbf53f654027472079f49d56cbb70ea1d20b315cbeadf8e89074a202b743a66605e8a677da8a2ba87203b3a04a0eb7c0fa01017d
|
7
|
+
data.tar.gz: f1f4f921b3aecb6dbe90e07106cabefd8a610a21e4915cd755d03b891e7a2ba2028c384d51f9d3fc8635dc5f34ab1c742ccbbdd9f8ecb0f7955cf6bfec2b96cc
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# OmniAuth Dash Strategy
|
2
|
+
|
3
|
+
Strategy to authenticate with Nest via OAuth2 in OmniAuth
|
4
|
+
|
5
|
+
Get your API key at: https://dash.by/signup-form.html
|
6
|
+
|
7
|
+
For more details, read the Dash authorization documentation at https://dash.by/resources.html
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add to your `Gemfile`:
|
12
|
+
|
13
|
+
````ruby
|
14
|
+
gem 'omniauth-dash'
|
15
|
+
````
|
16
|
+
|
17
|
+
then `bundle install`.
|
18
|
+
|
19
|
+
|
20
|
+
## Example
|
21
|
+
|
22
|
+
1. Clone this repo and `cd` into it
|
23
|
+
2. `bundle install` (Required [bundler gem](http://bundler.io/))
|
24
|
+
3. `cd examples`
|
25
|
+
4. Set ENV variables for NEST_ID and NEST_SECRET
|
26
|
+
5. Set redirect URI to http://localhost:9292/auth/nest/callback
|
27
|
+
6. `bundle exec rackup`
|
28
|
+
7. Open http://localhost:9292 in your browser and follow links
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
In Rails add the following to `config/initializers/omniauth.rb`
|
33
|
+
|
34
|
+
````ruby
|
35
|
+
use OmniAuth::Builder do
|
36
|
+
provider :nest, ENV['DASH_ID'], ENV['DASH_SECRET']
|
37
|
+
end
|
38
|
+
````
|
39
|
+
|
40
|
+
This will enable the route `/auth/dash` which will start the OAuth2 flow. See `examples/config.ru` for a fully working example.
|
data/Rakefile
ADDED
data/examples/config.ru
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Make sure to setup the ENV variables DASH_ID and DASH_SECRET
|
2
|
+
# Run with `bundle exec rackup`
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler'
|
6
|
+
require 'sinatra'
|
7
|
+
require 'omniauth-dash'
|
8
|
+
|
9
|
+
class DashApp < Sinatra::Base
|
10
|
+
|
11
|
+
get '/' do
|
12
|
+
<<-HTML
|
13
|
+
<p><a href="/auth/dash">Sign into Dash</a></p>
|
14
|
+
HTML
|
15
|
+
end
|
16
|
+
|
17
|
+
get '/auth/:provider/callback' do |provider|
|
18
|
+
content_type 'text/plain'
|
19
|
+
%{ #{provider} token: #{request.env['omniauth.auth'].to_hash['credentials'].inspect}
|
20
|
+
} rescue 'No data returned'
|
21
|
+
end
|
22
|
+
|
23
|
+
get '/auth/failure' do
|
24
|
+
content_type 'text/plain'
|
25
|
+
%{ Error: #{request.env['omniauth.auth'].to_hash.inspect}
|
26
|
+
} rescue 'No data returned'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
use Rack::Session::Cookie, :secret => 'abc'
|
31
|
+
|
32
|
+
use OmniAuth::Builder do
|
33
|
+
provider :dash, 'MWM3ZTg1N2EtZDA4Yy00N2E4LWEzODgtZmI4ZjI3YWFlOGUw', 'MmJiMGQ5YTEtYWY5NS00NjFkLWEwOTctOWFjNTM4ZGE3ZDU2t'
|
34
|
+
end
|
35
|
+
|
36
|
+
run DashApp.new
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Dash < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, 'dash'
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
:site => 'https://dash.by/',
|
11
|
+
:authorize_url => 'https://dash.by/api/auth/authorize',
|
12
|
+
:token_url => 'https://dash.by/api/auth/token'
|
13
|
+
}
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-dash/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Aren Patel"]
|
6
|
+
gem.email = ["aren55555@users.noreply.github.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for Dash.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for Dash.}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "omniauth-dash"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = OmniAuth::Dash::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
19
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.0'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
gem.add_development_dependency 'simplecov'
|
23
|
+
gem.add_development_dependency 'webmock'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-dash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aren Patel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-18 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.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: OmniAuth strategy for Dash.
|
98
|
+
email:
|
99
|
+
- aren55555@users.noreply.github.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- Gemfile
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- examples/config.ru
|
110
|
+
- lib/omniauth-dash.rb
|
111
|
+
- lib/omniauth-dash/version.rb
|
112
|
+
- lib/omniauth/strategies/dash.rb
|
113
|
+
- omniauth-dash.gemspec
|
114
|
+
homepage: ''
|
115
|
+
licenses: []
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.2.2
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: OmniAuth strategy for Dash.
|
137
|
+
test_files: []
|