Class: OmniAuth::LDAP::Adaptor
- Inherits:
-
Object
- Object
- OmniAuth::LDAP::Adaptor
- Defined in:
- lib/contour/fixes/omniauth.rb
Defined Under Namespace
Classes: AuthenticationError, ConfigurationError, ConnectionError, LdapError
Instance Attribute Summary collapse
-
#auth ⇒ Object
readonly
Returns the value of attribute auth.
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#bind_dn ⇒ Object
Returns the value of attribute bind_dn.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#password ⇒ Object
Returns the value of attribute password.
-
#uid ⇒ Object
readonly
Returns the value of attribute uid.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#auth ⇒ Object (readonly)
Returns the value of attribute auth.
56 57 58 |
# File 'lib/contour/fixes/omniauth.rb', line 56 def auth @auth end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
56 57 58 |
# File 'lib/contour/fixes/omniauth.rb', line 56 def base @base end |
#bind_dn ⇒ Object
Returns the value of attribute bind_dn.
55 56 57 |
# File 'lib/contour/fixes/omniauth.rb', line 55 def bind_dn @bind_dn end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
56 57 58 |
# File 'lib/contour/fixes/omniauth.rb', line 56 def connection @connection end |
#password ⇒ Object
Returns the value of attribute password.
55 56 57 |
# File 'lib/contour/fixes/omniauth.rb', line 55 def password @password end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
56 57 58 |
# File 'lib/contour/fixes/omniauth.rb', line 56 def uid @uid end |
Class Method Details
.validate(configuration = {}) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/contour/fixes/omniauth.rb', line 57 def self.validate(configuration={}) = [] MUST_HAVE_KEYS.each do |name| << name if configuration[name].nil? end raise ArgumentError.new(.join(",") +" MUST be provided") unless .empty? end |
Instance Method Details
#bind_as(args = {}) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/contour/fixes/omniauth.rb', line 65 def bind_as(args = {}) result = false ldap = @connection ldap.auth args[:username], args[:password] rs = ldap.search(base: args[:base], filter: Net::LDAP::Filter.eq(@uid, args[:username].split('\\').last.to_s)) result = rs.first if rs result end |