omniauth_crowd 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +6 -0
- data/Gemfile.lock +44 -27
- data/README.md +43 -0
- data/lib/omniauth/strategies/crowd.rb +14 -10
- data/lib/omniauth_crowd/version.rb +1 -1
- data/omniauth_crowd.gemspec +5 -2
- data/spec/omniauth/strategies/crowd_spec.rb +46 -57
- data/spec/spec_helper.rb +8 -7
- metadata +39 -48
- data/README.rdoc +0 -40
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 59c97cc073c410612b365745b87b17e917845178
         | 
| 4 | 
            +
              data.tar.gz: e98defefdd3a85dcb46dbcf896cdb2e3e7fa3c75
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: b2ea0383c88b06a00874e5053164c938f075b2df3ebd8b0ce0b50633d28653236d371616654d984e73c24cdc19eb4bca7626549fd2d2bd05803a8b0d6bc5fbe6
         | 
| 7 | 
            +
              data.tar.gz: 7e10ab76e6cf238e4b97e92cc9a10948eb2458ca56f9914f733a6271d7da3db1a30f4ed3e44545968c0bee3e1c5c3f945ee544dffe2b7baa7cb665d1bf30fabc
         | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,40 +1,57 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                omniauth_crowd (2.2. | 
| 4 | 
            +
                omniauth_crowd (2.2.3)
         | 
| 5 | 
            +
                  activesupport
         | 
| 5 6 | 
             
                  nokogiri (>= 1.4.4)
         | 
| 6 7 | 
             
                  omniauth (~> 1.0)
         | 
| 7 8 |  | 
| 8 9 | 
             
            GEM
         | 
| 9 10 | 
             
              remote: http://rubygems.org/
         | 
| 10 11 | 
             
              specs:
         | 
| 11 | 
            -
                 | 
| 12 | 
            -
             | 
| 13 | 
            -
                   | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
                 | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 12 | 
            +
                activesupport (4.1.4)
         | 
| 13 | 
            +
                  i18n (~> 0.6, >= 0.6.9)
         | 
| 14 | 
            +
                  json (~> 1.7, >= 1.7.7)
         | 
| 15 | 
            +
                  minitest (~> 5.1)
         | 
| 16 | 
            +
                  thread_safe (~> 0.1)
         | 
| 17 | 
            +
                  tzinfo (~> 1.1)
         | 
| 18 | 
            +
                addressable (2.3.6)
         | 
| 19 | 
            +
                crack (0.4.2)
         | 
| 20 | 
            +
                  safe_yaml (~> 1.0.0)
         | 
| 21 | 
            +
                diff-lcs (1.2.5)
         | 
| 22 | 
            +
                hashie (3.2.0)
         | 
| 23 | 
            +
                i18n (0.6.11)
         | 
| 24 | 
            +
                json (1.8.1)
         | 
| 25 | 
            +
                mini_portile (0.6.0)
         | 
| 26 | 
            +
                minitest (5.4.0)
         | 
| 27 | 
            +
                nokogiri (1.6.3.1)
         | 
| 28 | 
            +
                  mini_portile (= 0.6.0)
         | 
| 29 | 
            +
                omniauth (1.2.2)
         | 
| 30 | 
            +
                  hashie (>= 1.2, < 4)
         | 
| 31 | 
            +
                  rack (~> 1.0)
         | 
| 22 32 | 
             
                rack (1.5.2)
         | 
| 23 33 | 
             
                rack-test (0.6.2)
         | 
| 24 34 | 
             
                  rack (>= 1.0)
         | 
| 25 | 
            -
                rake (10. | 
| 26 | 
            -
                rspec ( | 
| 27 | 
            -
                  rspec-core (~>  | 
| 28 | 
            -
                  rspec-expectations (~>  | 
| 29 | 
            -
                  rspec-mocks (~>  | 
| 30 | 
            -
                rspec-core ( | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                 | 
| 36 | 
            -
                   | 
| 37 | 
            -
             | 
| 35 | 
            +
                rake (10.3.2)
         | 
| 36 | 
            +
                rspec (3.0.0)
         | 
| 37 | 
            +
                  rspec-core (~> 3.0.0)
         | 
| 38 | 
            +
                  rspec-expectations (~> 3.0.0)
         | 
| 39 | 
            +
                  rspec-mocks (~> 3.0.0)
         | 
| 40 | 
            +
                rspec-core (3.0.3)
         | 
| 41 | 
            +
                  rspec-support (~> 3.0.0)
         | 
| 42 | 
            +
                rspec-expectations (3.0.3)
         | 
| 43 | 
            +
                  diff-lcs (>= 1.2.0, < 2.0)
         | 
| 44 | 
            +
                  rspec-support (~> 3.0.0)
         | 
| 45 | 
            +
                rspec-mocks (3.0.3)
         | 
| 46 | 
            +
                  rspec-support (~> 3.0.0)
         | 
| 47 | 
            +
                rspec-support (3.0.3)
         | 
| 48 | 
            +
                safe_yaml (1.0.3)
         | 
| 49 | 
            +
                thread_safe (0.3.4)
         | 
| 50 | 
            +
                tzinfo (1.2.2)
         | 
| 51 | 
            +
                  thread_safe (~> 0.1)
         | 
| 52 | 
            +
                webmock (1.18.0)
         | 
| 53 | 
            +
                  addressable (>= 2.3.6)
         | 
| 54 | 
            +
                  crack (>= 0.3.2)
         | 
| 38 55 |  | 
| 39 56 | 
             
            PLATFORMS
         | 
| 40 57 | 
             
              ruby
         | 
| @@ -45,5 +62,5 @@ DEPENDENCIES | |
| 45 62 | 
             
              rack
         | 
| 46 63 | 
             
              rack-test
         | 
| 47 64 | 
             
              rake
         | 
| 48 | 
            -
              rspec (~>  | 
| 49 | 
            -
              webmock | 
| 65 | 
            +
              rspec (~> 3.0.0)
         | 
| 66 | 
            +
              webmock
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            # omniauth_crowd
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            The omniauth_crowd library is an OmniAuth provider that supports authentication against Atlassian Crowd REST apis.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [](https://travis-ci.org/robdimarco/omniauth_crowd)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            ## Helpful links
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            *	[Documentation](http://github.com/robdimarco/omniauth_crow)
         | 
| 10 | 
            +
            *	[OmniAuth](https://github.com/intridea/omniauth/)
         | 
| 11 | 
            +
            * [Atlassian Crowd](http://www.atlassian.com/software/crowd/)
         | 
| 12 | 
            +
            * [Atlassian Crowd REST API](http://confluence.atlassian.com/display/CROWDDEV/Crowd+REST+APIs)
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            ## Install and use
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            ### 1. Add the OmniAuth Crowd REST plugin to your Gemfile
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                gem 'omniauth', '>= 1.0.0'  # We depend on this
         | 
| 19 | 
            +
                gem "omniauth_crowd"
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ### 2. You will need to configure OmniAuth to use your crowd authentication.  This is generally done in Rails in the config/initializers/omniauth.rb with...
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                Rails.application.config.middleware.use OmniAuth::Builder do
         | 
| 24 | 
            +
                  provider :crowd, :crowd_server_url=>"https://crowd.mycompanyname.com/crowd", :application_name=>"app", :application_password=>"password"
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            You will need to supply the correct server URL, application name and password
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ## Contributing to omniauth_crowd
         | 
| 30 | 
            +
             
         | 
| 31 | 
            +
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
         | 
| 32 | 
            +
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
         | 
| 33 | 
            +
            * Fork the project
         | 
| 34 | 
            +
            * Start a feature/bugfix branch
         | 
| 35 | 
            +
            * Commit and push until you are happy with your contribution
         | 
| 36 | 
            +
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 37 | 
            +
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            ## Copyright
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            Copyright (c) 2011-14 Rob Di Marco. See LICENSE.txt for
         | 
| 42 | 
            +
            further details.
         | 
| 43 | 
            +
             | 
| @@ -1,52 +1,56 @@ | |
| 1 1 | 
             
            require 'omniauth'
         | 
| 2 | 
            -
             | 
| 2 | 
            +
            require 'active_support'
         | 
| 3 | 
            +
            require 'active_support/core_ext/object'
         | 
| 3 4 | 
             
            module OmniAuth
         | 
| 4 5 | 
             
              module Strategies
         | 
| 5 6 | 
             
                class Crowd
         | 
| 6 7 | 
             
                  include OmniAuth::Strategy
         | 
| 7 | 
            -
             | 
| 8 | 
            +
             | 
| 8 9 | 
             
                  autoload :Configuration, 'omniauth/strategies/crowd/configuration'
         | 
| 9 10 | 
             
                  autoload :CrowdValidator, 'omniauth/strategies/crowd/crowd_validator'
         | 
| 10 11 | 
             
                  def initialize(app, options = {}, &block)
         | 
| 12 | 
            +
                    options.symbolize_keys!()
         | 
| 11 13 | 
             
                    super(app, {:name=> :crowd}.merge(options), &block)
         | 
| 12 14 | 
             
                    @configuration = OmniAuth::Strategies::Crowd::Configuration.new(options)
         | 
| 13 15 | 
             
                  end
         | 
| 14 | 
            -
             | 
| 16 | 
            +
             | 
| 15 17 | 
             
                  protected
         | 
| 16 18 |  | 
| 17 19 | 
             
                  def request_phase
         | 
| 18 20 | 
             
                    if env['REQUEST_METHOD'] == 'GET'
         | 
| 19 21 | 
             
                      get_credentials
         | 
| 22 | 
            +
                    elsif (env['REQUEST_METHOD'] == 'POST') && (not request.params['username'])
         | 
| 23 | 
            +
                      get_credentials
         | 
| 20 24 | 
             
                    else
         | 
| 21 25 | 
             
                      session['omniauth.crowd'] = {'username' => request['username'], 'password' => request['password']}
         | 
| 22 26 | 
             
                      redirect callback_url
         | 
| 23 27 | 
             
                    end
         | 
| 24 28 | 
             
                  end
         | 
| 25 | 
            -
             | 
| 29 | 
            +
             | 
| 26 30 | 
             
                  def get_credentials
         | 
| 27 31 | 
             
                    OmniAuth::Form.build(:title => (options[:title] || "Crowd Authentication")) do
         | 
| 28 32 | 
             
                      text_field 'Login', 'username'
         | 
| 29 33 | 
             
                      password_field 'Password', 'password'
         | 
| 30 34 | 
             
                    end.to_response
         | 
| 31 35 | 
             
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  def callback_phase | 
| 36 | 
            +
             | 
| 37 | 
            +
                  def callback_phase
         | 
| 34 38 | 
             
                    creds = session.delete 'omniauth.crowd'
         | 
| 35 39 | 
             
                    return fail!(:no_credentials) unless creds
         | 
| 36 40 | 
             
                    validator = CrowdValidator.new(@configuration, creds['username'], creds['password'])
         | 
| 37 41 | 
             
                    @user_info = validator.user_info
         | 
| 38 | 
            -
             | 
| 42 | 
            +
             | 
| 39 43 | 
             
                    return fail!(:invalid_credentials) if @user_info.nil? || @user_info.empty?
         | 
| 40 | 
            -
             | 
| 44 | 
            +
             | 
| 41 45 | 
             
                    super
         | 
| 42 46 | 
             
                  end
         | 
| 43 | 
            -
             | 
| 47 | 
            +
             | 
| 44 48 | 
             
                  def auth_hash
         | 
| 45 49 | 
             
                    OmniAuth::Utils.deep_merge(super, {
         | 
| 46 50 | 
             
                      'uid' => @user_info.delete("user"),
         | 
| 47 51 | 
             
                      'info' => @user_info
         | 
| 48 52 | 
             
                    })
         | 
| 49 | 
            -
                  end | 
| 53 | 
            +
                  end
         | 
| 50 54 | 
             
                end
         | 
| 51 55 | 
             
              end
         | 
| 52 56 | 
             
            end
         | 
    
        data/omniauth_crowd.gemspec
    CHANGED
    
    | @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 2 2 | 
             
            require File.expand_path('../lib/omniauth_crowd/version', __FILE__)
         | 
| 3 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 4 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 3 5 |  | 
| 4 6 | 
             
            Gem::Specification.new do |gem|
         | 
| 5 7 | 
             
              gem.authors = ["Robert Di Marco"]
         | 
| @@ -17,10 +19,11 @@ Gem::Specification.new do |gem| | |
| 17 19 |  | 
| 18 20 | 
             
              gem.add_dependency 'omniauth', '~> 1.0'
         | 
| 19 21 | 
             
              gem.add_dependency 'nokogiri', '>= 1.4.4'
         | 
| 22 | 
            +
              gem.add_dependency 'activesupport', '>= 0'
         | 
| 20 23 | 
             
              gem.add_development_dependency(%q<rack>, [">= 0"])
         | 
| 21 24 | 
             
              gem.add_development_dependency(%q<rake>, [">= 0"])
         | 
| 22 25 | 
             
              gem.add_development_dependency(%q<rack-test>, [">= 0"])
         | 
| 23 | 
            -
              gem.add_development_dependency(%q<rspec>, ["~>  | 
| 24 | 
            -
              gem.add_development_dependency(%q<webmock | 
| 26 | 
            +
              gem.add_development_dependency(%q<rspec>, ["~> 3.0.0"])
         | 
| 27 | 
            +
              gem.add_development_dependency(%q<webmock>)
         | 
| 25 28 | 
             
              gem.add_development_dependency(%q<bundler>, ["> 1.0.0"])
         | 
| 26 29 | 
             
            end
         | 
| @@ -1,8 +1,7 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            describe OmniAuth::Strategies::Crowd, :type=>:strategy do
         | 
| 4 4 | 
             
              include OmniAuth::Test::StrategyTestCase
         | 
| 5 | 
            -
              @use_sessions = false
         | 
| 6 5 | 
             
              def strategy
         | 
| 7 6 | 
             
                @crowd_server_url ||= 'https://crowd.example.org'
         | 
| 8 7 | 
             
                @application_name ||= 'bogus_app'
         | 
| @@ -10,85 +9,76 @@ describe OmniAuth::Strategies::Crowd, :type=>:strategy do | |
| 10 9 | 
             
                [OmniAuth::Strategies::Crowd, {:crowd_server_url => @crowd_server_url,
         | 
| 11 10 | 
             
                                                :application_name => @application_name,
         | 
| 12 11 | 
             
                                                :application_password => @application_password,
         | 
| 13 | 
            -
                                                :use_sessions => @ | 
| 12 | 
            +
                                                :use_sessions => @using_sessions}]
         | 
| 14 13 | 
             
              end
         | 
| 15 14 |  | 
| 15 | 
            +
              @using_sessions = false
         | 
| 16 | 
            +
              let(:config) { OmniAuth::Strategies::Crowd::Configuration.new(strategy[1]) }
         | 
| 17 | 
            +
              let(:validator) { OmniAuth::Strategies::Crowd::CrowdValidator.new(config, 'foo', 'bar') }
         | 
| 18 | 
            +
             | 
| 16 19 | 
             
              describe 'Authentication Request Body' do
         | 
| 17 | 
            -
                before do
         | 
| 18 | 
            -
                  config = OmniAuth::Strategies::Crowd::Configuration.new(strategy[1])
         | 
| 19 | 
            -
                  @validator = OmniAuth::Strategies::Crowd::CrowdValidator.new(config, 'foo', 'bar')
         | 
| 20 | 
            -
                end
         | 
| 21 20 |  | 
| 22 21 | 
             
                it 'should send password in session request' do
         | 
| 23 | 
            -
                   | 
| 22 | 
            +
                  body = <<-BODY.strip
         | 
| 24 23 | 
             
            <password>
         | 
| 25 24 | 
             
              <value>bar</value>
         | 
| 26 25 | 
             
            </password>
         | 
| 27 26 | 
             
            BODY
         | 
| 27 | 
            +
                  expect(validator.send(:make_authentication_request_body, 'bar')).to eq(body)
         | 
| 28 28 | 
             
                end
         | 
| 29 29 |  | 
| 30 30 | 
             
                it 'should escape special characters username and password in session request' do
         | 
| 31 | 
            -
                   | 
| 31 | 
            +
                  body = <<-BODY.strip
         | 
| 32 32 | 
             
            <password>
         | 
| 33 33 | 
             
              <value>bar<</value>
         | 
| 34 34 | 
             
            </password>
         | 
| 35 35 | 
             
            BODY
         | 
| 36 | 
            +
                  expect(validator.send(:make_authentication_request_body, 'bar<')).to eq(body)
         | 
| 36 37 | 
             
                end
         | 
| 37 38 | 
             
              end
         | 
| 38 39 |  | 
| 39 40 | 
             
              describe 'Session Request Body' do
         | 
| 40 | 
            -
                before do
         | 
| 41 | 
            -
                  config = OmniAuth::Strategies::Crowd::Configuration.new(strategy[1])
         | 
| 42 | 
            -
                  @validator = OmniAuth::Strategies::Crowd::CrowdValidator.new(config, 'foo', 'bar')
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
             | 
| 45 41 | 
             
                it 'should send username and password in session request' do
         | 
| 46 | 
            -
                   | 
| 42 | 
            +
                  body = <<-BODY.strip
         | 
| 47 43 | 
             
            <authentication-context>
         | 
| 48 44 | 
             
              <username>foo</username>
         | 
| 49 45 | 
             
              <password>bar</password>
         | 
| 50 46 | 
             
            </authentication-context>
         | 
| 51 47 | 
             
            BODY
         | 
| 48 | 
            +
                  expect(validator.send(:make_session_request_body, 'foo', 'bar')).to eq(body)
         | 
| 52 49 | 
             
                end
         | 
| 53 50 |  | 
| 54 51 | 
             
                it 'should escape special characters username and password in session request' do
         | 
| 55 | 
            -
                   | 
| 52 | 
            +
                  body = <<-BODY.strip
         | 
| 56 53 | 
             
            <authentication-context>
         | 
| 57 54 | 
             
              <username>foo</username>
         | 
| 58 55 | 
             
              <password>bar<</password>
         | 
| 59 56 | 
             
            </authentication-context>
         | 
| 60 57 | 
             
            BODY
         | 
| 58 | 
            +
                  expect(validator.send(:make_session_request_body, 'foo', 'bar<')).to eq(body)
         | 
| 61 59 | 
             
                end
         | 
| 62 60 | 
             
              end
         | 
| 63 61 |  | 
| 64 62 | 
             
              describe 'GET /auth/crowd' do
         | 
| 65 | 
            -
                before do
         | 
| 66 | 
            -
                  get '/auth/crowd'
         | 
| 67 | 
            -
                end
         | 
| 68 | 
            -
             | 
| 69 63 | 
             
                it 'should show the login form' do
         | 
| 70 | 
            -
                   | 
| 64 | 
            +
                  get '/auth/crowd'
         | 
| 65 | 
            +
                  expect(last_response).to be_ok
         | 
| 71 66 | 
             
                end
         | 
| 72 67 | 
             
              end
         | 
| 73 68 |  | 
| 74 69 | 
             
              describe 'POST /auth/crowd' do
         | 
| 75 | 
            -
                before do
         | 
| 76 | 
            -
                  post '/auth/crowd', :username=>'foo', :password=>'bar'
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 70 | 
             
                it 'should redirect to callback' do
         | 
| 80 | 
            -
                   | 
| 81 | 
            -
                  last_response. | 
| 71 | 
            +
                  post '/auth/crowd', :username=>'foo', :password=>'bar'
         | 
| 72 | 
            +
                  expect(last_response).to be_redirect
         | 
| 73 | 
            +
                  expect(last_response.headers['Location']).to eq('http://example.org/auth/crowd/callback')
         | 
| 82 74 | 
             
                end
         | 
| 83 75 | 
             
              end
         | 
| 84 76 |  | 
| 85 77 | 
             
              describe 'GET /auth/crowd/callback without any credentials' do
         | 
| 86 | 
            -
                before do
         | 
| 87 | 
            -
                  get '/auth/crowd/callback'
         | 
| 88 | 
            -
                end
         | 
| 89 78 | 
             
                it 'should fail' do
         | 
| 90 | 
            -
                   | 
| 91 | 
            -
                  last_response. | 
| 79 | 
            +
                  get '/auth/crowd/callback'
         | 
| 80 | 
            +
                  expect(last_response).to be_redirect
         | 
| 81 | 
            +
                  expect(last_response.headers['Location']).to match(/no_credentials/)
         | 
| 92 82 | 
             
                end
         | 
| 93 83 | 
             
              end
         | 
| 94 84 |  | 
| @@ -107,53 +97,52 @@ BODY | |
| 107 97 | 
             
                    get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 108 98 | 
             
                  end
         | 
| 109 99 | 
             
                  it 'should call through to the master app' do
         | 
| 110 | 
            -
                    last_response.body. | 
| 100 | 
            +
                    expect(last_response.body).to eq('true')
         | 
| 111 101 | 
             
                  end
         | 
| 112 102 | 
             
                  it 'should have an auth hash' do
         | 
| 113 103 | 
             
                    auth = last_request.env['omniauth.auth']
         | 
| 114 | 
            -
                    auth. | 
| 104 | 
            +
                    expect(auth).to be_kind_of(Hash)
         | 
| 115 105 | 
             
                  end
         | 
| 116 106 | 
             
                  it 'should have good data' do
         | 
| 117 107 | 
             
                    auth = last_request.env['omniauth.auth']
         | 
| 118 | 
            -
                    auth['provider']. | 
| 119 | 
            -
                    auth['uid']. | 
| 120 | 
            -
                    auth['info']. | 
| 121 | 
            -
                    auth['info']['groups'].sort. | 
| 108 | 
            +
                    expect(auth['provider']).to eq(:crowd)
         | 
| 109 | 
            +
                    expect(auth['uid']).to eq('foo')
         | 
| 110 | 
            +
                    expect(auth['info']).to be_kind_of(Hash)
         | 
| 111 | 
            +
                    expect(auth['info']['groups'].sort).to eq(["Developers", "jira-users"].sort)
         | 
| 122 112 | 
             
                  end
         | 
| 123 113 | 
             
                end
         | 
| 124 114 |  | 
| 125 | 
            -
                 | 
| 115 | 
            +
                describe "when using session endpoint" do
         | 
| 126 116 | 
             
                  before do
         | 
| 127 | 
            -
                    @ | 
| 117 | 
            +
                    @using_sessions = true
         | 
| 128 118 | 
             
                    stub_request(:post, "https://bogus_app:bogus_app_password@crowd.example.org/rest/usermanagement/latest/authentication?username=foo").
         | 
| 129 | 
            -
             | 
| 119 | 
            +
                      to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'success.xml')))
         | 
| 130 120 | 
             
                    stub_request(:post, "https://bogus_app:bogus_app_password@crowd.example.org/rest/usermanagement/latest/session").
         | 
| 131 | 
            -
             | 
| 121 | 
            +
                      to_return(:status => 201, :body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'session.xml')))
         | 
| 132 122 | 
             
                    stub_request(:get, "https://bogus_app:bogus_app_password@crowd.example.org/rest/usermanagement/latest/user/group/direct?username=foo").
         | 
| 133 | 
            -
             | 
| 134 | 
            -
                    get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 123 | 
            +
                      to_return(:body => File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'groups.xml')))
         | 
| 135 124 | 
             
                  end
         | 
| 136 125 |  | 
| 137 | 
            -
                  after  | 
| 138 | 
            -
                    @use_sessions = false
         | 
| 139 | 
            -
                  end
         | 
| 126 | 
            +
                  after { @using_sessions = false }
         | 
| 140 127 |  | 
| 141 128 | 
             
                  it 'should call through to the master app' do
         | 
| 142 | 
            -
                     | 
| 129 | 
            +
                    get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 130 | 
            +
                    expect(last_response.body).to eq('true')
         | 
| 143 131 | 
             
                  end
         | 
| 144 132 |  | 
| 145 133 | 
             
                  it 'should have an auth hash' do
         | 
| 146 | 
            -
                    auth  | 
| 147 | 
            -
                    auth. | 
| 134 | 
            +
                    get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 135 | 
            +
                    expect(last_request.env['omniauth.auth']).to be_kind_of(Hash)
         | 
| 148 136 | 
             
                  end
         | 
| 149 137 |  | 
| 150 138 | 
             
                  it 'should have good data' do
         | 
| 139 | 
            +
                    get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 151 140 | 
             
                    auth = last_request.env['omniauth.auth']
         | 
| 152 | 
            -
                    auth['provider']. | 
| 153 | 
            -
                    auth['uid']. | 
| 154 | 
            -
                    auth['info']. | 
| 155 | 
            -
                    auth['info']['sso_token']. | 
| 156 | 
            -
                    auth['info']['groups'].sort. | 
| 141 | 
            +
                    expect(auth['provider']).to eq(:crowd)
         | 
| 142 | 
            +
                    expect(auth['uid']).to eq('foo')
         | 
| 143 | 
            +
                    expect(auth['info']).to be_kind_of(Hash)
         | 
| 144 | 
            +
                    expect(auth['info']['sso_token']).to eq('rtk8eMvqq00EiGn5iJCMZQ00')
         | 
| 145 | 
            +
                    expect(auth['info']['groups'].sort).to eq(["Developers", "jira-users"].sort)
         | 
| 157 146 | 
             
                  end
         | 
| 158 147 | 
             
                end
         | 
| 159 148 | 
             
              end
         | 
| @@ -165,8 +154,8 @@ BODY | |
| 165 154 | 
             
                  get '/auth/crowd/callback', nil, 'rack.session'=>{'omniauth.crowd'=> {"username"=>"foo", "password"=>"ba"}}
         | 
| 166 155 | 
             
                end
         | 
| 167 156 | 
             
                it 'should fail' do
         | 
| 168 | 
            -
                  last_response. | 
| 169 | 
            -
                  last_response.headers['Location']. | 
| 157 | 
            +
                  expect(last_response).to be_redirect
         | 
| 158 | 
            +
                  expect(last_response.headers['Location']).to match(/invalid_credentials/)
         | 
| 170 159 | 
             
                end
         | 
| 171 160 | 
             
              end
         | 
| 172 161 | 
             
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -1,12 +1,13 @@ | |
| 1 | 
            -
            require ' | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'rspec/autorun'
         | 
| 1 | 
            +
            require 'bundler/setup'
         | 
| 2 | 
            +
            Bundler.setup
         | 
| 4 3 | 
             
            require 'rack/test'
         | 
| 4 | 
            +
            require 'webmock'
         | 
| 5 5 | 
             
            require 'webmock/rspec'
         | 
| 6 6 |  | 
| 7 | 
            -
            include Rack::Test::Methods
         | 
| 8 | 
            -
            include WebMock
         | 
| 9 | 
            -
             | 
| 10 7 | 
             
            require 'omniauth_crowd'
         | 
| 8 | 
            +
            RSpec.configure do |config|
         | 
| 9 | 
            +
              WebMock.disable_net_connect!
         | 
| 10 | 
            +
              config.include Rack::Test::Methods
         | 
| 11 | 
            +
              config.raise_errors_for_deprecations!
         | 
| 12 | 
            +
            end
         | 
| 11 13 |  | 
| 12 | 
            -
            WebMock.disable_net_connect!
         | 
    
        metadata
    CHANGED
    
    | @@ -1,20 +1,18 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: omniauth_crowd
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.2. | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              version: 2.2.3
         | 
| 6 5 | 
             
            platform: ruby
         | 
| 7 6 | 
             
            authors:
         | 
| 8 7 | 
             
            - Robert Di Marco
         | 
| 9 8 | 
             
            autorequire: 
         | 
| 10 9 | 
             
            bindir: bin
         | 
| 11 10 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-05-28 00:00:00.000000000 Z
         | 
| 13 12 | 
             
            dependencies:
         | 
| 14 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 14 | 
             
              name: omniauth
         | 
| 16 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 | 
            -
                none: false
         | 
| 18 16 | 
             
                requirements:
         | 
| 19 17 | 
             
                - - ~>
         | 
| 20 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -22,7 +20,6 @@ dependencies: | |
| 22 20 | 
             
              type: :runtime
         | 
| 23 21 | 
             
              prerelease: false
         | 
| 24 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            -
                none: false
         | 
| 26 23 | 
             
                requirements:
         | 
| 27 24 | 
             
                - - ~>
         | 
| 28 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| @@ -30,113 +27,113 @@ dependencies: | |
| 30 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 28 | 
             
              name: nokogiri
         | 
| 32 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            -
                none: false
         | 
| 34 30 | 
             
                requirements:
         | 
| 35 | 
            -
                - -  | 
| 31 | 
            +
                - - '>='
         | 
| 36 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 37 33 | 
             
                    version: 1.4.4
         | 
| 38 34 | 
             
              type: :runtime
         | 
| 39 35 | 
             
              prerelease: false
         | 
| 40 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            -
                none: false
         | 
| 42 37 | 
             
                requirements:
         | 
| 43 | 
            -
                - -  | 
| 38 | 
            +
                - - '>='
         | 
| 44 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 40 | 
             
                    version: 1.4.4
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: activesupport
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - '>='
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :runtime
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - '>='
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 46 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 47 56 | 
             
              name: rack
         | 
| 48 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                none: false
         | 
| 50 58 | 
             
                requirements:
         | 
| 51 | 
            -
                - -  | 
| 59 | 
            +
                - - '>='
         | 
| 52 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 53 61 | 
             
                    version: '0'
         | 
| 54 62 | 
             
              type: :development
         | 
| 55 63 | 
             
              prerelease: false
         | 
| 56 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 57 | 
            -
                none: false
         | 
| 58 65 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 66 | 
            +
                - - '>='
         | 
| 60 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 68 | 
             
                    version: '0'
         | 
| 62 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 63 70 | 
             
              name: rake
         | 
| 64 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                none: false
         | 
| 66 72 | 
             
                requirements:
         | 
| 67 | 
            -
                - -  | 
| 73 | 
            +
                - - '>='
         | 
| 68 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 69 75 | 
             
                    version: '0'
         | 
| 70 76 | 
             
              type: :development
         | 
| 71 77 | 
             
              prerelease: false
         | 
| 72 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 73 | 
            -
                none: false
         | 
| 74 79 | 
             
                requirements:
         | 
| 75 | 
            -
                - -  | 
| 80 | 
            +
                - - '>='
         | 
| 76 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 77 82 | 
             
                    version: '0'
         | 
| 78 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 79 84 | 
             
              name: rack-test
         | 
| 80 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 81 | 
            -
                none: false
         | 
| 82 86 | 
             
                requirements:
         | 
| 83 | 
            -
                - -  | 
| 87 | 
            +
                - - '>='
         | 
| 84 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 85 89 | 
             
                    version: '0'
         | 
| 86 90 | 
             
              type: :development
         | 
| 87 91 | 
             
              prerelease: false
         | 
| 88 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 89 | 
            -
                none: false
         | 
| 90 93 | 
             
                requirements:
         | 
| 91 | 
            -
                - -  | 
| 94 | 
            +
                - - '>='
         | 
| 92 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 93 96 | 
             
                    version: '0'
         | 
| 94 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 95 98 | 
             
              name: rspec
         | 
| 96 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 97 | 
            -
                none: false
         | 
| 98 100 | 
             
                requirements:
         | 
| 99 101 | 
             
                - - ~>
         | 
| 100 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 101 | 
            -
                    version:  | 
| 103 | 
            +
                    version: 3.0.0
         | 
| 102 104 | 
             
              type: :development
         | 
| 103 105 | 
             
              prerelease: false
         | 
| 104 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 105 | 
            -
                none: false
         | 
| 106 107 | 
             
                requirements:
         | 
| 107 108 | 
             
                - - ~>
         | 
| 108 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 109 | 
            -
                    version:  | 
| 110 | 
            +
                    version: 3.0.0
         | 
| 110 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 111 112 | 
             
              name: webmock
         | 
| 112 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 | 
            -
                none: false
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 | 
            -
                - -  | 
| 115 | 
            +
                - - '>='
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version:  | 
| 117 | 
            +
                    version: '0'
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                none: false
         | 
| 122 121 | 
             
                requirements:
         | 
| 123 | 
            -
                - -  | 
| 122 | 
            +
                - - '>='
         | 
| 124 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 125 | 
            -
                    version:  | 
| 124 | 
            +
                    version: '0'
         | 
| 126 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 127 126 | 
             
              name: bundler
         | 
| 128 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 129 | 
            -
                none: false
         | 
| 130 128 | 
             
                requirements:
         | 
| 131 | 
            -
                - -  | 
| 129 | 
            +
                - - '>'
         | 
| 132 130 | 
             
                  - !ruby/object:Gem::Version
         | 
| 133 131 | 
             
                    version: 1.0.0
         | 
| 134 132 | 
             
              type: :development
         | 
| 135 133 | 
             
              prerelease: false
         | 
| 136 134 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            -
                none: false
         | 
| 138 135 | 
             
                requirements:
         | 
| 139 | 
            -
                - -  | 
| 136 | 
            +
                - - '>'
         | 
| 140 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 141 138 | 
             
                    version: 1.0.0
         | 
| 142 139 | 
             
            description: This is an OmniAuth provider for Atlassian Crowd's REST API.  It allows
         | 
| @@ -149,10 +146,11 @@ extra_rdoc_files: [] | |
| 149 146 | 
             
            files:
         | 
| 150 147 | 
             
            - .document
         | 
| 151 148 | 
             
            - .gitignore
         | 
| 149 | 
            +
            - .travis.yml
         | 
| 152 150 | 
             
            - Gemfile
         | 
| 153 151 | 
             
            - Gemfile.lock
         | 
| 154 152 | 
             
            - LICENSE.txt
         | 
| 155 | 
            -
            - README. | 
| 153 | 
            +
            - README.md
         | 
| 156 154 | 
             
            - Rakefile
         | 
| 157 155 | 
             
            - lib/omniauth/strategies/crowd.rb
         | 
| 158 156 | 
             
            - lib/omniauth/strategies/crowd/configuration.rb
         | 
| @@ -167,33 +165,26 @@ files: | |
| 167 165 | 
             
            - spec/spec_helper.rb
         | 
| 168 166 | 
             
            homepage: http://github.com/robdimarco/omniauth_crowd
         | 
| 169 167 | 
             
            licenses: []
         | 
| 168 | 
            +
            metadata: {}
         | 
| 170 169 | 
             
            post_install_message: 
         | 
| 171 170 | 
             
            rdoc_options: []
         | 
| 172 171 | 
             
            require_paths:
         | 
| 173 172 | 
             
            - lib
         | 
| 174 173 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 175 | 
            -
              none: false
         | 
| 176 174 | 
             
              requirements:
         | 
| 177 | 
            -
              - -  | 
| 175 | 
            +
              - - '>='
         | 
| 178 176 | 
             
                - !ruby/object:Gem::Version
         | 
| 179 177 | 
             
                  version: '0'
         | 
| 180 | 
            -
                  segments:
         | 
| 181 | 
            -
                  - 0
         | 
| 182 | 
            -
                  hash: 676627675687607674
         | 
| 183 178 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 184 | 
            -
              none: false
         | 
| 185 179 | 
             
              requirements:
         | 
| 186 | 
            -
              - -  | 
| 180 | 
            +
              - - '>='
         | 
| 187 181 | 
             
                - !ruby/object:Gem::Version
         | 
| 188 182 | 
             
                  version: '0'
         | 
| 189 | 
            -
                  segments:
         | 
| 190 | 
            -
                  - 0
         | 
| 191 | 
            -
                  hash: 676627675687607674
         | 
| 192 183 | 
             
            requirements: []
         | 
| 193 184 | 
             
            rubyforge_project: 
         | 
| 194 | 
            -
            rubygems_version:  | 
| 185 | 
            +
            rubygems_version: 2.2.2
         | 
| 195 186 | 
             
            signing_key: 
         | 
| 196 | 
            -
            specification_version:  | 
| 187 | 
            +
            specification_version: 4
         | 
| 197 188 | 
             
            summary: An OmniAuth provider for Atlassian Crowd REST API
         | 
| 198 189 | 
             
            test_files:
         | 
| 199 190 | 
             
            - spec/fixtures/groups.xml
         | 
    
        data/README.rdoc
    DELETED
    
    | @@ -1,40 +0,0 @@ | |
| 1 | 
            -
            = omniauth_crowd
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            The omniauth_crowd library is an OmniAuth provider that supports authentication against Atlassian Crowd REST apis.
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            == Helpful links
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            *	<b>Documentation:</b> http://github.com/robdimarco/omniauth_crowd
         | 
| 8 | 
            -
            *	<b>OmniAuth:</b> https://github.com/intridea/omniauth/
         | 
| 9 | 
            -
            *   <b>Atlassian Crowd:</b> http://www.atlassian.com/software/crowd/
         | 
| 10 | 
            -
            *   <b>Atlassian Crowd REST API:</b> http://confluence.atlassian.com/display/CROWDDEV/Crowd+REST+APIs
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            == Install and use
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            === 1. Add the OmniAuth Crowd REST plugin to your Gemfile
         | 
| 15 | 
            -
              gem 'omniauth', '>= 1.0.0'  # We depend on this
         | 
| 16 | 
            -
              gem "omniauth_crowd"
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            === 2. You will need to configure OmniAuth to use your crowd authentication.  This is generally done in Rails in the config/initializers/omniauth.rb with...
         | 
| 19 | 
            -
             | 
| 20 | 
            -
              Rails.application.config.middleware.use OmniAuth::Builder do
         | 
| 21 | 
            -
                provider :crowd, :crowd_server_url=>"https://crowd.mycompanyname.com/crowd", :application_name=>"app", :application_password=>"password"
         | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            You will need to supply the correct server URL, application name and password
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            == Contributing to omniauth_crowd
         | 
| 27 | 
            -
             
         | 
| 28 | 
            -
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
         | 
| 29 | 
            -
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
         | 
| 30 | 
            -
            * Fork the project
         | 
| 31 | 
            -
            * Start a feature/bugfix branch
         | 
| 32 | 
            -
            * Commit and push until you are happy with your contribution
         | 
| 33 | 
            -
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 34 | 
            -
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            == Copyright
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            Copyright (c) 2011 Rob Di Marco. See LICENSE.txt for
         | 
| 39 | 
            -
            further details.
         | 
| 40 | 
            -
             |