omniauth-josso 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/lib/omniauth-josso.rb +1 -0
- data/lib/omniauth/josso.rb +2 -0
- data/lib/omniauth/josso/version.rb +5 -0
- data/lib/omniauth/strategies/josso.rb +65 -0
- data/omniauth-josso.gemspec +26 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 82c7d0942440a69a8d4ad69db617a3030988b9b2
|
4
|
+
data.tar.gz: 1deabd8b1fb829c8899cd0947ee3681032dae9d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c8369df0dcc7e357066604c6144a881f6ba54f873249ee89f3f921c5271e1ef5c423c2f9d698203e9e64bcd2d2b7e8b705e87bc0cdb74a2691fc98ee35fdc5e6
|
7
|
+
data.tar.gz: 948507e704c1b0a3e03dc4a00550cf1a9103b262f63701067609ae44122e6f719ea146a1eccf7884f0d10aec3be71a9168527bcf4a9d127de881dbf854e5a9fd
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Patricio Mac Adden <patriciomacadden@gmail.com>
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Omniauth::Josso
|
2
|
+
|
3
|
+
A Josso strategy for OmniAuth.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-josso'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ gem install omniauth-josso
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
use OmniAuth::Builder do
|
29
|
+
provider :josso, ENV['ENDPOINT_URL']
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( http://github.com/<my-github-username>/omniauth-josso/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create new Pull Request
|
40
|
+
|
41
|
+
## License
|
42
|
+
|
43
|
+
See the [LICENSE](https://github.com/patriciomacadden/omniauth-josso/blob/master/LICENSE).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/josso'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'omniauth'
|
2
|
+
require 'omniauth/strategy'
|
3
|
+
require 'savon'
|
4
|
+
|
5
|
+
module OmniAuth
|
6
|
+
module Strategies
|
7
|
+
class Josso
|
8
|
+
include OmniAuth::Strategy
|
9
|
+
|
10
|
+
args [:endpoint_url]
|
11
|
+
|
12
|
+
option :endpoint_url, nil
|
13
|
+
|
14
|
+
def request_phase
|
15
|
+
[
|
16
|
+
302,
|
17
|
+
{ 'Location' => "#{options.endpoint_url}/josso/signon/login.do?josso_back_to=#{callback_url}" },
|
18
|
+
[]
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
uid { agent.user.first[:name] }
|
23
|
+
|
24
|
+
info do
|
25
|
+
{
|
26
|
+
nickname: agent.user[0][:name],
|
27
|
+
name: agent.user.detect { |i| i[:name] == 'user.description' }[:value]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def agent
|
32
|
+
@agent ||= Agent.new options.endpoint_url, request.params['josso_assertion_id']
|
33
|
+
end
|
34
|
+
|
35
|
+
class Agent
|
36
|
+
def initialize(endpoint_url, josso_assertion_id)
|
37
|
+
@endpoint_url = endpoint_url
|
38
|
+
@josso_assertion_id = josso_assertion_id
|
39
|
+
end
|
40
|
+
|
41
|
+
def identity_manager
|
42
|
+
@identity_manager ||= Savon.client wsdl: "#{@endpoint_url}/josso/services/SSOIdentityManager?wsdl", soap_version: 1, ssl_verify_mode: :none
|
43
|
+
end
|
44
|
+
|
45
|
+
def identity_provider
|
46
|
+
@identity_provider ||= Savon.client wsdl: "#{@endpoint_url}/josso/services/SSOIdentityProvider?wsdl", soap_version: 1, ssl_verify_mode: :none
|
47
|
+
end
|
48
|
+
|
49
|
+
def session_id
|
50
|
+
@session_id ||= begin
|
51
|
+
res = identity_provider.call :resolve_authentication_assertion, message: { 'in0' => @josso_assertion_id }
|
52
|
+
res.to_hash[:resolve_authentication_assertion_response][:resolve_authentication_assertion_return]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def user
|
57
|
+
@user ||= begin
|
58
|
+
res = identity_manager.call :find_user_in_session, message: { 'in0' => session_id }
|
59
|
+
res.to_hash[:multi_ref]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/josso/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-josso'
|
8
|
+
spec.version = Omniauth::Josso::VERSION
|
9
|
+
spec.authors = ['Patricio Mac Adden']
|
10
|
+
spec.email = ['patriciomacadden@gmail.com']
|
11
|
+
spec.summary = %q{A Josso strategy for OmniAuth}
|
12
|
+
spec.description = %q{A Josso strategy for OmniAuth}
|
13
|
+
spec.homepage = 'https://github.com/patriciomacadden/omniauth-josso'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
|
24
|
+
spec.add_runtime_dependency 'omniauth', '~> 1.2'
|
25
|
+
spec.add_runtime_dependency 'savon', '~> 2.0'
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-josso
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patricio Mac Adden
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
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: omniauth
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: savon
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: A Josso strategy for OmniAuth
|
70
|
+
email:
|
71
|
+
- patriciomacadden@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/omniauth-josso.rb
|
82
|
+
- lib/omniauth/josso.rb
|
83
|
+
- lib/omniauth/josso/version.rb
|
84
|
+
- lib/omniauth/strategies/josso.rb
|
85
|
+
- omniauth-josso.gemspec
|
86
|
+
homepage: https://github.com/patriciomacadden/omniauth-josso
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.6.8
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: A Josso strategy for OmniAuth
|
110
|
+
test_files: []
|