Sha256: 56b7640ea6aef7eb14cd1cd927d9828c108d672cab8098cc04163c0ea1f4a34c

Contents?: true

Size: 882 Bytes

Versions: 8

Compression:

Stored size: 882 Bytes

Contents

require 'io/console'

namespace :casino do
  namespace :authentication do
    desc 'Test authentication.'
    task test: :environment do |task, args|
      include CASino::AuthenticationProcessor
      print "Username: "
      username = STDIN.gets.chomp
      print "Password (won't be shown): "
      password = STDIN.noecho(&:gets).chomp
      2.times { puts }
      puts "Testing credentials against #{authenticators.length} authenticators"
      authenticators.each do |authenticator_name, authenticator|
        puts "'#{authenticator_name}' (#{authenticator.class}):"
        print '  '
        begin
          if data = authenticator.validate(username, password)
            p data
          else
            puts "Invalid credentials"
          end
        rescue CASino::Authenticator::AuthenticatorError => e
          puts "#{e}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
casino-4.1.2 lib/casino/tasks/authentication.rake
casino-4.1.1 lib/casino/tasks/authentication.rake
casino-4.1.0 lib/casino/tasks/authentication.rake
casino-4.0.3 lib/casino/tasks/authentication.rake
casino-4.0.2 lib/casino/tasks/authentication.rake
casino-4.0.1 lib/casino/tasks/authentication.rake
casino-4.0.0 lib/casino/tasks/authentication.rake
casino-4.0.0.pre.2 lib/casino/tasks/authentication.rake