omniauth-backlog 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2178f4ee1a4d5b53aa0f8fe186bf22dd520fcbf1
4
+ data.tar.gz: 82edf3c50bbc7f21b6bca56411fffe74cea829a5
5
+ SHA512:
6
+ metadata.gz: 1713979f5d2efeb5e23905db44f1da658e86b3fd3c23a7e7a3747b8551666e60cc26fc4c9e9e59818e2d5f3b663ec05c16dcfc270daaf945c60c522059ffa169
7
+ data.tar.gz: fc255b3e34901ac18113a55511e201643ba3b5da67c8c87cef9eb1eb71de2f2563ce96d20db7e03cecfbe790e1c79c1502d3db150080a712cebb04abf9f305d1
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ ## Specific to RubyMotion:
2
+ .dat*
3
+ .repl_history
4
+ build/
5
+
6
+ ## Documentation cache and generated files:
7
+ /.yardoc/
8
+ /_yardoc/
9
+ /doc/
10
+ /rdoc/
11
+
12
+ ## Environment normalisation:
13
+ /.bundle/
14
+ /vendor/bundle
15
+ /lib/bundler/man/
16
+
17
+ # for a library or gem, you might want to ignore these files since the code is
18
+ # intended to run in multiple environments; otherwise, check them in:
19
+ Gemfile.lock
20
+ .ruby-version
21
+ # .ruby-gemset
22
+
23
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
24
+ .rvmrc
25
+
26
+
27
+ # rbenv
28
+ .ruby-version
29
+
30
+ # From bundler gem
31
+ /coverage/
32
+ /pkg/
33
+ /spec/reports/
34
+ /tmp/
35
+ *.gem
36
+
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ before_install: gem install bundler -v 1.10.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-backlog.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 attakei
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # Omniauth::Backlog
2
+
3
+ This is omniauth strategy for authenticating to your Backlog service used OAuth 2.0 style.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'omniauth-backlog'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install omniauth-backlog
21
+
22
+ ## Usage
23
+
24
+ Backlog is managed by space-id, used backlog url (ex. https://xxxx.backlog.jp).
25
+ Backlog's oauth endpoint uses space url. so it need to configure site in client_options.
26
+
27
+ ```ruby
28
+ use OmniAuth::Builder do
29
+ provider :backlog, ENV['CLIENT_ID'], ENV['CLIENT_SERCRET'],
30
+ :client_options => {
31
+ :site => 'https://yourspaceid.backlog.jp'
32
+ }
33
+ end
34
+ ```
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/attakei/omniauth-backlog.
39
+
40
+ 0. Fork it
41
+ 0. Create your feature branch (git checkout -b my-new-feature)
42
+ 0. Commit your changes (git commit -am 'Add some feature')
43
+ 0. Push to the branch (git push origin my-new-feature)
44
+ 0. Create new Pull Request
45
+
46
+ ## License
47
+
48
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
49
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/example/app.rb ADDED
@@ -0,0 +1,30 @@
1
+ begin
2
+ require 'sinatra'
3
+ require 'omniauth'
4
+ require 'omniauth-backlog'
5
+ require 'cgi'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'sinatra'
9
+ require 'omniauth'
10
+ require 'omniauth-backlog'
11
+ require 'cgi'
12
+ end
13
+
14
+ use Rack::Session::Cookie
15
+ use OmniAuth::Builder do
16
+ provider :backlog, ENV['CLIENT_ID'], ENV['CLIENT_SERCRET'], :client_options => { :site => ENV['CLIENT_ENDPOINT'] }
17
+ end
18
+
19
+
20
+ get '/' do
21
+ <<-HTML
22
+ <a href='/auth/backlog'>Sign in with Backlog</a>
23
+ HTML
24
+ end
25
+
26
+ get '/auth/:name/callback' do
27
+ auth = request.env['omniauth.auth']
28
+ # do whatever you want with the information!
29
+ CGI::escapeHTML(auth.to_s)
30
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth/backlog/version"
2
+ require "omniauth/strategies/backlog"
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Backlog
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require 'omniauth-oauth2'
2
+
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Backlog < OmniAuth::Strategies::OAuth2
7
+ option :name, 'backlog'
8
+
9
+ option :authorize_params, {
10
+ :response_type => 'code',
11
+ }
12
+
13
+ option :client_options, {
14
+ :authorize_url => '/OAuth2AccessRequest.action',
15
+ :token_url => '/api/v2/oauth2/token',
16
+ :proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil
17
+ }
18
+
19
+ uid{ raw_info['userId'] }
20
+
21
+ info do
22
+ {
23
+ :name => raw_info['name'],
24
+ :email => raw_info['mailAddress']
25
+ }
26
+ end
27
+
28
+ extra do
29
+ {
30
+ 'raw_info' => raw_info
31
+ }
32
+ end
33
+
34
+ def raw_info
35
+ @raw_info ||= access_token.get('/api/v2/users/myself').parsed
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/backlog/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-backlog"
8
+ spec.version = Omniauth::Backlog::VERSION
9
+ spec.authors = ["attakei"]
10
+ spec.email = ["attakei@gmail.com"]
11
+
12
+ spec.summary = %q{OmniAuth strategy for Backlog}
13
+ spec.description = %q{OmniAuth strategy for Backlog}
14
+ spec.homepage = "https://github.com/attakei/omniauth-backlog"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "omniauth", "~> 1.2"
25
+ spec.add_development_dependency "omniauth-oauth2", "~> 1.3"
26
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-backlog
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - attakei
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: omniauth
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-oauth2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ description: OmniAuth strategy for Backlog
70
+ email:
71
+ - attakei@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - example/app.rb
83
+ - lib/omniauth-backlog.rb
84
+ - lib/omniauth/backlog/version.rb
85
+ - lib/omniauth/strategies/backlog.rb
86
+ - omniauth-backlog.gemspec
87
+ homepage: https://github.com/attakei/omniauth-backlog
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.2.2
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: OmniAuth strategy for Backlog
111
+ test_files: []