omniauth-alephx 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Yzc2MTA0OGIwZGI4ZTczZGFhODdkOGE3MjBmNDc5Y2Q4ZTMxOTc4Zg==
4
+ N2Q5N2VhNjc5ZTNlNmE1YmRlOWNhODdmYjg3NzU3ZTUyNDI3YjA1Mg==
5
5
  data.tar.gz: !binary |-
6
- ZDMxNTMyMDllN2U3MDQ2MTVjNTJmZGM2M2I2M2ZkODQ3OWY5OGY3Mw==
6
+ Y2NjMWJhNmZiYmNmMjExMDcxMmM0M2IxNzUxNDdkYTAwYmM3ODY0MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGRlYWIzZjNlYWY5ZmEyNTkxZGNmNzE0NTBhNDcwNmI1OWI3ZDU5NmFmZWQ5
10
- ZGRiMGEzMmI1NGZmNjI2ZDhkZjM0OGQwYmMwMWY0ZjVhMmI1ZDU0ZDdlNzNm
11
- ZGRkZDFkNmI3M2ExNjk2MmYyNWIzNjMyNTVlNmFkMjg4Y2JmMTY=
9
+ ZTM3NTM5MGNjM2U4MTBmYjk4YjA2ZjcyODU4YjczZjNjNDM5ZDJmOTlkOWFi
10
+ YjhmZTFjY2QxNzFiMzUxNmE2MTdlMTk3YmI2MDEzYjFmNGZkYmRhZjEwNmI4
11
+ ZmRmYzA5MGQ5NjFkM2U1NzUxYmQwZGRiMWZmZWZmZTM2YWJlODY=
12
12
  data.tar.gz: !binary |-
13
- YzdjMjY0NTA5Zjg2MmNlNDI1OWNkNWI4ZWE4NjYxNWQ1NThiOGE0NTY0NDBm
14
- MTUzMGExYjkwZThiODkzNGJiYzg5NDcyOGEyZDJmMTMxYWI2Y2I5ZDNlZWY1
15
- NDRmMzNmYTZhOWMxMjEwODQ4ZDcwZmI0MGE5ZjZmZDVmMzY3YmI=
13
+ YThkMzBkNjg4YjY1MTI2OTEyYzQxZjQzYWRhZWNiOWNmN2NmNDQ1NmVkN2Rh
14
+ MTg5MWYzZWUyMjM5N2EyZmMyNjUyZGJmOWQ2OTJkYzM1ZDFiNmYwZTJkMzlk
15
+ ZDU2NTNiM2JhY2FiMzJkZGVlOGU1NmU1ZjBmZGQ0MmM0ZjkxYTE=
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ #OmniAuth Alephx Strategy
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'omniauth-alephx'
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install omniauth-alephx
16
+
17
+ ## Usage
18
+
19
+ Use like any other OmniAuth strategy:
20
+
21
+ ```ruby
22
+ Rails.application.config.middleware.use OmniAuth::Builder do
23
+ provider :alephx, url: 'http://aleph.server.be/X', library: 'usm50'
24
+ end
25
+ ```
26
+
27
+ Or like in Rails:
28
+
29
+ ```ruby
30
+ config.omniauth :alephx,{
31
+ :url => "http://aleph.server.be/X",
32
+ :library => "usm50"
33
+ }
34
+ ```
35
+
36
+ ### Configuration Options
37
+
38
+ #### Required
39
+
40
+ OmniAuth CAS requires at least one of the following two configuration options:
41
+
42
+ * `url` - Defines the URL of your AlephX server (e.g. `http://example.org:8080/X`)
43
+ * `library` - Defines the name of your aleph user database (e.g. usm50)
44
+
45
+ #### Optional
46
+
47
+ Other configuration options:
48
+
49
+ * `form` - proc or lambda that returns a rails response object.
50
+
51
+ ```ruby
52
+ config.omniauth :alephx,{
53
+ :url => "http://aleph.server.be/X",
54
+ :library => "usm50",
55
+ :form => lambda { |env|
56
+ AlephxSessionController.action(:new).call(env)
57
+ }
58
+ }
59
+ ```
60
+ When `form` is not set, options below will be used.
61
+
62
+ * `title_form`
63
+ * `label_username`
64
+ * `label_password`
65
+ * `label_submit`
66
+
67
+ ## Class methods
68
+
69
+ * add_filter(&block)
70
+
71
+ change input parameters
72
+
73
+ ```ruby
74
+ OmniAuth::Strategies::Alephx.add_filter do |params|
75
+
76
+ unless params['username'].nil?
77
+
78
+ #if the 'username' looks like a EAN-13, then strip off the last check digit
79
+ params['username'].strip!
80
+ if params['username'] =~ /^\d{13,}$/
81
+ params['username'] = params['username'][0..-2]
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+ ```
88
+
89
+ ##Author
90
+
91
+ Nicolas Franck
92
+
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Alephx
3
- VERSION = "0.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ module OmniAuth
9
9
  #required
