omniauth-jira 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +17 -0
- data/Rakefile +1 -1
- data/lib/omniauth-jira.rb +1 -1
- data/lib/omniauth-jira/version.rb +1 -1
- data/lib/omniauth/strategies/jira.rb +33 -15
- data/omniauth-jira.gemspec +4 -4
- metadata +29 -53
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d0706e8da6d626777fff0247608789913910a2ed
|
4
|
+
data.tar.gz: f98eb282b934cf3c81e0bc39a878d6aefdbbef94
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 343954036f9ae257cac5e77f4b8a3b1b2b13ea2e8876be3ca2cca4f391baf9dfeeb67a1b160f5057d445b9ab1e1677dd9e8209035ebf6272972885e5da1ad1e6
|
7
|
+
data.tar.gz: 1e5a7e52011f8d1f97eb21457d3707dcb0eb50fa91156d7e32bd935793203f50db41b268f716fbe133a723255da1becfb71c3e72cd8e540adbe3dc37f8bf710d
|
data/README.md
CHANGED
@@ -3,9 +3,26 @@ omniauth-jira
|
|
3
3
|
|
4
4
|
A simple [OmniAuth](https://github.com/intridea/omniauth) strategy for Atlassian JIRA.
|
5
5
|
|
6
|
+
Install
|
7
|
+
-------
|
8
|
+
|
9
|
+
gem 'omniauth-jira'
|
10
|
+
|
6
11
|
Usage
|
7
12
|
-----
|
8
13
|
|
14
|
+
Create a private key and certificate for use with your JIRA instance:
|
15
|
+
|
16
|
+
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -sha1 -keyout jira_private_key.pem -out jira_x509_certificate.pem
|
17
|
+
|
18
|
+
Extract the public key:
|
19
|
+
|
20
|
+
openssl x509 -pubkey -noout -in jira_x509_certificate.pem > jira_public_key.key
|
21
|
+
|
22
|
+
Configure OAuth on your JIRA instance. You'll need to specify a consumer key and the public key (e.g. `jira_public_key.key` above). More instructions here: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication
|
23
|
+
|
24
|
+
Then setup the OmniAuth provider in your code:
|
25
|
+
|
9
26
|
use OmniAuth::Builder do
|
10
27
|
provider :JIRA,
|
11
28
|
"<consumer_key>",
|
data/Rakefile
CHANGED
data/lib/omniauth-jira.rb
CHANGED
@@ -6,21 +6,28 @@ module OmniAuth
|
|
6
6
|
module Strategies
|
7
7
|
class JIRA < OmniAuth::Strategies::OAuth
|
8
8
|
|
9
|
-
option :name,
|
9
|
+
option :name, 'jira'
|
10
10
|
option :client_options, {
|
11
|
-
:signature_method
|
11
|
+
:signature_method => 'RSA-SHA1',
|
12
12
|
:request_token_path => '/plugins/servlet/oauth/request-token',
|
13
|
-
:authorize_path
|
14
|
-
:access_token_path
|
15
|
-
:site
|
13
|
+
:authorize_path => '/plugins/servlet/oauth/authorize',
|
14
|
+
:access_token_path => '/plugins/servlet/oauth/access-token',
|
15
|
+
:site => nil
|
16
16
|
}
|
17
17
|
|
18
|
-
uid{
|
18
|
+
uid{ user_info['key'] }
|
19
19
|
|
20
20
|
info do
|
21
21
|
{
|
22
|
-
:
|
23
|
-
:
|
22
|
+
nickname: user_info['name'],
|
23
|
+
email: user_info['emailAddress'],
|
24
|
+
name: user_info['displayName'],
|
25
|
+
time_zone: user_info['timeZone'],
|
26
|
+
locale: user_info['locale'],
|
27
|
+
image: user_info['avatarUrls'] && user_info['avatarUrls']['48x48'],
|
28
|
+
urls: {
|
29
|
+
self: session_info['self']
|
30
|
+
}
|
24
31
|
}
|
25
32
|
end
|
26
33
|
|
@@ -30,16 +37,27 @@ module OmniAuth
|
|
30
37
|
}
|
31
38
|
end
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
40
|
+
credentials do
|
41
|
+
if access_token.params.has_key?(:oauth_expires_in)
|
42
|
+
{
|
43
|
+
"expires" => true,
|
44
|
+
"expires_at" => (Time.now + (access_token.params[:oauth_expires_in].to_i / 1000)).to_i
|
45
|
+
}
|
46
|
+
end
|
39
47
|
end
|
40
48
|
|
41
49
|
def raw_info
|
42
|
-
@raw_info ||=
|
50
|
+
@raw_info ||= {session_info: session_info, user_info: user_info}
|
51
|
+
end
|
52
|
+
|
53
|
+
def session_info
|
54
|
+
@session_info ||= MultiJson.decode(access_token.get('/rest/auth/1/session').body)
|
55
|
+
rescue ::Errno::ETIMEDOUT
|
56
|
+
raise ::Timeout::Error
|
57
|
+
end
|
58
|
+
|
59
|
+
def user_info
|
60
|
+
@user_info ||= MultiJson.decode(access_token.get(session_info['self']).body)
|
43
61
|
rescue ::Errno::ETIMEDOUT
|
44
62
|
raise ::Timeout::Error
|
45
63
|
end
|
data/omniauth-jira.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
require File.expand_path('../lib/omniauth-jira/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Rich Manalang"]
|
6
|
-
gem.email = ["rmanalang@atlassian.com"]
|
5
|
+
gem.authors = ["Rich Manalang", "Joel Van Horn"]
|
6
|
+
gem.email = ["rmanalang@atlassian.com", "joel@joelvanhorn.com"]
|
7
7
|
gem.description = %q{A JIRA OAuth 1.0a strategy for OmniAuth.}
|
8
8
|
gem.summary = %q{A JIRA OAuth 1.0a strategy for OmniAuth.}
|
9
9
|
gem.homepage = "https://github.com/manalang/omniauth-jira"
|
10
10
|
|
11
|
-
gem.add_dependency
|
11
|
+
gem.add_dependency 'multi_json', '~> 1.3'
|
12
12
|
gem.add_runtime_dependency 'omniauth', '~> 1.0'
|
13
|
-
gem.add_runtime_dependency
|
13
|
+
gem.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
|
14
14
|
gem.add_runtime_dependency 'oauth'
|
15
15
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
16
16
|
gem.add_development_dependency 'webmock'
|
metadata
CHANGED
@@ -1,169 +1,152 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Rich Manalang
|
8
|
+
- Joel Van Horn
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- - ~>
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '1.3'
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- - ~>
|
25
|
+
- - "~>"
|
28
26
|
- !ruby/object:Gem::Version
|
29
27
|
version: '1.3'
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: omniauth
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- - ~>
|
32
|
+
- - "~>"
|
36
33
|
- !ruby/object:Gem::Version
|
37
34
|
version: '1.0'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- - ~>
|
39
|
+
- - "~>"
|
44
40
|
- !ruby/object:Gem::Version
|
45
41
|
version: '1.0'
|
46
42
|
- !ruby/object:Gem::Dependency
|
47
43
|
name: omniauth-oauth
|
48
44
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- - ~>
|
46
|
+
- - "~>"
|
52
47
|
- !ruby/object:Gem::Version
|
53
48
|
version: '1.0'
|
54
49
|
type: :runtime
|
55
50
|
prerelease: false
|
56
51
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
|
-
- - ~>
|
53
|
+
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
55
|
version: '1.0'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: oauth
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
59
|
requirements:
|
67
|
-
- -
|
60
|
+
- - ">="
|
68
61
|
- !ruby/object:Gem::Version
|
69
62
|
version: '0'
|
70
63
|
type: :runtime
|
71
64
|
prerelease: false
|
72
65
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
66
|
requirements:
|
75
|
-
- -
|
67
|
+
- - ">="
|
76
68
|
- !ruby/object:Gem::Version
|
77
69
|
version: '0'
|
78
70
|
- !ruby/object:Gem::Dependency
|
79
71
|
name: rspec
|
80
72
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
73
|
requirements:
|
83
|
-
- - ~>
|
74
|
+
- - "~>"
|
84
75
|
- !ruby/object:Gem::Version
|
85
76
|
version: '2.7'
|
86
77
|
type: :development
|
87
78
|
prerelease: false
|
88
79
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
80
|
requirements:
|
91
|
-
- - ~>
|
81
|
+
- - "~>"
|
92
82
|
- !ruby/object:Gem::Version
|
93
83
|
version: '2.7'
|
94
84
|
- !ruby/object:Gem::Dependency
|
95
85
|
name: webmock
|
96
86
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
87
|
requirements:
|
99
|
-
- -
|
88
|
+
- - ">="
|
100
89
|
- !ruby/object:Gem::Version
|
101
90
|
version: '0'
|
102
91
|
type: :development
|
103
92
|
prerelease: false
|
104
93
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
94
|
requirements:
|
107
|
-
- -
|
95
|
+
- - ">="
|
108
96
|
- !ruby/object:Gem::Version
|
109
97
|
version: '0'
|
110
98
|
- !ruby/object:Gem::Dependency
|
111
99
|
name: simplecov
|
112
100
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
101
|
requirements:
|
115
|
-
- -
|
102
|
+
- - ">="
|
116
103
|
- !ruby/object:Gem::Version
|
117
104
|
version: '0'
|
118
105
|
type: :development
|
119
106
|
prerelease: false
|
120
107
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
108
|
requirements:
|
123
|
-
- -
|
109
|
+
- - ">="
|
124
110
|
- !ruby/object:Gem::Version
|
125
111
|
version: '0'
|
126
112
|
- !ruby/object:Gem::Dependency
|
127
113
|
name: rack-test
|
128
114
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
115
|
requirements:
|
131
|
-
- -
|
116
|
+
- - ">="
|
132
117
|
- !ruby/object:Gem::Version
|
133
118
|
version: '0'
|
134
119
|
type: :development
|
135
120
|
prerelease: false
|
136
121
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
122
|
requirements:
|
139
|
-
- -
|
123
|
+
- - ">="
|
140
124
|
- !ruby/object:Gem::Version
|
141
125
|
version: '0'
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
127
|
name: rake
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
129
|
requirements:
|
147
|
-
- -
|
130
|
+
- - ">="
|
148
131
|
- !ruby/object:Gem::Version
|
149
132
|
version: '0'
|
150
133
|
type: :development
|
151
134
|
prerelease: false
|
152
135
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
136
|
requirements:
|
155
|
-
- -
|
137
|
+
- - ">="
|
156
138
|
- !ruby/object:Gem::Version
|
157
139
|
version: '0'
|
158
140
|
description: A JIRA OAuth 1.0a strategy for OmniAuth.
|
159
141
|
email:
|
160
142
|
- rmanalang@atlassian.com
|
143
|
+
- joel@joelvanhorn.com
|
161
144
|
executables: []
|
162
145
|
extensions: []
|
163
146
|
extra_rdoc_files: []
|
164
147
|
files:
|
165
|
-
- .gitignore
|
166
|
-
- .rspec
|
148
|
+
- ".gitignore"
|
149
|
+
- ".rspec"
|
167
150
|
- Gemfile
|
168
151
|
- Guardfile
|
169
152
|
- README.md
|
@@ -176,33 +159,26 @@ files:
|
|
176
159
|
- spec/spec_helper.rb
|
177
160
|
homepage: https://github.com/manalang/omniauth-jira
|
178
161
|
licenses: []
|
162
|
+
metadata: {}
|
179
163
|
post_install_message:
|
180
164
|
rdoc_options: []
|
181
165
|
require_paths:
|
182
166
|
- lib
|
183
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
-
none: false
|
185
168
|
requirements:
|
186
|
-
- -
|
169
|
+
- - ">="
|
187
170
|
- !ruby/object:Gem::Version
|
188
171
|
version: '0'
|
189
|
-
segments:
|
190
|
-
- 0
|
191
|
-
hash: 4141054069828415443
|
192
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
173
|
requirements:
|
195
|
-
- -
|
174
|
+
- - ">="
|
196
175
|
- !ruby/object:Gem::Version
|
197
176
|
version: '0'
|
198
|
-
segments:
|
199
|
-
- 0
|
200
|
-
hash: 4141054069828415443
|
201
177
|
requirements: []
|
202
178
|
rubyforge_project:
|
203
|
-
rubygems_version:
|
179
|
+
rubygems_version: 2.0.14
|
204
180
|
signing_key:
|
205
|
-
specification_version:
|
181
|
+
specification_version: 4
|
206
182
|
summary: A JIRA OAuth 1.0a strategy for OmniAuth.
|
207
183
|
test_files:
|
208
184
|
- spec/omniauth/strategies/jira_spec.rb
|