devise_pam_authenticatable2 4.0.0 → 5.0.0

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: 4f9628d3cf2664bae5f639899ba105b4c7bbcfb2
4
- data.tar.gz: b7be5e5d0e46c978b11952d5b760a13779c53493
3
+ metadata.gz: 5347bab4c20cffd89d87fecb5d7242d9d157fa20
4
+ data.tar.gz: 152e411c4a5fcfeba64fc9aff53433554f4e62e2
5
5
  SHA512:
6
- metadata.gz: 2c3ba8094e16ece90da12a97d38ff4ea0b867fceb42a81293accdfe0c0fe20a1a1773ad4892e44ae75c445e068d5cdb9519f5b742a9ebe1536c4d0b784a91e36
7
- data.tar.gz: 53bfd564175eb464ebadfc3e89baeabcf0e3a56eb4e38504df28faa73d82fbd2326f45c6ab7e149d742e4d600d0b13aee1a95cf5e196e6b20dcf45ed8bf628bc
6
+ metadata.gz: 7230c55e58db7b42d852d1f08b3aa25ab67041cce5ddafbd759243f7685906a70e79cce9f258fbe918355f45235456cef2889c23f939506e9bb5f85a349ba6b7
7
+ data.tar.gz: 077c2fbe42c87b3a4bd5e6eacd437e70432b9aab4c7fb40078ecc8d92d5fa1e0daf1780416761495b7ae55b29ec8ad2381df8288e253a80c50708ecd25f42211
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 [name of plugin creator]
1
+ Copyright (c) 2017 Alexander Kaftan, James Wilson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -23,6 +23,14 @@ Or, to use the latest from github:
23
23
 
24
24
  gem "devise_pam_authenticatable2", :git => "git://github.com/devkral/devise_pam_authenticatable2.git"
25
25
 
26
+ Important changes
27
+ -----------------
28
+
29
+ Versions before 4.0.0 are limitted compatible with database_authenticatable.
30
+ Some removed code may can clash in earlier versions.
31
+
32
+ Version 5.0.0 change method names. Check if everything is correct.
33
+
26
34
  Setup
27
35
  -----
28
36
 
@@ -61,5 +69,3 @@ References
61
69
 
62
70
 
63
71
  Released under the MIT license
64
-
65
- Copyright (c) 2011 James Wilson, LithiumCorp Pty Ltd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.0
1
+ 5.0.0
@@ -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_pam_authenticatable2 4.0.0 ruby lib
5
+ # stub: devise_pam_authenticatable2 5.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "devise_pam_authenticatable2".freeze
9
- s.version = "4.0.0"
9
+ s.version = "5.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["James Wilson".freeze, "Alexander Kaftan".freeze]
14
- s.date = "2018-01-16"
14
+ s.date = "2018-01-17"
15
15
  s.description = "For authenticating against PAM (Pluggable Authentication Modules)".freeze
16
16
  s.email = "devkral@web.de".freeze
17
17
  s.extra_rdoc_files = [
@@ -14,13 +14,22 @@ module Devise
14
14
  ::Devise.pam_default_suffix
15
15
  end
16
16
 
17
- def pam_on_filled_pw(_attributes)
18
- # use blank password as discriminator between traditional login and pam login?
17
+ def on_pam_conflict(_attributes)
19
18
  # to disable login with pam return nil elsewise return a (different?) user object
20
- # as default assume there is no conflict and return user object
19
+ # as default assume there is never a conflict and return user object
21
20
  self
22
21
  end
23
22
 
23
+ def is_pam_conflict
24
+ # use blank password as discriminator between traditional login and pam login?
25
+ is_pam_account && resource.respond_to?('password') && resource.password.present?
26
+ end
27
+
28
+ def is_pam_account
29
+ return false unless get_pam_name
30
+ Rpam2.account(get_service, get_pam_name)
31
+ end
32
+
24
33
  def pam_setup(attributes)
25
34
  return unless ::Devise.emailfield && ::Devise.usernamefield
26
35
  self[::Devise.emailfield] = Rpam2.getenv(get_service, get_pam_name, attributes[:password], 'email', false)
@@ -78,7 +87,7 @@ module Devise
78
87
  end
79
88
 
80
89
  # potential conflict detected
81
- resource = resource.pam_on_filled_pw(attributes) if resource.respond_to?('password') && resource.password.present?
90
+ resource = resource.on_pam_conflict(attributes) if resource.is_pam_conflict
82
91
 
83
92
  return nil unless resource && resource.try(:valid_pam_authentication?, attributes[:password])
84
93
  if resource.new_record?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_pam_authenticatable2
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Wilson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-16 00:00:00.000000000 Z
12
+ date: 2018-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise