devise_aaf_rc_authenticatable 0.1.0 → 0.1.2

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: a8c8316d40e6717db312043028f643936e63df4b
4
- data.tar.gz: 6a3965d4d29bd690efe8a80fe012a44761018b2a
3
+ metadata.gz: 285a9e9754e0d3ef979ed675cbf16f58134c47c4
4
+ data.tar.gz: cc389d65ce2c20a99f888ea6798bfe6dc44dedcd
5
5
  SHA512:
6
- metadata.gz: 5f13faa43dcaeae522d76dc04954393a557b9c4a6a935a2b106e4205fb9ca902c272d36af53c46087b8eb78a716e91c9287b3731b1259013c733268a15f83ceb
7
- data.tar.gz: 7b18f1a94c315776a5422b58378c9e8c8be37b80cb2fa5a70cb404c2b2b2ece6df92a3636b20cb4499af04e5bc7eb20696a2667777edebb0d0ff39b554abb891
6
+ metadata.gz: 7dd21b18754f9c340d396f824b8de3354a64e4f35e677778938c328845963da39e745386e14e41827de648889a791ac30a41ce0cb8e7687f0cce086170a29a9f
7
+ data.tar.gz: ca3481787de3f54e6502cad2dc9ecb637abc3f97531ddcaf55a13a54b001845391a792c1949e2f47d975ed7494c05c33c06e84365337d9ecaa6ffb55831913bc
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ begin
33
33
  gemspec.homepage = "http://github.com/IntersectAustralia/devise_aaf_rc_authenticatable"
34
34
  gemspec.authors = ["Gabriel Gasser Noblia", "Shuqian Hon", "Daniel Theodosius", "Jake Farrell"]
35
35
  gemspec.add_runtime_dependency "devise", ">= 2.2.4"
36
- gemspec.version = "0.1.0"
36
+ gemspec.version = "0.1.2"
37
37
  end
38
38
  Jeweler::GemcutterTasks.new
39
39
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -2,16 +2,16 @@
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: devise_aaf_rc_authenticatable 0.1.0 ruby lib
5
+ # stub: devise_aaf_rc_authenticatable 0.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "devise_aaf_rc_authenticatable"
9
- s.version = "0.1.0"
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.require_paths = ["lib"]
13
13
  s.authors = ["Gabriel Gasser Noblia", "Shuqian Hon", "Daniel Theodosius", "Jake Farrell"]
14
- s.date = "2014-10-16"
14
+ s.date = "2014-10-29"
15
15
  s.description = "Devise AAF Rapid Connect Authenticatable is an authentication strategy for the Devise[http://github.com/plataformatec/devise] authentication framework."
16
16
  s.email = ["gabriel@intersect.org.au", "shuqian@intersect.org.au", "danielt@intersect.org.au", "jake@intersect.org.au"]
17
17
  s.extra_rdoc_files = [
@@ -36,15 +36,15 @@ module Devise
36
36
 
37
37
  auth_key_value = (self.case_insensitive_keys || []).include?(auth_key) ? attributes['mail'].downcase : attributes['mail']
38
38
 
39
- resource = where(auth_key => auth_key_value).first
39
+ resource = find_for_authentication(auth_key => auth_key_value)
40
40
 
41
41
  if (resource.nil? && !Devise.aaf_rc_create_user)
42
- logger.info("User(#{auth_key_value}) not found. Not configured to create the user.")
42
+ Rails.logger.info("User(#{auth_key_value}) not found. Not configured to create the user.")
43
43
  return nil
44
44
  end
45
45
 
46
46
  if (resource.nil? && Devise.aaf_rc_create_user)
47
- logger.info("Creating user(#{auth_key_value}).")
47
+ Rails.logger.info("Creating user(#{auth_key_value}).")
48
48
  resource = new
49
49
  save_user_aaf_rc_attributes(resource, attributes)
50
50
  resource.aaf_rc_before_save if resource.respond_to?(:aaf_rc_before_save)
@@ -58,7 +58,7 @@ module Devise
58
58
  def save_user_aaf_rc_attributes(resource, attributes)
59
59
  config = YAML.load(ERB.new(File.read(::Devise.aaf_rc_config || "#{Rails.root}/config/aaf_rc.yml")).result)[Rails.env]
60
60
  config['user-mapping'].each do |aaf_attr, db_field|
61
- logger.info("Saving #{attributes[aaf_attr]} to #{db_field}")
61
+ Rails.logger.info("Saving #{attributes[aaf_attr]} to #{db_field}")
62
62
  field = "#{db_field}="
63
63
  value = attributes[aaf_attr]
64
64
  resource.send(field, value.to_s) if resource.respond_to?(field)
@@ -19,7 +19,6 @@ module Devise
19
19
  config = YAML.load(ERB.new(File.read(::Devise.aaf_rc_config || "#{Rails.root}/config/aaf_rc.yml")).result)[Rails.env]
20
20
 
21
21
  jwt = JSON::JWT.decode(jws.to_s, config['secret_token'])
22
-
23
22
  # determines between test and production federation
24
23
  # based on the login URL provided during registration
25
24
 
@@ -48,6 +47,11 @@ module Devise
48
47
 
49
48
  resource = mapping.to.authenticate_with_aaf_rc(session[:attributes])
50
49
 
50
+ if resource.nil?
51
+ fail(:invalid_user_attributes)
52
+ return
53
+ end
54
+
51
55
  if validate(resource)
52
56
  begin
53
57
  resource.after_aaf_rc_authentication
@@ -1,4 +1,4 @@
1
1
  module DeviseAafRcAuthenticatable
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_aaf_rc_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Gasser Noblia
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-16 00:00:00.000000000 Z
14
+ date: 2014-10-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json-jwt