pax_global_header00006660000000000000000000000064125443053340014515gustar00rootroot0000000000000052 comment=9c1ad34fa292d2dcc4f97a9b260638c46b16513d omniauth-kerberos-0.3.0/000077500000000000000000000000001254430533400151535ustar00rootroot00000000000000omniauth-kerberos-0.3.0/.gitignore000066400000000000000000000002321254430533400171400ustar00rootroot00000000000000*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp omniauth-kerberos-0.3.0/.travis.yml000066400000000000000000000004271254430533400172670ustar00rootroot00000000000000sudo: false language: ruby cache: bundler rvm: - '2.1' - '2.0' - 1.9.3 - rbx-2 env: global: secure: GFgbyRIlAc93IyH5clByNGS9iI/5OSaa2Ba0iGemyLR93I80qxIUNgMvXzp74YTTbGTrWyz9JPBSD14uO/3tuPYhXuawbDT0k1D/97Xm7wMhxLXZNSEATKt71g3bk/106fy+ULz6aqzQWnLkGHsvfg3vlkdyn8rX/X1HstajrcI= omniauth-kerberos-0.3.0/Gemfile000066400000000000000000000002561254430533400164510ustar00rootroot00000000000000source 'https://rubygems.org' # Specify your gem's dependencies in omniauth-kerberos.gemspec gemspec gem 'rake' gem 'rspec' gem 'rack-test' gem 'codeclimate-test-reporter' omniauth-kerberos-0.3.0/LICENSE000066400000000000000000000020541254430533400161610ustar00rootroot00000000000000Copyright (c) 2012 Jan Graichen MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.omniauth-kerberos-0.3.0/README.md000066400000000000000000000034601254430533400164350ustar00rootroot00000000000000# Omniauth::Strategies::Kerberos [![Build Status](https://travis-ci.org/jgraichen/omniauth-kerberos.svg)](https://travis-ci.org/jgraichen/omniauth-kerberos) [![Code Climate](https://codeclimate.com/github/jgraichen/omniauth-kerberos/badges/gpa.svg)](https://codeclimate.com/github/jgraichen/omniauth-kerberos) [![Test Coverage](https://codeclimate.com/github/jgraichen/omniauth-kerberos/badges/coverage.svg)](https://codeclimate.com/github/jgraichen/omniauth-kerberos/coverage) **omniauth-kerberos** is a simple [OmniAuth](https://github.com/intridea/omniauth) strategy to authenticate using a Kerberos server. **omniauth-kerberos** can be used as an authenticator for [OmniAuth MultiPassword](https://github.com/jgraichen/omniauth-multipassword). ## Installation Add this line to your application's Gemfile: gem 'omniauth-kerberos' And then execute: $ bundle Or install it yourself as: $ gem install omniauth-kerberos Kerberos development headers are required to build dependencies. On Debian try: $ sudo apt-get install libkrb5-dev ## Usage Use **omniauth-kerberos** like any other OmniAuth strategy: ```ruby Rails.application.config.middleware.use OmniAuth::Builder do provider :kerberos end ``` You still need to configure your system for Kerberos usage like specifying realms. If you has your own login form you can specify the fields to use: ```ruby Rails.application.config.middleware.use OmniAuth::Builder do provider :kerberos, :fields => [ :login, :pwd ] end ``` ## Options ** title ** The title text shown on default login form. (default: `"Restricted Access"`) ** fields ** The request parameter names to fetch username and password. (default: `[ "username", "password" ]`) ## License [MIT License](http://www.opensource.org/licenses/mit-license.php) Copyright (c) 2012, Jan Graichen omniauth-kerberos-0.3.0/Rakefile000066400000000000000000000002051254430533400166150ustar00rootroot00000000000000#!/usr/bin/env rake require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec omniauth-kerberos-0.3.0/lib/000077500000000000000000000000001254430533400157215ustar00rootroot00000000000000omniauth-kerberos-0.3.0/lib/omniauth-kerberos.rb000066400000000000000000000000471254430533400217050ustar00rootroot00000000000000require 'omniauth/strategies/kerberos' omniauth-kerberos-0.3.0/lib/omniauth/000077500000000000000000000000001254430533400175455ustar00rootroot00000000000000omniauth-kerberos-0.3.0/lib/omniauth/strategies/000077500000000000000000000000001254430533400217175ustar00rootroot00000000000000omniauth-kerberos-0.3.0/lib/omniauth/strategies/kerberos.rb000066400000000000000000000011561254430533400240630ustar00rootroot00000000000000require 'omniauth' require 'krb5_auth' require 'omniauth/multipassword/base' module OmniAuth module Strategies class Kerberos include OmniAuth::Strategy include OmniAuth::MultiPassword::Base def initialize(app, *args, &block) super @krb5 = ::Krb5Auth::Krb5.new end info do { username: username, email: username + '@' + @krb5.get_default_realm.downcase } end def authenticate(username, password) @krb5.get_init_creds_password(username, password) rescue ::Krb5Auth::Krb5::Exception false end end end end omniauth-kerberos-0.3.0/omniauth-kerberos.gemspec000066400000000000000000000013601254430533400221560ustar00rootroot00000000000000# -*- encoding: utf-8 -*- Gem::Specification.new do |gem| gem.authors = ['Jan Graichen'] gem.email = ['jan.graichen@altimos.de'] gem.description = 'An OmniAuth strategy for Kerberos.' gem.summary = 'An OmniAuth strategy for Kerberos.' gem.homepage = 'https://github.com/jgraichen/omniauth-kerberos' gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.name = 'omniauth-kerberos' gem.require_paths = ['lib'] gem.version = '0.3.0' gem.add_dependency 'timfel-krb5-auth', '~> 0.8' gem.add_dependency 'omniauth-multipassword' end omniauth-kerberos-0.3.0/spec/000077500000000000000000000000001254430533400161055ustar00rootroot00000000000000omniauth-kerberos-0.3.0/spec/omniauth/000077500000000000000000000000001254430533400177315ustar00rootroot00000000000000omniauth-kerberos-0.3.0/spec/omniauth/strategy/000077500000000000000000000000001254430533400215735ustar00rootroot00000000000000omniauth-kerberos-0.3.0/spec/omniauth/strategy/kerberos_spec.rb000066400000000000000000000023671254430533400247560ustar00rootroot00000000000000require 'spec_helper' require 'rack/test' describe OmniAuth::Strategies::Kerberos do include Rack::Test::Methods before do fake = double 'krb5' allow(::Krb5Auth::Krb5).to receive(:new).and_return fake allow(fake).to receive(:get_default_realm).and_return 'example.org' allow(fake).to receive(:get_init_creds_password) do |username, password| if username == 'john' && password == 'secret' true else fail ::Krb5Auth::Krb5::Exception end end end let(:app) do Rack::Builder.new do use OmniAuth::Test::PhonySession use OmniAuth::Strategies::Kerberos run ->(env) { [404, {}, [env['omniauth.auth']['uid'].to_s]] } end.to_app end it 'shows login FORM' do get '/auth/kerberos' expect(last_response.body).to include '