omniauth-redmine 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: e3522fcfb6c78ba3b7d57c3f913d0198bf628efb
4
+ data.tar.gz: 00ec4a92bc5376102b3770c2d2c5153f441a00fa
5
+ SHA512:
6
+ metadata.gz: 9a4d2fb534320f23e74b34e7b5e3a3c463e959170c063ea5a41525e67045495b6b8b232f597a9b5f5ee8ee7b0a3f2cf30ca4ad7cb3cdb83c248f6f0890e6a4df
7
+ data.tar.gz: 77b34dce26e39dd78efd835d28a0a671794eca516bf93bacc1b5f722e8c38c2df6e5dca20d8d47cbb8908dbb8663df54fb4961973b8975a3e4fef29258bb47f8
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-redmine.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 suer
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,48 @@
1
+ # Omniauth::Redmine
2
+
3
+ Strategy to authenticate with Redmine via OAuth in Redmine.
4
+ (https://github.com/suer/redmine_oauth_provider)
5
+
6
+ ## Installation
7
+
8
+ Build gem package:
9
+
10
+ $ rake build
11
+
12
+ Unpack gem package in your application's root directory:
13
+
14
+ $ gem unpack some/directory/pkg/omniauth-redmine-X.Y.Z.gem
15
+
16
+ Add this line to your application's Gemfile:
17
+
18
+ gem 'omniauth-redmine', :path => 'omniauth-redmine-X.Y.Z'
19
+
20
+ And then execute:
21
+
22
+ $ bundle install --path .bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install pkg/omniauth-redmine-X.Y.Z.gem
27
+
28
+ ## Usage
29
+
30
+ Here's an example, adding the middleware to a Rails app in config/initializers/omniauth.rb:
31
+
32
+ Rails.application.config.middleware.use OmniAuth::Builder do
33
+ provider :redmine, "consumer key", "consumer secret", :redmine_base_url => "http://redmine.base.url/"
34
+ end
35
+
36
+ If you use devise, add this lines in config/initializers/devise.rb
37
+
38
+ config.omniauth :redmine, "consumer key", "consumer secret", :redmine_base_url => "http://redmine.base.url/"
39
+
40
+ ## License
41
+ The MIT License (MIT)
42
+ Copyright (c) 2013 suer
43
+
44
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ require 'omniauth/redmine'
@@ -0,0 +1 @@
1
+ require 'omniauth/strategies/redmine'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Redmine
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,37 @@
1
+ require 'omniauth/strategies/oauth'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Redmine < OmniAuth::Strategies::OAuth
6
+
7
+ def consumer
8
+ options.client_options = {
9
+ :authorize_url => "#{redmine_base_url}oauth/authorize",
10
+ :request_token_url => "#{redmine_base_url}oauth/request_token",
11
+ :access_token_url => "#{redmine_base_url}oauth/access_token"
12
+ }
13
+ super
14
+ end
15
+
16
+ uid { raw_info['user']['id'] }
17
+
18
+ info do
19
+ {
20
+ 'nickname' => raw_info['user']['mail'],
21
+ 'email' => raw_info['user']['mail'],
22
+ 'name' => "#{raw_info['user']['lastname']} #{raw_info['user']['firstname']}"
23
+ }
24
+ end
25
+
26
+ def raw_info
27
+ @raw_info ||= MultiJson.decode(access_token.get("#{redmine_base_url}oauth/user_info.json").body)
28
+ end
29
+
30
+ private
31
+ def redmine_base_url
32
+ options.redmine_base_url << '/' unless options.redmine_base_url.end_with?('/')
33
+ options.redmine_base_url
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/redmine/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.add_dependency 'omniauth', '~> 1.1'
8
+
9
+ spec.name = "omniauth-redmine"
10
+ spec.version = Omniauth::Redmine::VERSION
11
+ spec.authors = ["suer"]
12
+ spec.email = ["suetsugu.r@gmail.com"]
13
+ spec.description = %q{An OmniAuth strategy for Redmine}
14
+ spec.summary = %q{An OmniAuth strategy for Redmine}
15
+ spec.homepage = ""
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency 'omniauth-oauth'
24
+ spec.add_runtime_dependency 'multi_json'
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rake"
28
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-redmine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - suer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-11 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.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
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
+ - !ruby/object:Gem::Dependency
70
+ name: rake
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
+ description: An OmniAuth strategy for Redmine
84
+ email:
85
+ - suetsugu.r@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - lib/omniauth-redmine.rb
96
+ - lib/omniauth/redmine.rb
97
+ - lib/omniauth/redmine/version.rb
98
+ - lib/omniauth/strategies/redmine.rb
99
+ - omniauth-redmine.gemspec
100
+ homepage: ''
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.0.3
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: An OmniAuth strategy for Redmine
124
+ test_files: []