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.
59 60 61 |
# File 'lib/contour/fixes/omniauth.rb', line 59 def auth @auth end |
#base ⇒ Object (readonly)
Returns the value of attribute base.
59 60 61 |
# File 'lib/contour/fixes/omniauth.rb', line 59 def base @base end |
#bind_dn ⇒ Object
Returns the value of attribute bind_dn.
58 59 60 |
# File 'lib/contour/fixes/omniauth.rb', line 58 def bind_dn @bind_dn end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
59 60 61 |
# File 'lib/contour/fixes/omniauth.rb', line 59 def connection @connection end |
#password ⇒ Object
Returns the value of attribute password.
58 59 60 |
# File 'lib/contour/fixes/omniauth.rb', line 58 def password @password end |
#uid ⇒ Object (readonly)
Returns the value of attribute uid.
59 60 61 |
# File 'lib/contour/fixes/omniauth.rb', line 59 def uid @uid end |
Class Method Details
.validate(configuration = {}) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/contour/fixes/omniauth.rb', line 60 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
68 69 70 71 72 73 74 75 |
# File 'lib/contour/fixes/omniauth.rb', line 68 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 |