els_token 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea6850f3a527b1b4b26d40ae9c0af8e18d2cf36a
4
- data.tar.gz: 8244af47707415e7c55288e761a5759a48fb5159
3
+ metadata.gz: 4e17f41d2021c1d75772963f50018bb61572a376
4
+ data.tar.gz: 82853fe3b8d0df47a4f2e5286b31c1c3a97ecdba
5
5
  SHA512:
6
- metadata.gz: 4178773976a51fa336495dd50ed7df7b2bcb0806b27990ad59ee009f90f78f0ff461f34af804812fed202af45ed56e3d7671672ca2503130cee84d3e1e9755e7
7
- data.tar.gz: 0bfda4404ba281d587271fda82c2467bc0e8866458c163648780d67dca40e30476a750bd1a220be4ba640eae366d00a49c8b0921c5142397198684eea3bd8385
6
+ metadata.gz: 5e034516abf617a6639ba6ec071b779dabcf0cce95a506d1c5010e734e5f251d44d0dc29d17fa9fb65458fc6e3e394249b88c8552064c55926f996c94edfa657
7
+ data.tar.gz: bae9cca795d1c1d07d97443a4e726c4d6177f478c63e9d7922e577dd8dc28b28cbbaf369d26e3dfc9c4c42f665431f2c23885dd7029b2f56b29f2f8930477d22
data/README.md CHANGED
@@ -2,14 +2,31 @@
2
2
 
3
3
  A simple library for interfacing with forgeRock OpenAM REST Interface.
4
4
 
5
- Still pretty much in development but kind of workable.
6
5
 
7
6
  ## Usage
8
7
 
9
- include ElsToken into your class or module
8
+ ElsToken can be mixed into a class/module and/or used directly.
9
+
10
+
11
+ __authenticate, validate and extract__
12
+
13
+ # The ELS end point
14
+ opts = {'uri' => 'https://els-sso.corp.aol.com/opensso/identity'}
15
+
16
+ # Generate a token
17
+ token = ElsToken.authenticate('username','password', opts)
18
+
19
+ # Determine if token is valid
20
+ is_valid = ElsToken.is_token_valid?(token, opts)
21
+
22
+ # Retrieve an Identity Object (includes group membership, etc)
23
+ ad_user = ElsToken.get_identity(token, opts)
10
24
 
11
25
  ## change log
12
26
 
27
+ 1.2.3
28
+ Fixed Ruby 2.0.0 compatibility
29
+
13
30
  1.2.2
14
31
  Removed Rails logger dependency
15
32
  Added a couple of extra attributes to the ELS Identity Object
@@ -26,8 +43,3 @@ include ElsToken into your class or module
26
43
  1.0.0
27
44
  Initial release :)
28
45
 
29
- ## TODO
30
- With the correct level of priviledge it's possible to perform granular LDAP searches against the OpenAM REST interface.
31
- By Default one can only pull identity details for a provided token but it might be nice to search against other attributes.
32
-
33
- Erm some tests might be nice :)
@@ -73,7 +73,7 @@ module ElsToken
73
73
  def authenticate(username,password,options={})
74
74
  begin
75
75
  response = els_http_request("/authenticate",
76
- "uri=realm=aolcorporate&username=#{username}&password=#{password}",
76
+ {"uri"=>"realm=aolcorporate","username"=>"#{username}","password"=>"#{password}"},
77
77
  options)
78
78
  if response.code.eql? "200"
79
79
  # return the token
@@ -93,8 +93,8 @@ module ElsToken
93
93
 
94
94
  # passes a token to els to see if it is still valid
95
95
  def is_token_valid?(token, options={})
96
- response = els_http_request("/isTokenValid","tokenid=#{token}",options)
97
- if response.code.eql? "200"
96
+ response = els_http_request("/isTokenValid",{"tokenid"=>"#{token}"},options)
97
+ if (response.code.eql? "200") && (response.body.chomp.eql? "boolean=true")
98
98
  true
99
99
  else
100
100
  false