10
10
  option :url # :url => "http://aleph.ugent.be/X"
11
11
  option :library # :library => "rug50"
12
-
12
+
13
13
  #only for test purpose (if you do not specify the option :form, a form will be created, using these options)
14
14
  option :title_form, "Aleph authentication"
15
15
  option :label_password,:password
@@ -18,6 +18,14 @@ module OmniAuth
18
18
 
19
19
  @user_info = {}
20
20
 
21
+ class << self
22
+ attr_accessor :filters
23
+ def add_filter(&block)
24
+ @filters = [] if @filters.nil?
25
+ @filters << block
26
+ end
27
+ end
28
+
21
29
  uid {
22
30
  @user_info[:bor_id]
23
31
  }
@@ -54,6 +62,13 @@ module OmniAuth
54
62
  begin
55
63
 
56
64
  params = request.params
65
+
66
+ unless self.class.filters.nil?
67
+ self.class.filters.each do |filter|
68
+ filter.call(params)
69
+ end
70
+ end
71
+
57
72
  username = params['username']
58
73
  password = params['password']
59
74
 
@@ -2,27 +2,27 @@
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.1 ruby lib
5
+ # stub: omniauth-alephx 0.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "omniauth-alephx"
9
- s.version = "0.1.1"
9
+ s.version = "0.1.2"
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-02-28"
13
+ s.date = "2014-06-10"
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 = [
17
17
  "LICENSE.txt",
18
- "README.rdoc"
18
+ "README.md"
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
22
  "Gemfile",
23
23
  "Gemfile.lock",
24
24
  "LICENSE.txt",
25
- "README.rdoc",
25
+ "README.md",
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "lib/omniauth-alephx.rb",
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.1
4
+ version: 0.1.2
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-02-28 00:00:00.000000000 Z
11
+ date: 2014-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -58,42 +58,48 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '3.12'
61
+ version: !binary |-
62
+ My4xMg==
62
63
  type: :development
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
67
  - - ~>
67
68
  - !ruby/object:Gem::Version
68
- version: '3.12'
69
+ version: !binary |-
70
+ My4xMg==
69
71
  - !ruby/object:Gem::Dependency
70
72
  name: bundler
71
73
  requirement: !ruby/object:Gem::Requirement
72
74
  requirements:
73
75
  - - ~>
74
76
  - !ruby/object:Gem::Version
75
- version: '1.0'
77
+ version: !binary |-
78
+ MS4w
76
79
  type: :development
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
80
83
  - - ~>
81
84
  - !ruby/object:Gem::Version
82
- version: '1.0'
85
+ version: !binary |-
86
+ MS4w
83
87
  - !ruby/object:Gem::Dependency
84
88
  name: jeweler
85
89
  requirement: !ruby/object:Gem::Requirement
86
90
  requirements:
87
91
  - - ~>
88
92
  - !ruby/object:Gem::Version
89
- version: 2.0.1
93
+ version: !binary |-
94
+ Mi4wLjE=
90
95
  type: :development
91
96
  prerelease: false
92
97
  version_requirements: !ruby/object:Gem::Requirement
93
98
  requirements:
94
99
  - - ~>
95
100
  - !ruby/object:Gem::Version
96
- version: 2.0.1
101
+ version: !binary |-
102
+ Mi4wLjE=
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: simplecov
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -114,13 +120,13 @@ executables: []
114
120
  extensions: []
115
121
  extra_rdoc_files:
116
122
  - LICENSE.txt
117
- - README.rdoc
123
+ - README.md
118
124
  files:
119
125
  - .document
120
126
  - Gemfile
121
127
  - Gemfile.lock
122
128
  - LICENSE.txt
123
- - README.rdoc
129
+ - README.md
124
130
  - Rakefile
125
131
  - VERSION
126
132
  - lib/omniauth-alephx.rb
data/README.rdoc DELETED
@@ -1,19 +0,0 @@
1
- = omniauth-alephx
2
-
3
- Description goes here.
4
-
5
- == Contributing to omniauth-alephx
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2014 Nicolas Franck. See LICENSE.txt for
18
- further details.
19
-