omniauth-concur-oauth2 0.0.1
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 +7 -0
- data/.document +11 -0
- data/.gitignore +17 -0
- data/Gemfile +8 -0
- data/LICENSE +21 -0
- data/README.md +37 -0
- data/Rakefile +2 -0
- data/lib/omniauth-concur-oauth2.rb +3 -0
- data/lib/omniauth-concur-oauth2/version.rb +5 -0
- data/lib/omniauth/strategies/concur.rb +21 -0
- data/omniauth-concur-oauth2.gemspec +23 -0
- data/spec/omniauth-concur-oauth2_spec.rb +33 -0
- data/spec/spec_helper.rb +10 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 918c40c2d8125403afefad3b23c1b8eff9693991
|
4
|
+
data.tar.gz: 5e1055ec4aded6028b43f5b6eba61072ab7c9e19
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 282fe18bb555d3159298b37a3227c8cfe15133939d67ac6050b740ad66fa75d0c9e37755dd03b0c1fa08787fd6537ae60c0cc4a7576e273660d36800746fe069
|
7
|
+
data.tar.gz: 7083347fc91f71e602db390d9a07a43445dfc365a611f5f990fbb1b4f0df3f08badbc831f193b2334b1b505d0464f66cdc1bd7e66a3c8f21231f4be1f248dbca
|
data/.document
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# .document is used by rdoc and yard to know how to generate documentation
|
2
|
+
# for example, it can be used to control how rdoc gets built when you do `gem install foo`
|
3
|
+
|
4
|
+
README.rdoc
|
5
|
+
lib/**/*.rb
|
6
|
+
bin/*
|
7
|
+
|
8
|
+
# Files below this - are treated as 'extra files', and aren't parsed for ruby code
|
9
|
+
-
|
10
|
+
features/**/*.feature
|
11
|
+
LICENSE
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Adam Scott
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# OmniAuth Concur Strategy
|
2
|
+
|
3
|
+
This gem is an OmniAuth 2.0+ Strategy for the [Concur API](https://developer.concur.com/api-documentation/oauth-20-0).
|
4
|
+
|
5
|
+
*This gem has only been tested with Concur's [Web Flow](https://developer.concur.com/api-documentation/oauth-20-0/web-flow). If you are using one of their other flow's, feel free to submit a pull request with any changes that are needed.*
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Add the strategy to your `Gemfile`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-concur-oauth2'
|
13
|
+
```
|
14
|
+
|
15
|
+
Then integrate the strategy into your middleware:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
use OmniAuth::Builder do
|
19
|
+
provider :concur, 'consumer_key', 'consumer_secret', { scope: "LIST_OFF_APIS", callback_path: "/auth/concur/callback" }
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
In Rails, create a new file under config/initializers called omniauth.rb to plug the strategy into your middleware stack.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
27
|
+
provider :Concur, 'consumer_key', 'consumer_secret', { scope: "LIST_OFF_APIS", callback_path: "/auth/concur/callback" }
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
You must have a consumer key and secret, which are created when you register your Partner Application.
|
32
|
+
|
33
|
+
For additional information about OmniAuth, visit [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
See [License](https://github.com/ascot21/omniauth-concur-oauth2/blob/master/LICENSE) for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
OAuth2::Response.register_parser(:custom_xml, ['text/xml', 'application/rss+xml', 'application/rdf+xml', 'application/atom+xml']) do |body|
|
4
|
+
MultiXml.parse(body).deep_transform_keys{ |key| key.to_s.downcase } rescue body
|
5
|
+
end
|
6
|
+
|
7
|
+
module OmniAuth
|
8
|
+
module Strategies
|
9
|
+
class Concur < OmniAuth::Strategies::OAuth2
|
10
|
+
option :name, 'concur'
|
11
|
+
option :client_options, {
|
12
|
+
:site => 'https://www.concursolutions.com',
|
13
|
+
:authorize_url => '/net2/oauth2/Login.aspx',
|
14
|
+
:token_url => '/net2/oauth2/GetAccessToken.ashx',
|
15
|
+
:token_method => :get,
|
16
|
+
:access_url => '/net2/oauth2/Access.ashx',
|
17
|
+
}
|
18
|
+
option :token_params, { :parse => :custom_xml }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'omniauth-concur-oauth2/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'omniauth-concur-oauth2'
|
6
|
+
s.version = OmniAuth::Concur::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.date = '2014-08-07'
|
9
|
+
s.authors = ['Adam Scott']
|
10
|
+
s.email = 'ascot21@gmail.com'
|
11
|
+
s.homepage = 'http://github.com/ascot21/omniauth-concur-oauth2'
|
12
|
+
s.summary = %Q{OmniAuth strategy for authenticating with Concur's OAuth2 API}
|
13
|
+
s.description = s.summary
|
14
|
+
s.license = "The MIT License (MIT)"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.1'
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Concur do
|
4
|
+
let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
|
5
|
+
|
6
|
+
subject do
|
7
|
+
args = ['appid', 'secret', @options || {}].compact
|
8
|
+
OmniAuth::Strategies::Concur.new(*args).tap do |strategy|
|
9
|
+
allow(strategy).to receive(:request) {
|
10
|
+
request
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'client options' do
|
16
|
+
it 'should have correct name' do
|
17
|
+
expect(subject.options.name).to eq('concur')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have correct site' do
|
21
|
+
expect(subject.options.client_options.site).to eq('https://www.concursolutions.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should have correct authorize url' do
|
25
|
+
expect(subject.options.client_options.authorize_url).to eq('/net2/oauth2/Login.aspx')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should have correct token url' do
|
29
|
+
expect(subject.options.client_options.token_url).to eq('/net2/oauth2/GetAccessToken.ashx')
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'omniauth'
|
6
|
+
require 'omniauth-concur-oauth2'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
10
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-concur-oauth2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Scott
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-07 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.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
|
+
description: OmniAuth strategy for authenticating with Concur's OAuth2 API
|
28
|
+
email: ascot21@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- ".document"
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- lib/omniauth-concur-oauth2.rb
|
40
|
+
- lib/omniauth-concur-oauth2/version.rb
|
41
|
+
- lib/omniauth/strategies/concur.rb
|
42
|
+
- omniauth-concur-oauth2.gemspec
|
43
|
+
- spec/omniauth-concur-oauth2_spec.rb
|
44
|
+
- spec/spec_helper.rb
|
45
|
+
homepage: http://github.com/ascot21/omniauth-concur-oauth2
|
46
|
+
licenses:
|
47
|
+
- The MIT License (MIT)
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.2.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: OmniAuth strategy for authenticating with Concur's OAuth2 API
|
69
|
+
test_files:
|
70
|
+
- spec/omniauth-concur-oauth2_spec.rb
|
71
|
+
- spec/spec_helper.rb
|