@@ -112,7 +112,7 @@ module ElsToken
112
112
  # in a nice, friendly, object. If you don't like that object
113
113
  # or need the raw data, then use this.
114
114
  def get_raw_token_identity(token,options={})
115
- response = els_http_request("/attributes","subjectid=#{token}",options)
115
+ response = els_http_request("/attributes",{"subjectid"=>"#{token}"},options)
116
116
  if response.code.eql? "200"
117
117
  response.body
118
118
  else
@@ -142,15 +142,15 @@ module ElsToken
142
142
 
143
143
  private
144
144
 
145
- def els_http_request(url_base_extension, query_string, options)
145
+ def els_http_request(url_base_extension, request_body={}, options)
146
146
  options = els_options.dup.merge(options)
147
147
  uri = URI.parse(options['uri'] + url_base_extension)
148
- uri.query=query_string
149
- http = Net::HTTP.new(uri.host,uri.port)
148
+ # uri.query=query_string
149
+ http = Net::HTTP.new(uri.host, uri.port)
150
150
  http.use_ssl = true
151
151
 
152
152
  # Use a known certificate if supplied
153
- if rootca = options[:cert]
153
+ if rootca = options['cert']
154
154
  if File.exist? rootca
155
155
  http.ca_file = rootca
156
156
  elsif Dir.exist? rootca
@@ -164,7 +164,8 @@ module ElsToken
164
164
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
165
165
  end
166
166
 
167
- request = Net::HTTP::Get.new(uri.request_uri)
167
+ request = Net::HTTP::Post.new(uri.request_uri)
168
+ request.set_form_data(request_body)
168
169
 
169
170
  http.request(request)
170
171
  end
@@ -1,3 +1,3 @@
1
1
  module ElsToken
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
@@ -1,90 +1,50 @@
1
- Connecting to database specified by database.yml
2
1
 
3
2
 
4
- Started GET "/" for 127.0.0.1 at 2012-10-09 18:47:43 +0100
3
+ Started GET "/" for 127.0.0.1 at 2015-05-06 16:29:11 -0400
5
4
  Connecting to database specified by database.yml
6
5
  Processing by ElsSessionController#show as HTML
6
+ no identity in cache. Redirecting
7
7
  user will be returned to /
8
- Redirected to http://localhost:3000/els_session/new
8
+ Redirected to http://localhost:9292/els_session/new
9
9
  Filter chain halted as :els_identity rendered or redirected
10
10
  Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
11
11
 
12
12
 
13
- Started GET "/els_session/new" for 127.0.0.1 at 2012-10-09 18:47:43 +0100
13
+ Started GET "/els_session/new" for 127.0.0.1 at 2015-05-06 16:29:11 -0400
14
14
  Processing by ElsSessionController#new as HTML
15
- Rendered els_session/new.html.erb within layouts/application (4.4ms)
16
- Compiled application.css (1ms) (pid 31195)
17
- Compiled jquery.js (5ms) (pid 31195)
18
- Completed 500 Internal Server Error in 78ms
15
+ Rendered els_session/new.html.erb within layouts/application (2.5ms)
16
+ Compiled application.css (0ms) (pid 81668)
17
+ Compiled application.js (0ms) (pid 81668)
18
+ Completed 200 OK in 654ms (Views: 20.0ms | ActiveRecord: 0.0ms)
19
+
19
20
 
20
- ActionView::Template::Error (cannot load such file -- coffee_script
21
- (in /Users/neilcuk/dev/ruby/gems/els_token/test/dummy/app/assets/javascripts/els_session.js.coffee)):
22
- 3: <head>
23
- 4: <title>ElsSession</title>
24
- 5: <%= stylesheet_link_tag "application", :media => "all" %>
25
- 6: <%= javascript_include_tag "application" %>
26
- 7: <%= csrf_meta_tags %>
27
- 8: </head>
28
- 9: <body>
29
- app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___3102776676085365165_70273562929120'
21
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2015-05-06 16:29:12 -0400
22
+ Served asset /application.css - 200 OK (3ms)
30
23
 
31
24
 
