omniauth-casenex 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.
- data/.gitignore +2 -0
- data/.rvmrc +34 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +48 -0
- data/Guardfile +11 -0
- data/README.md +33 -0
- data/Rakefile +9 -0
- data/lib/omniauth-casenex.rb +1 -0
- data/lib/omniauth-casenex/version.rb +5 -0
- data/lib/omniauth/strategies/casenex.rb +38 -0
- data/omniauth-casenex.gemspec +22 -0
- data/spec/omniauth/strategies/casenex_spec.rb +25 -0
- data/spec/spec_helper.rb +7 -0
- metadata +106 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
8
|
+
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
+
environment_id="ruby-1.9.3-p194@omniauth-casenex"
|
10
|
+
|
11
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
+
# rvmrc_rvm_version="1.14.3 (master)" # 1.10.1 seams as a safe start
|
13
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
+
# return 1
|
16
|
+
# }
|
17
|
+
|
18
|
+
# First we attempt to load the desired environment directly from the environment
|
19
|
+
# file. This is very fast and efficient compared to running through the entire
|
20
|
+
# CLI and selector. If you want feedback on which environment was used then
|
21
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
+
then
|
25
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
+
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
+
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
+
else
|
29
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
+
rvm --create "$environment_id" || {
|
31
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
+
return 1
|
33
|
+
}
|
34
|
+
fi
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-casenex (0.1)
|
5
|
+
multi_json (~> 1.3)
|
6
|
+
omniauth-oauth2 (~> 1.0.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
faraday (0.8.1)
|
13
|
+
multipart-post (~> 1.1)
|
14
|
+
hashie (1.2.0)
|
15
|
+
httpauth (0.1)
|
16
|
+
json (1.7.3)
|
17
|
+
jwt (0.1.4)
|
18
|
+
json (>= 1.2.4)
|
19
|
+
multi_json (1.3.6)
|
20
|
+
multipart-post (1.1.5)
|
21
|
+
oauth2 (0.8.0)
|
22
|
+
faraday (~> 0.8)
|
23
|
+
httpauth (~> 0.1)
|
24
|
+
jwt (~> 0.1.4)
|
25
|
+
multi_json (~> 1.0)
|
26
|
+
rack (~> 1.2)
|
27
|
+
omniauth (1.1.0)
|
28
|
+
hashie (~> 1.2)
|
29
|
+
rack
|
30
|
+
omniauth-oauth2 (1.0.3)
|
31
|
+
oauth2 (~> 0.8.0)
|
32
|
+
omniauth (~> 1.0)
|
33
|
+
rack (1.4.1)
|
34
|
+
rspec (2.10.0)
|
35
|
+
rspec-core (~> 2.10.0)
|
36
|
+
rspec-expectations (~> 2.10.0)
|
37
|
+
rspec-mocks (~> 2.10.0)
|
38
|
+
rspec-core (2.10.1)
|
39
|
+
rspec-expectations (2.10.0)
|
40
|
+
diff-lcs (~> 1.1.3)
|
41
|
+
rspec-mocks (2.10.1)
|
42
|
+
|
43
|
+
PLATFORMS
|
44
|
+
ruby
|
45
|
+
|
46
|
+
DEPENDENCIES
|
47
|
+
omniauth-casenex!
|
48
|
+
rspec (~> 2.10)
|
data/Guardfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
OmniAuth Buffer
|
2
|
+
================
|
3
|
+
Work in Progress
|
4
|
+
|
5
|
+
This gem is an OmniAuth Strategy for the CaseNEX SSO server (http://auth.casenex.com/) which uses OAuth 2.0
|
6
|
+
|
7
|
+
Usage
|
8
|
+
-----
|
9
|
+
|
10
|
+
Add the strategy to your `Gemfile` alongside OmniAuth:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'omniauth'
|
14
|
+
gem 'omniauth-casenex'
|
15
|
+
```
|
16
|
+
|
17
|
+
Then integrate the strategy into your middleware:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
use OmniAuth::Builder do
|
21
|
+
provider :casenex, ENV['CASENEX_KEY'], ENV['CASENEX_SECRET']
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
25
|
+
In Rails, you'll want to add to the middleware stack:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
+
provider :casenex, ENV['CASENEX_KEY'], ENV['CASENEX_SECRET']
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/strategies/casenex'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Casenex < OmniAuth::Strategies::OAuth2
|
6
|
+
# Give your strategy a name.
|
7
|
+
option :name, "casenex"
|
8
|
+
|
9
|
+
# This is where you pass the options you would pass when
|
10
|
+
# initializing your consumer from the OAuth gem.
|
11
|
+
option :client_options, {:site => "https://sharp-stone-1355.herokuapp.com"}
|
12
|
+
|
13
|
+
# These are called after authentication has succeeded. If
|
14
|
+
# possible, you should try to set the UID without making
|
15
|
+
# additional calls (if the user id is returned with the token
|
16
|
+
# or as a URI parameter). This may not be possible with all
|
17
|
+
# providers.
|
18
|
+
uid{ raw_info['id'] }
|
19
|
+
|
20
|
+
info do
|
21
|
+
{
|
22
|
+
:name => raw_info['name'],
|
23
|
+
:email => raw_info['email']
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
extra do
|
28
|
+
{
|
29
|
+
'raw_info' => raw_info
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def raw_info
|
34
|
+
@raw_info ||= access_token.get('/me').parsed
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-casenex/version', __FILE__)
|
3
|
+
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "omniauth-casenex"
|
7
|
+
gem.version = OmniAuth::Casenex::VERSION
|
8
|
+
gem.authors = ["Mike Prosper"]
|
9
|
+
gem.email = ["mprosper@casenex.com"]
|
10
|
+
gem.description = "Omniauth strategy for CaseNEX"
|
11
|
+
gem.summary = "Omniauth strategy for CaseNEX"
|
12
|
+
gem.homepage = "https://github.com/casenex/omniauth-casenex.git"
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split($\)
|
15
|
+
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.require_paths = ["lib"]
|
18
|
+
|
19
|
+
gem.add_dependency 'multi_json', '~> 1.3'
|
20
|
+
gem.add_development_dependency 'rspec', '~> 2.10'
|
21
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.2'
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Casenex do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::Casenex.new({})
|
6
|
+
end
|
7
|
+
|
8
|
+
context "client options" do
|
9
|
+
it 'should have correct name' do
|
10
|
+
subject.options.name.should eq("casenex")
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should have correct site' do
|
14
|
+
subject.options.client_options.site.should eq('http://auth.casenex.com')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have correct authorize url' do
|
18
|
+
subject.options.client_options.authorize_url.should eq('https://auth.casenex.com/auth/authorize')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have correct token url' do
|
22
|
+
subject.options.client_options.token_url.should eq('https://auth.casenex.com/auth/access_token')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-casenex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mike Prosper
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: multi_json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2.10'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.10'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: omniauth-oauth2
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.0.2
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.2
|
62
|
+
description: Omniauth strategy for CaseNEX
|
63
|
+
email:
|
64
|
+
- mprosper@casenex.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rvmrc
|
71
|
+
- Gemfile
|
72
|
+
- Gemfile.lock
|
73
|
+
- Guardfile
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- lib/omniauth-casenex.rb
|
77
|
+
- lib/omniauth-casenex/version.rb
|
78
|
+
- lib/omniauth/strategies/casenex.rb
|
79
|
+
- omniauth-casenex.gemspec
|
80
|
+
- spec/omniauth/strategies/casenex_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
homepage: https://github.com/casenex/omniauth-casenex.git
|
83
|
+
licenses: []
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.8.24
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Omniauth strategy for CaseNEX
|
106
|
+
test_files: []
|