omniauth-jama-connect 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: c35b1bf46713f46cad52ebab12a1827ad84e401d
4
+ data.tar.gz: 203ad7e1a64c1f99451b722fd762aa7a8c3109da
5
+ SHA512:
6
+ metadata.gz: 21c38116d5d95c5b8e39bde2b45af46762e9886d65273964d05ee2a96e66823e4bcf8a68f8f6ba22d364debee5cb999d0f0f8a20e303a332aef14bf1bbd1c91f
7
+ data.tar.gz: f9be62c268c667d84eb21f53a47109fe060d463ce16b2cdd184f8283a79d5240b600706066b3c0dbac1aa22f0348afe46e16de5678658a058a1821d1354cf992
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.4
7
+ before_install: gem install bundler -v 2.0.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-jama-connect.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Peter Mooney
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 Jama Connect
2
+
3
+ Jama Connect OAuth2 Strategy for OmniAuth
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-jama-connect'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-jama-connect
20
+
21
+ ## Usage
22
+
23
+ Here's a quick example for adding the middleware to a Rails application (in `config/initializers/omniauth.rb`):
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ provider :jama_connect, ENV["JAMA_CONNECT_CLIENT_ID"], ENV["JAMA_CONNECT_CLIENT_SECRET"], host: "https://YOUR_COMPANY.jamaland.com"
28
+ end
29
+ ```
30
+
31
+ This will add an endpoint to your application at `/auth/jama_connect` that will being the OAuth flow.
32
+
33
+ In the callback controller, you can find the `token` and `refresh_token` on the Hash: `request.env['omniauth.auth']['credentials']`. Store these values for subsequent requests to the Jama Connect API.
34
+
35
+ **Note:** The `JAMA_CONNECT_CLIENT_ID` and `JAMA_CONNECT_CLIENT_SECRET` values mentioned in the above example are NOT the same values that you would receive through the "Set API Credentials" Web interface. Those credentials do not have the proper authorization to administer authorization codes or refresh tokens against the Jama Connect OAuth system. Instead, you must contact Jama Software to setup an OAuth client, and they will provide you these values.
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/JamaSoftware/omniauth-jama-connect.
46
+
47
+ ## License
48
+
49
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/jama/connect"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ require 'omniauth/jama-connect'
@@ -0,0 +1,2 @@
1
+ require 'omniauth/strategies/jama-connect'
2
+ require 'omniauth/jama-connect/version'
@@ -0,0 +1,7 @@
1
+ module OmniAuth
2
+ module Jama
3
+ module Connect
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,54 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class JamaConnect < OmniAuth::Strategies::OAuth2
6
+ option :name, 'jama_connect'
7
+ option :scope, 'token_information'
8
+ option :origin_param, 'redirect_uri'
9
+ option :client_options, {
10
+ auth_scheme: :basic_auth,
11
+ }
12
+
13
+ # Connect is multi-tenant, so the host needs to be set by the implementer.
14
+ option :host, nil
15
+
16
+ uid do
17
+ request.params['code']
18
+ end
19
+
20
+ def request_phase
21
+ raise NoHostError if options[:host].nil?
22
+
23
+ options.client_options[:authorize_url] = options[:host] += '/authorize.req'
24
+ super
25
+ end
26
+
27
+ def callback_phase
28
+ raise NoHostError if options[:host].nil?
29
+
30
+ options.client_options[:token_url] = options[:host] += '/rest/oauth/token'
31
+ super
32
+ end
33
+
34
+ def query_string
35
+ # Need to override query_string here or else Connect complains about
36
+ # a mismatch URI. The query string is non-determinate, and omniauth
37
+ # adds it for the third leg of the journey
38
+ ''
39
+ end
40
+ end
41
+
42
+ class NoHostError < StandardError
43
+ def initialize
44
+ super(
45
+ 'No host option set. Make sure you add the host option when you'\
46
+ ' initialize the strategy, or use a setup Proc for dynamically setting'\
47
+ ' the host.'
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ OmniAuth.config.add_camelization 'jama_connect', 'JamaConnect'
@@ -0,0 +1,28 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "omniauth/jama-connect/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "omniauth-jama-connect"
7
+ spec.version = OmniAuth::Jama::Connect::VERSION
8
+ spec.authors = ["Peter Mooney"]
9
+ spec.email = ["pmooney@jamasoftware.com"]
10
+
11
+ spec.summary = "Omniauth Strategy for Jama Connect"
12
+ spec.homepage = "https://github.com/jamasoftware/omniauth-jama-connect"
13
+ spec.license = "MIT"
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency 'omniauth-oauth2', '>= 1.2'
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "minitest", "~> 5.0"
28
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-jama-connect
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Peter Mooney
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
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: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description:
70
+ email:
71
+ - pmooney@jamasoftware.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
+ - bin/console
83
+ - bin/setup
84
+ - lib/omniauth-jama-connect.rb
85
+ - lib/omniauth/jama-connect.rb
86
+ - lib/omniauth/jama-connect/version.rb
87
+ - lib/omniauth/strategies/jama-connect.rb
88
+ - omniauth-jama-connect.gemspec
89
+ homepage: https://github.com/jamasoftware/omniauth-jama-connect
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.5.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Omniauth Strategy for Jama Connect
113
+ test_files: []