32
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
33
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
34
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (10.0ms)
25
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2015-05-06 16:29:12 -0400
26
+ Served asset /application.js - 200 OK (1ms)
35
27
 
36
28
 
37
- Started GET "/" for 127.0.0.1 at 2012-10-09 18:50:37 +0100
29
+ Started GET "/" for 127.0.0.1 at 2015-05-06 16:35:30 -0400
38
30
  Connecting to database specified by database.yml
39
31
  Processing by ElsSessionController#show as HTML
32
+ no identity in cache. Redirecting
40
33
  user will be returned to /
41
- Redirected to http://localhost:3000/els_session/new
34
+ Redirected to http://localhost:9292/els_session/new
42
35
  Filter chain halted as :els_identity rendered or redirected
43
36
  Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
44
37
 
45
38
 
46
- Started GET "/els_session/new" for 127.0.0.1 at 2012-10-09 18:50:37 +0100
39
+ Started GET "/els_session/new" for 127.0.0.1 at 2015-05-06 16:35:30 -0400
47
40
  Processing by ElsSessionController#new as HTML
48
- Rendered els_session/new.html.erb within layouts/application (4.9ms)
49
- Completed 500 Internal Server Error in 28ms
50
-
51
- ActionView::Template::Error (couldn't find file 'jquery'
52
- (in /Users/neilcuk/dev/ruby/gems/els_token/test/dummy/app/assets/javascripts/application.js:13)):
53
- 3: <head>
54
- 4: <title>ElsSession</title>
55
- 5: <%= stylesheet_link_tag "application", :media => "all" %>
56
- 6: <%= javascript_include_tag "application" %>
57
- 7: <%= csrf_meta_tags %>
58
- 8: </head>
59
- 9: <body>
60
- app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___2865467007981793915_70182484825280'
61
-
62
-
63
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
64
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
65
- Rendered /Users/neilcuk/.rvm/gems/ruby-1.9.3-p194@gemdev/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (9.0ms)
66
-
67
-
68
- Started GET "/els_session/new" for 127.0.0.1 at 2012-10-09 18:53:26 +0100
69
- Connecting to database specified by database.yml
70
- Processing by ElsSessionController#new as HTML
71
- Rendered els_session/new.html.erb within layouts/application (4.5ms)
72
- Compiled els_session.js (59ms) (pid 31910)
73
- Compiled application.js (92ms) (pid 31910)
74
- Completed 200 OK in 134ms (Views: 133.1ms | ActiveRecord: 0.0ms)
75
-
76
-
77
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2012-10-09 18:53:26 +0100
78
- Served asset /application.css - 200 OK (2ms)
79
-
80
-
81
- Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-10-09 18:53:26 +0100
82
- Served asset /jquery.js - 304 Not Modified (4ms)
41
+ Rendered els_session/new.html.erb within layouts/application (2.2ms)
42
+ Completed 200 OK in 200ms (Views: 11.9ms | ActiveRecord: 0.0ms)
83
43
 
84
44
 
85
- Started GET "/assets/els_session.js?body=1" for 127.0.0.1 at 2012-10-09 18:53:26 +0100
86
- Served asset /els_session.js - 200 OK (1ms)
45
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2015-05-06 16:35:30 -0400
46
+ Served asset /application.css - 304 Not Modified (1ms)
87
47
 
88
48
 
89
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-10-09 18:53:26 +0100
90
- Served asset /application.js - 200 OK (3ms)
49
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2015-05-06 16:35:30 -0400
50
+ Served asset /application.js - 304 Not Modified (16ms)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: els_token
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Chambers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-20 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple plugin to assist ELS token validation
14
14
  email:
@@ -17,14 +17,18 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - MIT-LICENSE
21
+ - README.md
22
+ - Rakefile
23
+ - lib/els_token.rb
20
24
  - lib/els_token/els_identity.rb
21
25
  - lib/els_token/module_inheritable_attributes.rb
22
26
  - lib/els_token/version.rb
23
- - lib/els_token.rb
24
27
  - lib/tasks/els_token_tasks.rake
25
- - MIT-LICENSE
26
- - Rakefile
27
- - README.md
28
+ - test/dummy/Gemfile
29
+ - test/dummy/Gemfile.lock
30
+ - test/dummy/README.rdoc
31
+ - test/dummy/Rakefile
28
32
  - test/dummy/app/assets/javascripts/application.js
29
33
  - test/dummy/app/assets/javascripts/els_session.js.coffee
30
34
  - test/dummy/app/assets/stylesheets/application.css
@@ -36,6 +40,7 @@ files:
36
40
  - test/dummy/app/views/els_session/new.html.erb
37
41
  - test/dummy/app/views/els_session/show.html.erb
38
42
  - test/dummy/app/views/layouts/application.html.erb
43
+ - test/dummy/config.ru
39
44
  - test/dummy/config/application.rb
40
45
  - test/dummy/config/boot.rb
41
46
  - test/dummy/config/database.yml
@@ -54,29 +59,19 @@ files:
54
59
  - test/dummy/config/initializers/wrap_parameters.rb
55
60
  - test/dummy/config/locales/en.yml
56
61
  - test/dummy/config/routes.rb
57
- - test/dummy/config.ru
58
62
  - test/dummy/db/development.sqlite3
59
63
  - test/dummy/db/schema.rb
60
- - test/dummy/Gemfile
61
- - test/dummy/Gemfile.lock
62
64
  - test/dummy/log/development.log
63
65
  - test/dummy/public/404.html
64
66
  - test/dummy/public/422.html
65
67
  - test/dummy/public/500.html
66
68
  - test/dummy/public/favicon.ico
67
- - test/dummy/Rakefile
68
- - test/dummy/README.rdoc
69
69
  - test/dummy/script/rails
70
- - test/dummy/tmp/cache/assets/C62/0A0/sprockets%2F59e2e0f72731b9584015e80b76777d29
71
- - test/dummy/tmp/cache/assets/CA6/630/sprockets%2F8af9c2296e34c4f01a58747a12c07130
72
70
  - test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
73
71
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
74
- - test/dummy/tmp/cache/assets/D49/140/sprockets%2Fd128539bcb29d65cf7e28a43f8563a2f
75
72
  - test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
76
73
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
77
- - test/dummy/tmp/cache/assets/D9C/D00/sprockets%2F66ef3d03a58dfcc273e3453b04fdf81b
78
74
  - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
79
- - test/dummy/tmp/cache/assets/DF9/7C0/sprockets%2F6ebe9d7bfd3beeba96d6131aa526e700
80
75
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
81
76
  - test/test_helper.rb
82
77
  homepage: http://wiki.office.aol.com/wiki/Els_Token
@@ -98,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
93
  version: '0'
99
94
  requirements: []
100
95
  rubyforge_project:
101
- rubygems_version: 2.1.1
96
+ rubygems_version: 2.4.6
102
97
  signing_key:
103
98
  specification_version: 4
104
99
  summary: A simple plugin to assist ELS token validation
@@ -145,15 +140,10 @@ test_files:
145
140
  - test/dummy/Rakefile
146
141
  - test/dummy/README.rdoc
147
142
  - test/dummy/script/rails
148
- - test/dummy/tmp/cache/assets/C62/0A0/sprockets%2F59e2e0f72731b9584015e80b76777d29
149
- - test/dummy/tmp/cache/assets/CA6/630/sprockets%2F8af9c2296e34c4f01a58747a12c07130
150
143
  - test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
151
144
  - test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
152
- - test/dummy/tmp/cache/assets/D49/140/sprockets%2Fd128539bcb29d65cf7e28a43f8563a2f
153
145
  - test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
154
146
  - test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
155
- - test/dummy/tmp/cache/assets/D9C/D00/sprockets%2F66ef3d03a58dfcc273e3453b04fdf81b
156
147
  - test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
157
- - test/dummy/tmp/cache/assets/DF9/7C0/sprockets%2F6ebe9d7bfd3beeba96d6131aa526e700
158
148
  - test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
159
149
  - test/test_helper.rb