doorkeeper_assertion_flow 0.0.1

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: c572fe86c187f49a09439abad9f605d86adc575b
4
+ data.tar.gz: 81fb250f19da0ee4494787958e0115aeca6b23e7
5
+ SHA512:
6
+ metadata.gz: 495de03c2280ae34d52f58c5a587101c11b9ede2d70791968a6412b6cddf79373353bb7750d1b8c38c06c876acf788860a4ce0aad2469edfe9d38dc5be648243
7
+ data.tar.gz: be3044495a03394fb2b752f2ed0034ab154006dd61df80ac267c93dd69dc3365658060627a0a22628374d2c4e710ac8fdc48b2edd316ea5399072fb8474b63df
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
@@ -0,0 +1 @@
1
+ 2.1.5
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rails', ENV['rails']
4
+ gem 'doorkeeper'
5
+
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Yuki Iwanaga
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ Doorkeeper Assertion Flow
2
+ =========================
3
+
4
+ Extension of https://tools.ietf.org/html/draft-ietf-oauth-assertions-18 for doorkeeper.
5
+
6
+
7
+ Installation
8
+ ------------
9
+
10
+ ### 1. Add the gem to your Gemfile
11
+
12
+ ```ruby
13
+ gem 'doorkeeper'
14
+ gem 'doorkeeper_assertion_flow'
15
+ ```
16
+
17
+ ### 2. Include assertion in the grant_flows
18
+
19
+ ```ruby
20
+ grant_flows %w[assertion authorization_code implicit password client_credentials]
21
+ ```
22
+
23
+ ### 3. Configure resource_owner_from_assertion
24
+
25
+ ```ruby
26
+ resource_owner_from_assertion do
27
+ p = params[:assertion] || {}
28
+
29
+ oauth = UserOauth.find_by p.slice(
30
+ :provider,
31
+ :uid,
32
+ )
33
+
34
+ if oauth
35
+ oauth.refresh_credentials p.slice(
36
+ :token,
37
+ :token_secret,
38
+ :token_expires_at,
39
+ )
40
+
41
+ oauth.user_account if oauth.save
42
+ end
43
+ end
44
+ ```
45
+
46
+
47
+ License
48
+ -------
49
+
50
+ This project is copyright by [Creasty](http://www.creasty.com), released under the MIT lisence.
51
+ See `LICENSE` file for details.
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,6 @@
1
+ en:
2
+ doorkeeper:
3
+ errors:
4
+ messages:
5
+ # configuration error message
6
+ assertion_flow_not_configured: 'Resource Owner Assertion flow failed due to Doorkeeper.configure.resource_owner_from_assertion being unconfigured.'
@@ -0,0 +1,23 @@
1
+ require_relative 'lib/doorkeeper/assertion_flow/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'doorkeeper_assertion_flow'
5
+ spec.version = Doorkeeper::AssertionFlow::VERSION
6
+ spec.authors = ['Yuki Iwanaga']
7
+ spec.email = ['yuki@creasty.com']
8
+ spec.summary = 'OAuth assertion flow patch for doorkeeper'
9
+ spec.description = 'OAuth assertion flow patch for doorkeeper'
10
+ spec.homepage = 'https://github.com/creasty/doorkeeper_assertion_flow'
11
+ spec.license = 'MIT'
12
+
13
+ spec.files = `git ls-files -z`.split("\x0")
14
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
15
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.require_paths = ['lib']
17
+
18
+ spec.add_dependency 'railties', '>= 4.0'
19
+ spec.add_dependency 'doorkeeper', '>= 2.0'
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake', '~> 10.3'
23
+ end
@@ -0,0 +1,7 @@
1
+ require_relative 'helpers/controller'
2
+ require_relative 'server'
3
+ require_relative 'config'
4
+ require_relative 'request/assertion'
5
+
6
+ require_relative 'assertion_flow/railtie'
7
+ require_relative 'assertion_flow/version'
@@ -0,0 +1,6 @@
1
+ module Doorkeeper
2
+ module AssertionFlow
3
+ class Railtie < ::Rails::Railtie
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ module Doorkeeper
2
+ module AssertionFlow
3
+
4
+ MAJOR = 0
5
+ MINOR = 0
6
+ REVISION = 1
7
+
8
+ VERSION = [MAJOR, MINOR, REVISION].compact.join '.'
9
+
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Doorkeeper
2
+ class Config
3
+
4
+ option :resource_owner_from_assertion,
5
+ default: ->(routes) {
6
+ warn I18n.t('doorkeeper.errors.messages.assertion_flow_not_configured')
7
+ nil
8
+ }
9
+
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Doorkeeper
2
+ module Helpers
3
+ module Controller
4
+
5
+ def resource_owner_from_assertion
6
+ instance_eval &Doorkeeper.configuration.resource_owner_from_assertion
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,30 @@
1
+ module Doorkeeper
2
+ module Request
3
+ class Assertion
4
+
5
+ def self.build(server)
6
+ new server.credentials, server.resource_owner_from_assertion, server
7
+ end
8
+
9
+ attr_accessor :credentials, :resource_owner, :server
10
+
11
+ def initialize(credentials, resource_owner, server)
12
+ @credentials, @resource_owner, @server = credentials, resource_owner, server
13
+ end
14
+
15
+ def request
16
+ @request ||= OAuth::PasswordAccessTokenRequest.new(
17
+ Doorkeeper.configuration,
18
+ credentials,
19
+ resource_owner,
20
+ server.parameters
21
+ )
22
+ end
23
+
24
+ def authorize
25
+ request.authorize
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module Doorkeeper
2
+ class Server
3
+
4
+ def resource_owner_from_assertion
5
+ context.send :resource_owner_from_assertion
6
+ end
7
+
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: doorkeeper_assertion_flow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yuki Iwanaga
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: doorkeeper
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.3'
69
+ description: OAuth assertion flow patch for doorkeeper
70
+ email:
71
+ - yuki@creasty.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".ruby-version"
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - config/locales/en.yml
83
+ - doorkeeper_assertion_flow.gemspec
84
+ - lib/doorkeeper/assertion_flow.rb
85
+ - lib/doorkeeper/assertion_flow/railtie.rb
86
+ - lib/doorkeeper/assertion_flow/version.rb
87
+ - lib/doorkeeper/config.rb
88
+ - lib/doorkeeper/helpers/controller.rb
89
+ - lib/doorkeeper/request/assertion.rb
90
+ - lib/doorkeeper/server.rb
91
+ homepage: https://github.com/creasty/doorkeeper_assertion_flow
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: OAuth assertion flow patch for doorkeeper
115
+ test_files: []