omniauth-draft 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +14 -0
- data/lib/omniauth-draft.rb +1 -0
- data/lib/omniauth/strategies/draft.rb +45 -0
- data/omniauth-draft.gemspec +15 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 620122da585dfba0865562a563dd09247d2dbdf7
|
4
|
+
data.tar.gz: 7d57a89a2d0d8677a74a7700f86bcde925c8f4f3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4fc3aa6040617ddafddb15cb2d4974cf8c3725c67d21b233a8e15d6a5792358ac23063eccc696c323bacdd455fb7f48a718ead3e6ae37da344a10acd574cab02
|
7
|
+
data.tar.gz: f237b80f5c5614adf06da6b2322adc26ad0654d71c1df1faa160e9be7cfcd6a5c7f0fd88d29a44d5a4f5a8e1bc14e77b9bdfea78808ed4ee3ec7aed63f97ca00
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Beeminder
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# OmniAuth Draft
|
2
|
+
An OmniAuth strategy for authenticating to [Draft](https://draftin.com/). To use it you'll need an OAuth2 Application ID and Secret from Draft. More info (and their api docs) [are here](https://draftin.com/documents/54643?token=Qq1PuS1fL8Zr9yWDSefoeUMQCfp3yr1s6g_7ShYKops).
|
3
|
+
|
4
|
+
## Basic Usage
|
5
|
+
|
6
|
+
```
|
7
|
+
use OmniAuth::Builder do
|
8
|
+
provider :draft, ENV['DRAFT_APP_ID'], ENV['DRAFT_SECRET']
|
9
|
+
end
|
10
|
+
```
|
11
|
+
|
12
|
+
## Copyright
|
13
|
+
|
14
|
+
Copyright (c) 2013 Beeminder inc. See LICENSE.txt for further details.
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/strategies/draft'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class Draft < OmniAuth::Strategies::OAuth2
|
8
|
+
|
9
|
+
# Give your strategy a name.
|
10
|
+
option :name, "draft"
|
11
|
+
|
12
|
+
# This is where you pass the options you would pass when
|
13
|
+
# initializing your consumer from the OAuth gem.
|
14
|
+
option :client_options, {
|
15
|
+
:site => "https://draftin.com",
|
16
|
+
:authorize_path => "/oauth/authorize"
|
17
|
+
}
|
18
|
+
|
19
|
+
# These are called after authentication has succeeded. If
|
20
|
+
# possible, you should try to set the UID without making
|
21
|
+
# additional calls (if the user id is returned with the token
|
22
|
+
# or as a URI parameter). This may not be possible with all
|
23
|
+
# providers.
|
24
|
+
uid{ raw_info['id'] }
|
25
|
+
|
26
|
+
info do
|
27
|
+
{
|
28
|
+
:email => raw_info['email']
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Bugfix for regression introduced after omniauth-oauth2 v1.3.1
|
33
|
+
# details: https://github.com/intridea/omniauth-oauth2/issues/81
|
34
|
+
def callback_url
|
35
|
+
options[:callback_url] || full_host + script_name + callback_path
|
36
|
+
end
|
37
|
+
|
38
|
+
def raw_info
|
39
|
+
@raw_info ||= access_token.get('/api/v1/people/me.json').parsed
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |gem|
|
2
|
+
gem.name = 'omniauth-draft'
|
3
|
+
gem.version = '0.3.3'
|
4
|
+
gem.date = Date.today.to_s
|
5
|
+
gem.license = 'MIT'
|
6
|
+
gem.summary = "OmniAuth strategy for Draft"
|
7
|
+
gem.description = "OmniAuth strategy for Draft"
|
8
|
+
|
9
|
+
gem.authors = ['Bethany Soule']
|
10
|
+
gem.email = 'bsoule@beeminder.com'
|
11
|
+
gem.homepage = 'https://github.com/bsoule/omniauth-draft'
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.require_path = 'lib'
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-draft
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bethany Soule
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: OmniAuth strategy for Draft
|
14
|
+
email: bsoule@beeminder.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- Gemfile
|
20
|
+
- LICENSE.txt
|
21
|
+
- README.md
|
22
|
+
- lib/omniauth-draft.rb
|
23
|
+
- lib/omniauth/strategies/draft.rb
|
24
|
+
- omniauth-draft.gemspec
|
25
|
+
homepage: https://github.com/bsoule/omniauth-draft
|
26
|
+
licenses:
|
27
|
+
- MIT
|
28
|
+
metadata: {}
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 2.4.5
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: OmniAuth strategy for Draft
|
49
|
+
test_files: []
|