Sha256: d6d8767586eb8f3c63f96567feccfb6094de357f276a1d648fde1d6975a437a4
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
module Castronaut module Adapters module Ldap class User begin require "net/ldap" rescue LoadError begin gem 'ruby-net-ldap', '~> 0.0.4' rescue Gem::LoadError $stderr.puts "How can you have any pudding if you don\'t install ruby-net-ldap?" exit(0) end end def self.authenticate(username, password) return false if password.blank? connection = Net::LDAP.new connection.host = Castronaut.config.cas_adapter['host'] connection.port = Castronaut.config.cas_adapter['port'] prefix = Castronaut.config.cas_adapter['prefix'] base = Castronaut.config.cas_adapter['base'] connection.authenticate("#{prefix}#{username}, #{base}", password) if connection.bind return Castronaut::AuthenticationResult.new(username, nil) else puts "#{self} - Unable to authenticate username #{username} because #{connection.get_operation_result.message} : code #{connection.get_operation_result.code}" return Castronaut::AuthenticationResult.new(username, "Unable to authenticate the username #{username}") end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relevance-castronaut-0.4.1 | lib/castronaut/adapters/ldap/user.rb |