socialcast_ldap_integration 1.1.16 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -130,6 +130,7 @@ module Socialcast
130
130
  # Defaults to 'company_login'
131
131
  def self.authenticated?(identifier, password, options = {})
132
132
  return false if password.blank?
133
+ return false if !self.user_present_in_directory?(identifier, options)
133
134
 
134
135
  identifying_field = options.reverse_merge!({:identifying_field => 'company_login'}).delete(:identifying_field)
135
136
 
@@ -155,7 +156,13 @@ module Socialcast
155
156
  return true if !ldap.bind_as(connection_options).blank?
156
157
  end
157
158
  return false
158
- end
159
+ end
160
+
161
+ def self.user_present_in_directory?(identifier, options)
162
+ account_info = self.fetch_account_info(identifier, options.dup)
163
+ is_user_present = !account_info.nil?
164
+ is_user_present
165
+ end
159
166
 
160
167
  # Identifying field will be something like "mail" or "sAMAccountName"
161
168
  def self.discover_base_dn(identifying_field, identifier)
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module LdapIntegration
3
- VERSION = "1.1.16"
3
+ VERSION = "1.1.17"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast_ldap_integration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.16
4
+ version: 1.1.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-28 00:00:00.000000000 Z
14
+ date: 2012-10-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: socialcast-net-ldap