omniauth-alephx 0.1.2 → 0.1.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2Q5N2VhNjc5ZTNlNmE1YmRlOWNhODdmYjg3NzU3ZTUyNDI3YjA1Mg==
4
+ ZDBlNTUwODgyOTlkYWI1MzVjNTQwMzQ4NjgzNmNlNTdkMWQ2NDY3Mg==
5
5
  data.tar.gz: !binary |-
6
- Y2NjMWJhNmZiYmNmMjExMDcxMmM0M2IxNzUxNDdkYTAwYmM3ODY0MA==
6
+ NmUxOTg0YzVjM2JiMzlhZmYwY2YxMmEyYzk5ZDkzYzZjZTliYjRjMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTM3NTM5MGNjM2U4MTBmYjk4YjA2ZjcyODU4YjczZjNjNDM5ZDJmOTlkOWFi
10
- YjhmZTFjY2QxNzFiMzUxNmE2MTdlMTk3YmI2MDEzYjFmNGZkYmRhZjEwNmI4
11
- ZmRmYzA5MGQ5NjFkM2U1NzUxYmQwZGRiMWZmZWZmZTM2YWJlODY=
9
+ YWVkMjUzZGEyODIyZjc0ZWU0YTU5MWEyODQxZDU3MGVhMTQ2YWJkY2RhZWZm
10
+ OTg3YmM4MmJhNWY4ODA3NDg4YTY3ZWI5ZjE0MzA3YWMyZjllMjgwNTI2NTE5
11
+ YWM2ZDI0MWYzZTM3N2FjM2YxNDVhYjkxNGEyMjUzNWJhZDNlZWQ=
12
12
  data.tar.gz: !binary |-
13
- YThkMzBkNjg4YjY1MTI2OTEyYzQxZjQzYWRhZWNiOWNmN2NmNDQ1NmVkN2Rh
14
- MTg5MWYzZWUyMjM5N2EyZmMyNjUyZGJmOWQ2OTJkYzM1ZDFiNmYwZTJkMzlk
15
- ZDU2NTNiM2JhY2FiMzJkZGVlOGU1NmU1ZjBmZGQ0MmM0ZjkxYTE=
13
+ OTdkNTA0YWE2Y2ExNzEzNDg1MTJkOTJiYmNjYWMyMTljNTc3NzE1N2E5MmEy
14
+ YzI0OGJiOWI2ZjFkOTNlYWZiZGRiYWI1OWMwZWE4M2UyN2FkNTZiMTliNDQw
15
+ ZmE5NDU5OTk4MDhiZGFjYjFiZDI5YmIwNTUwM2U3YzRjMDg1MTE=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.3
@@ -1,5 +1,6 @@
1
1
  require 'omniauth'
2
2
  require 'xmlsimple'
3
+ require 'uri'
3
4
 
4
5
  module OmniAuth
5
6
  module Strategies
@@ -19,7 +20,8 @@ module OmniAuth
19
20
  @user_info = {}
20
21
 
21
22
  class << self
22
- attr_accessor :filters
23
+ attr_accessor :filters,:on_error
24
+
23
25
  def add_filter(&block)
24
26
  @filters = [] if @filters.nil?
25
27
  @filters << block
@@ -31,7 +33,7 @@ module OmniAuth
31
33
  }
32
34
  info {
33
35
  {
34
- :name => @user_info[:bor_id],
36
+ :name => @user_info[:name],
35
37
  :email => @user_info[:email]
36
38
  }
37
39
  }
@@ -54,14 +56,18 @@ module OmniAuth
54
56
 
55
57
  def callback_phase
56
58
 
59
+ params = request.params
60
+
61
+ rp = request_path+"?"+{ :username => params['username'] }.to_query
62
+
57
63
  if missing_credentials?
58
64
  session['omniauth.alephx.error'] = :missing_credentials
59
- return redirect(request_path)
65
+ self.class.on_error.call(:missing_credentials) unless self.class.on_error.nil?
66
+ return redirect(rp)
60
67
  end
61
68
 
62
69
  begin
63
70
 
64
- params = request.params
65
71
 
66
72
  unless self.class.filters.nil?
67
73
  self.class.filters.each do |filter|
@@ -74,14 +80,18 @@ module OmniAuth
74
80
 
75
81
  unless bor_auth(username,password)
76
82
  session['omniauth.alephx.error'] = :invalid_credentials
77
- return redirect(request_path)
83
+ self.class.on_error.call(:invalid_credentials) unless self.class.on_error.nil?
84
+ return redirect(rp)
78
85
  end
79
86
 
80
87
  rescue Exception => e
81
88
  session['omniauth.alephx.error'] = :invalid_credentials
82
- return redirect(request_path)
89
+ self.class.on_error.call(:invalid_credentials) unless self.class.on_error.nil?
90
+ return redirect(rp)
83
91
  end
84
92
 
93
+ session.delete('omniauth.alephx.error')
94
+
85
95
  super
86
96
  end
87
97
 
@@ -105,7 +115,8 @@ module OmniAuth
105
115
  return false if document['error']
106
116
 
107
117
  @user_info = {
108
- :bor_id => username,
118
+ #user pwd to communicate with aleph (cannot extract cas username or barcode from alephx!)
119
+ :bor_id => document['z303']['z303-id'],
109
120
  :name => document['z303']['z303-name'],
110
121
  :email => document['z304']['z304-email-address']
111
122
  }
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Alephx
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -2,15 +2,15 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: omniauth-alephx 0.1.2 ruby lib
5
+ # stub: omniauth-alephx 0.1.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "omniauth-alephx"
9
- s.version = "0.1.2"
9
+ s.version = "0.1.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Nicolas Franck"]
13
- s.date = "2014-06-10"
13
+ s.date = "2014-09-05"
14
14
  s.description = "omniauth strategy for authenticating against AlephX Service"
15
15
  s.email = "nicolas.franck@ugent.be"
16
16
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-alephx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Franck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -58,48 +58,42 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: !binary |-
62
- My4xMg==
61
+ version: '3.12'
63
62
  type: :development
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
66
  - - ~>
68
67
  - !ruby/object:Gem::Version
69
- version: !binary |-
70
- My4xMg==
68
+ version: '3.12'
71
69
  - !ruby/object:Gem::Dependency
72
70
  name: bundler
73
71
  requirement: !ruby/object:Gem::Requirement
74
72
  requirements:
75
73
  - - ~>
76
74
  - !ruby/object:Gem::Version
77
- version: !binary |-
78
- MS4w
75
+ version: '1.0'
79
76
  type: :development
80
77
  prerelease: false
81
78
  version_requirements: !ruby/object:Gem::Requirement
82
79
  requirements:
83
80
  - - ~>
84
81
  - !ruby/object:Gem::Version
85
- version: !binary |-
86
- MS4w
82
+ version: '1.0'
87
83
  - !ruby/object:Gem::Dependency
88
84
  name: jeweler
89
85
  requirement: !ruby/object:Gem::Requirement
90
86
  requirements:
91
87
  - - ~>
92
88
  - !ruby/object:Gem::Version
93
- version: !binary |-
94
- Mi4wLjE=
89
+ version: 2.0.1
95
90
  type: :development
96
91
  prerelease: false
97
92
  version_requirements: !ruby/object:Gem::Requirement
98
93
  requirements:
99
94
  - - ~>
100
95
  - !ruby/object:Gem::Version
101
- version: !binary |-
102
- Mi4wLjE=
96
+ version: 2.0.1
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: simplecov
105
99
  requirement: !ruby/object:Gem::Requirement