diff --git a/.gitlab/ci/vendored-gems.gitlab-ci.yml b/.gitlab/ci/vendored-gems.gitlab-ci.yml index 11a8c6e7b803a89893bd2013b7f6f03f795c1cb4..32feec0ca0413069e4f3dda7ee7ceb2926e3f1da 100644 --- a/.gitlab/ci/vendored-gems.gitlab-ci.yml +++ b/.gitlab/ci/vendored-gems.gitlab-ci.yml @@ -11,10 +11,6 @@ include: inputs: gem_name: "microsoft_graph_mailer" gem_path_prefix: "vendor/gems/" - - local: .gitlab/ci/templates/gem.gitlab-ci.yml - inputs: - gem_name: "omniauth-azure-oauth2" - gem_path_prefix: "vendor/gems/" - local: .gitlab/ci/templates/gem.gitlab-ci.yml inputs: gem_name: "omniauth_crowd" diff --git a/Gemfile b/Gemfile index 3a67459e3d50ffcbe22db75c43c5202936704775..48e58e928a9d7f5dde985b900b03a0cff81f7ed9 100644 --- a/Gemfile +++ b/Gemfile @@ -75,7 +75,6 @@ gem 'ruby-saml', '~> 1.15.0' # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth', '~> 2.1.0' # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth-auth0', '~> 3.1' # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth-azure-activedirectory-v2', '~> 2.0' # rubocop:todo Gemfile/MissingFeatureCategory -gem 'omniauth-azure-oauth2', '~> 0.0.9', path: 'vendor/gems/omniauth-azure-oauth2' # See gem README.md # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth-dingtalk-oauth2', '~> 1.0' # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth-alicloud', '~> 3.0.0' # rubocop:todo Gemfile/MissingFeatureCategory gem 'omniauth-facebook', '~> 4.0.0' # rubocop:todo Gemfile/MissingFeatureCategory diff --git a/Gemfile.lock b/Gemfile.lock index 46b3967fb3022bd6c02b59e6250d03f7cf550243..65fcc7ccf6107f427e6be90c1024ecfdb49d0a54 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -150,14 +150,6 @@ PATH mail (~> 2.7) oauth2 (>= 1.4.4, < 3) -PATH - remote: vendor/gems/omniauth-azure-oauth2 - specs: - omniauth-azure-oauth2 (0.0.10) - jwt (>= 1.0, < 3.0) - omniauth (~> 2.0) - omniauth-oauth2 (~> 1.4) - PATH remote: vendor/gems/omniauth-gitlab specs: @@ -2132,7 +2124,6 @@ DEPENDENCIES omniauth-atlassian-oauth2 (~> 0.2.0) omniauth-auth0 (~> 3.1) omniauth-azure-activedirectory-v2 (~> 2.0) - omniauth-azure-oauth2 (~> 0.0.9)! omniauth-dingtalk-oauth2 (~> 1.0) omniauth-facebook (~> 4.0.0) omniauth-github (= 2.0.1) diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index 1c9278c2f95025c05f3cd2d710f4e09eaa6af20e..d8e220747daf3aad338bf8af36e6607ddbb694c4 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -26,9 +26,8 @@ GitLab supports the following OmniAuth providers. | [Auth0](auth0.md) | `auth0` | | [AWS Cognito](../administration/auth/cognito.md) | `cognito` | | [Azure v2](azure.md) | `azure_activedirectory_v2` | -| [Azure v1](azure.md) | `azure_oauth2` | | [Bitbucket Cloud](bitbucket.md) | `bitbucket` | -| [DingTalk](ding_talk.md) | `dingtalk` | +| [DingTalk](ding_talk.md) | `dingtalk` | | [Facebook](facebook.md) | `facebook` | | [Generic OAuth 2.0](oauth2_generic.md) | `oauth2_generic` | | [GitHub](github.md) | `github` | diff --git a/lib/gitlab/auth/o_auth/provider.rb b/lib/gitlab/auth/o_auth/provider.rb index 1f07baefa6777b8aafde36283b56de9081133230..263ff291d5d85ba83da2ad5ab033a8ee5bcf2c40 100644 --- a/lib/gitlab/auth/o_auth/provider.rb +++ b/lib/gitlab/auth/o_auth/provider.rb @@ -10,7 +10,7 @@ class Provider "github" => "GitHub", "gitlab" => "GitLab.com", "google_oauth2" => "Google", - "azure_oauth2" => "Azure AD", + "azure_oauth2" => "Azure AD (Obsolete)", "azure_activedirectory_v2" => "Azure AD v2", 'atlassian_oauth2' => 'Atlassian' }.freeze diff --git a/lib/omni_auth/strategies/azure_oauth2.rb b/lib/omni_auth/strategies/azure_oauth2.rb new file mode 100644 index 0000000000000000000000000000000000000000..4f6b8699416091c807ab56a74865600e79761424 --- /dev/null +++ b/lib/omni_auth/strategies/azure_oauth2.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module OmniAuth + module Strategies + class AzureOauth2 + include OmniAuth::Strategy + end + end +end diff --git a/vendor/gems/omniauth-azure-oauth2/.gitlab-ci.yml b/vendor/gems/omniauth-azure-oauth2/.gitlab-ci.yml deleted file mode 100644 index b49143ebd3318e5e253e2aa9bcd87617246cfc2b..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/.gitlab-ci.yml +++ /dev/null @@ -1,5 +0,0 @@ -include: - - local: gems/gem.gitlab-ci.yml - inputs: - gem_name: "omniauth-azure-oauth2" - gem_path_prefix: "vendor/gems/" diff --git a/vendor/gems/omniauth-azure-oauth2/CHANGELOG.md b/vendor/gems/omniauth-azure-oauth2/CHANGELOG.md deleted file mode 100644 index ca274303b18ecfc9dabad412b9328fbc951522af..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# Version 0.0.9 -* Expand JWT dep. Thanks @ronaldsalas - -# Version 0.0.9 -* Added support for dynamic tenant urls. Thanks @marcus-fellinger-esc - -# Version 0.0.8 -* Upgrade to omniauth-oauth2 1.4.0 and fix callback url issue -* Allow prompt parameter, thanks @hilu -* Add tenant id to info -* Updated base url - -# Version 0.0.6 -* Use 'name' from Azure for name, and 'unique_name' for nickname per Auth Hash spec. Thanks @jayme-github - -# Version 0.0.5 -* loosen jwt requirement - -# Version 0.0.5 -* loosen jwt requirement - -# VERSION 0.0.4 -* fix for JWT scoping, thanks @tobsher - -# VERSION 0.0.3 -* added common endpoint and removed mandatory requirement for tenant-id -* upgraded jwt - -# VERSION 0.0.1 - -* Initial build \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/Gemfile b/vendor/gems/omniauth-azure-oauth2/Gemfile deleted file mode 100644 index ef2f8b4147f495e580dbc794938a63642b2209c9..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://rubygems.org' - -# Specify your gem's dependencies in omniauth-azure-oauth2.gemspec -gemspec - -group :example do - gem 'sinatra' -end \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/Gemfile.lock b/vendor/gems/omniauth-azure-oauth2/Gemfile.lock deleted file mode 100644 index d2bbe3e8d2f633cfbdc0070ce0ae49f0a112e59c..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/Gemfile.lock +++ /dev/null @@ -1,74 +0,0 @@ -PATH - remote: . - specs: - omniauth-azure-oauth2 (0.0.10) - jwt (>= 1.0, < 3.0) - omniauth (~> 2.0) - omniauth-oauth2 (~> 1.4) - -GEM - remote: https://rubygems.org/ - specs: - diff-lcs (1.5.0) - faraday (2.5.2) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.0) - hashie (5.0.0) - jwt (2.4.1) - multi_xml (0.6.0) - mustermann (2.0.2) - ruby2_keywords (~> 0.0.1) - oauth2 (2.0.3) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) - multi_xml (~> 0.5) - rack (>= 1.2, < 3) - rash_alt (>= 0.4, < 1) - version_gem (~> 1.0) - omniauth (2.1.0) - hashie (>= 3.4.6) - rack (>= 2.2.3) - rack-protection - omniauth-oauth2 (1.7.3) - oauth2 (>= 1.4, < 3) - omniauth (>= 1.9, < 3) - rack (2.2.4) - rack-protection (2.2.2) - rack - rake (13.0.6) - rash_alt (0.4.12) - hashie (>= 3.4) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) - ruby2_keywords (0.0.5) - sinatra (2.2.2) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.2) - tilt (~> 2.0) - tilt (2.0.11) - version_gem (1.1.0) - -PLATFORMS - ruby - -DEPENDENCIES - omniauth-azure-oauth2! - rake - rspec (>= 2.14.0) - sinatra - -BUNDLED WITH - 2.3.21 diff --git a/vendor/gems/omniauth-azure-oauth2/LICENSE b/vendor/gems/omniauth-azure-oauth2/LICENSE deleted file mode 100644 index 57ecd3eabb99a2cf3ab371a2c74ad1380b7456b3..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2014 Deltek - -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. \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/README.md b/vendor/gems/omniauth-azure-oauth2/README.md deleted file mode 100644 index a28e9ffdfd27fdf0c8fd1acf72b8ab87f99d00aa..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/README.md +++ /dev/null @@ -1,161 +0,0 @@ -# OmniAuth Windows Azure Active Directory Strategy - -This is fork of [omniauth-azure-oauth2](https://github.com/marknadig/omniauth-azure-oauth2) to support: - -1. OmniAuth v1 and v2. OmniAuth v2 disables GET requests by default - and defaults to POST. GitLab already has patched v1 to use POST, - but other dependencies need to be updated: - https://gitlab.com/gitlab-org/gitlab/-/issues/30073. -2. We may deprecate this library entirely in the future: - https://gitlab.com/gitlab-org/gitlab/-/issues/366212 - -[](https://travis-ci.org/KonaTeam/omniauth-azure-oauth2) - -This gem provides a simple way to authenticate to Windows Azure Active Directory (WAAD) over OAuth2 using OmniAuth. - -One of the unique challenges of WAAD OAuth is that WAAD is multi tenant. Any given tenant can have multiple active -directories. The CLIENT-ID, REPLY-URL and keys will be unique to the tenant/AD/application combination. This gem simply -provides hooks for determining those unique values for each call. - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'omniauth-azure-oauth2' -``` - -## Usage - -First, you will need to add your site as an application in WAAD.: -[Adding, Updating, and Removing an Application](http://msdn.microsoft.com/en-us/library/azure/dn132599.aspx) - -Summary: -Select your Active Directory in https://manage.windowsazure.com/<tenantid> of type 'Web Application'. Name, sign-on url, -logo are not important. You will need the CLIENT-ID from the application configuration and you will need to generate -an expiring key (aka 'client secret'). REPLY URL is the oauth redirect uri which will be the omniauth callback path -https://example.com/users/auth/azure_oauth2/callback. The APP ID UI just needs to be unique to that tenant and identify -your site and isn't needed to configure the gem. -Permissions need Delegated Permissions to at least have "Enable sign-on and read user's profiles". - -Note: Seems like the terminology is still fluid, so follow the MS guidance (buwahaha) to set this up. - -The TenantInfo information can be a hash or class. It must provide client_id and client_secret. -Optionally a domain_hint and tenant_id. For a simple single-tenant app, this could be: - -```ruby -use OmniAuth::Builder do - provider :azure_oauth2, - { - client_id: ENV['AZURE_CLIENT_ID'], - client_secret: ENV['AZURE_CLIENT_SECRET'], - tenant_id: ENV['AZURE_TENANT_ID'] - } -end -``` - -Or the alternative format for use with [devise](https://github.com/plataformatec/devise): - -```ruby -config.omniauth :azure_oauth2, client_id: ENV['AZURE_CLIENT_ID'], - client_secret: ENV['AZURE_CLIENT_SECRET'], tenant_id: ENV['AZURE_TENANT_ID'] -``` - -For multi-tenant apps where you don't know the tenant_id in advance, simply leave out the tenant_id to use the -[common endpoint](http://msdn.microsoft.com/en-us/library/azure/dn645542.aspx). - -```ruby -use OmniAuth::Builder do - provider :azure_oauth2, - { - client_id: ENV['AZURE_CLIENT_ID'], - client_secret: ENV['AZURE_CLIENT_SECRET'] - } -end -``` - -For dynamic tenant assignment, pass a class that supports those same attributes and accepts the strategy as a parameter - -```ruby -class YouTenantProvider - def initialize(strategy) - @strategy = strategy - end - - def client_id - tenant.azure_client_id - end - - def client_secret - tenant.azure_client_secret - end - - def tenant_id - tenant.azure_tanant_id - end - - def domain_hint - tenant.azure_domain_hint - end - - private - - def tenant - # whatever strategy you want to figure out the right tenant from params/session - @tenant ||= Customer.find(@strategy.session[:customer_id]) - end -end - -use OmniAuth::Builder do - provider :azure_oauth2, YourTenantProvider -end -``` - -The base_azure_url can be overridden in the provider configuration for different locales; e.g. `base_azure_url: "https://login.microsoftonline.de"` - - -## Auth Hash Schema - -The following information is provided back to you for this provider: - -```ruby -{ - uid: '12345', - info: { - name: 'some one', - first_name: 'some', - last_name: 'one', - email: 'someone@example.com' - }, - credentials: { - token: 'thetoken', - refresh_token: 'refresh' - }, - extra: { raw_info: raw_api_response } -} -``` -## notes - -When you make a request to WAAD you must specify a resource. The gem currently assumes this is the AD identified as '00000002-0000-0000-c000-000000000000'. -This can be passed in as part of the config. It currently isn't designed to be dynamic. - -```ruby -use OmniAuth::Builder do - provider :azure_oauth2, TenantInfo, resource: 'myresource' -end -``` - -## Contributing - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Make your changes, add tests, run tests (`rake`) -4. Commit your changes and tests (`git commit -am 'Added some feature'`) -5. Push to the branch (`git push origin my-new-feature`) -6. Create new Pull Request - - -## Misc -Run tests `bundle exec rake` -Push to rubygems `bundle exec rake release`. - diff --git a/vendor/gems/omniauth-azure-oauth2/Rakefile b/vendor/gems/omniauth-azure-oauth2/Rakefile deleted file mode 100644 index 965431eb7c937ca8c3be777afd8fd7f54f4dae38..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/Rakefile +++ /dev/null @@ -1,6 +0,0 @@ -require File.join('bundler', 'gem_tasks') -require File.join('rspec', 'core', 'rake_task') - -RSpec::Core::RakeTask.new(:spec) - -task :default => :spec \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb b/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb deleted file mode 100644 index 3db9e5fe435e1aaecaf9e4364fab1f1136a244bf..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/examples/sinatra.rb +++ /dev/null @@ -1,31 +0,0 @@ -$:.push File.dirname(__FILE__) + '/../lib' - -require 'omniauth-azure-oauth2' -require 'sinatra' - -class MyAzureProvider - def self.client_id - ENV['AZURE_CLIENT_ID'] - end - - def self.client_secret - ENV['AZURE_CLIENT_SECRET'] - end - - def self.tenant_id - ENV['AZURE_TENANT_ID'] - end - -end - -use Rack::Session::Cookie -use OmniAuth::Strategies::Azure, MyAzureProvider - -get '/' do - "<a href='/auth/azure_oauth2'>Log in with Azure</a>" -end - -get '/auth/azure_oauth2/callback' do - content_type 'text/plain' - request.env['omniauth.auth'].inspect -end \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/lib/omniauth-azure-oauth2.rb b/vendor/gems/omniauth-azure-oauth2/lib/omniauth-azure-oauth2.rb deleted file mode 100644 index 121c26842aa7f19c1d5e772955c9bb24325cbcfd..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/lib/omniauth-azure-oauth2.rb +++ /dev/null @@ -1 +0,0 @@ -require File.join('omniauth', 'azure_oauth2') \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2.rb b/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2.rb deleted file mode 100644 index 69651ede9e7fdc524bdd448288af7c308498d8a5..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2.rb +++ /dev/null @@ -1 +0,0 @@ -require File.join('omniauth', 'strategies', 'azure_oauth2') \ No newline at end of file diff --git a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2/version.rb b/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2/version.rb deleted file mode 100644 index cfaa9ddd458d89dec61ccd477ab1295441fecf8f..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/azure_oauth2/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -module OmniAuth - module AzureOauth2 - VERSION = "0.0.10" - end -end diff --git a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/strategies/azure_oauth2.rb b/vendor/gems/omniauth-azure-oauth2/lib/omniauth/strategies/azure_oauth2.rb deleted file mode 100644 index d71911b9876c19436b88f5c8ff8ebc085a579b87..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/lib/omniauth/strategies/azure_oauth2.rb +++ /dev/null @@ -1,75 +0,0 @@ -require 'omniauth/strategies/oauth2' -require 'jwt' - -module OmniAuth - module Strategies - class AzureOauth2 < OmniAuth::Strategies::OAuth2 - BASE_AZURE_URL = 'https://login.microsoftonline.com' - - option :name, 'azure_oauth2' - - option :tenant_provider, nil - - # AD resource identifier - option :resource, '00000002-0000-0000-c000-000000000000' - - # tenant_provider must return client_id, client_secret and optionally tenant_id and base_azure_url - args [:tenant_provider] - - def client - if options.tenant_provider - provider = options.tenant_provider.new(self) - else - provider = options # if pass has to config, get mapped right on to options - end - - options.client_id = provider.client_id - options.client_secret = provider.client_secret - options.tenant_id = - provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common' - options.base_azure_url = - provider.respond_to?(:base_azure_url) ? provider.base_azure_url : BASE_AZURE_URL - - options.authorize_params = provider.authorize_params if provider.respond_to?(:authorize_params) - options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint - options.authorize_params.prompt = request.params['prompt'] if request.params['prompt'] - options.client_options.authorize_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/authorize" - options.client_options.token_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/token" - super - end - - uid { - raw_info['sub'] - } - - info do - { - name: raw_info['name'], - nickname: raw_info['unique_name'], - first_name: raw_info['given_name'], - last_name: raw_info['family_name'], - email: raw_info['email'] || raw_info['upn'], - oid: raw_info['oid'], - tid: raw_info['tid'] - } - end - - def token_params - azure_resource = request.env['omniauth.params'] && request.env['omniauth.params']['azure_resource'] - super.merge(resource: azure_resource || options.resource) - end - - # for compatibility with OmniAuth 2.0 - # see https://github.com/RIPAGlobal/omniauth-azure-activedirectory-v2/pull/6 - def callback_url - full_host + callback_path - end - - def raw_info - # it's all here in JWT http://msdn.microsoft.com/en-us/library/azure/dn195587.aspx - @raw_info ||= ::JWT.decode(access_token.token, nil, false).first - end - - end - end -end diff --git a/vendor/gems/omniauth-azure-oauth2/omniauth-azure-oauth2.gemspec b/vendor/gems/omniauth-azure-oauth2/omniauth-azure-oauth2.gemspec deleted file mode 100644 index 1299285b9450b90a0294f28ded22e1a50df1b2be..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/omniauth-azure-oauth2.gemspec +++ /dev/null @@ -1,25 +0,0 @@ -# -*- encoding: utf-8 -*- -require File.expand_path(File.join('..', 'lib', 'omniauth', 'azure_oauth2', 'version'), __FILE__) - -Gem::Specification.new do |gem| - gem.authors = ["Mark Nadig"] - gem.email = ["mark@nadigs.net"] - gem.description = %q{An Windows Azure Active Directory OAuth2 strategy for OmniAuth} - gem.summary = %q{An Windows Azure Active Directory OAuth2 strategy for OmniAuth} - gem.homepage = "https://github.com/KonaTeam/omniauth-azure-oauth2" - - gem.files = Dir.glob("lib/**/*.*") - gem.test_files = Dir.glob("spec/**/**/*.*") - gem.name = "omniauth-azure-oauth2" - gem.require_paths = ["lib"] - gem.version = OmniAuth::AzureOauth2::VERSION - gem.license = "MIT" - - gem.add_runtime_dependency 'omniauth', '~> 2.0' - gem.add_dependency 'jwt', ['>= 1.0', '< 3.0'] - - gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.4' - - gem.add_development_dependency 'rspec', '>= 2.14.0' - gem.add_development_dependency 'rake' -end diff --git a/vendor/gems/omniauth-azure-oauth2/spec/omniauth/strategies/azure_oauth2_spec.rb b/vendor/gems/omniauth-azure-oauth2/spec/omniauth/strategies/azure_oauth2_spec.rb deleted file mode 100644 index d171d88ac6c48d9cd7e1871b1f250d7b19ad6f15..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/spec/omniauth/strategies/azure_oauth2_spec.rb +++ /dev/null @@ -1,332 +0,0 @@ -require 'spec_helper' -require 'omniauth-azure-oauth2' - -module OmniAuth - module Strategies - module JWT; end - end -end - -describe OmniAuth::Strategies::AzureOauth2 do - let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) } - let(:app) { - lambda do - [200, {}, ["Hello."]] - end - } - - before do - OmniAuth.config.test_mode = true - end - - after do - OmniAuth.config.test_mode = false - end - - describe 'static configuration' do - let(:options) { @options || {} } - subject do - OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret', tenant_id: 'tenant'}.merge(options)) - end - - describe '#client' do - it 'has correct authorize url' do - allow(subject).to receive(:request) { request } - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize') - end - - it 'has correct authorize params' do - allow(subject).to receive(:request) { request } - subject.client - expect(subject.authorize_params[:domain_hint]).to be_nil - end - - it 'has correct token url' do - allow(subject).to receive(:request) { request } - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token') - end - - describe "overrides" do - it 'should override domain_hint' do - @options = {domain_hint: 'hint'} - allow(subject).to receive(:request) { request } - subject.client - expect(subject.authorize_params[:domain_hint]).to eql('hint') - end - end - end - - end - - describe 'static configuration - german' do - let(:options) { @options || {} } - subject do - OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret', tenant_id: 'tenant', base_azure_url: 'https://login.microsoftonline.de'}.merge(options)) - end - - describe '#client' do - it 'has correct authorize url' do - allow(subject).to receive(:request) { request } - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/authorize') - end - - it 'has correct authorize params' do - allow(subject).to receive(:request) { request } - subject.client - expect(subject.authorize_params[:domain_hint]).to be_nil - end - - it 'has correct token url' do - allow(subject).to receive(:request) { request } - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/token') - end - - it 'has correct token params' do - allow(subject).to receive(:request) { request } - subject.client - expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000') - end - - describe "overrides" do - it 'should override domain_hint' do - @options = {domain_hint: 'hint'} - allow(subject).to receive(:request) { request } - subject.client - expect(subject.authorize_params[:domain_hint]).to eql('hint') - end - end - end - end - - describe 'static common configuration' do - let(:options) { @options || {} } - subject do - OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret'}.merge(options)) - end - - before do - allow(subject).to receive(:request) { request } - end - - describe '#client' do - it 'has correct authorize url' do - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/common/oauth2/authorize') - end - - it 'has correct token url' do - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token') - end - end - end - - describe 'dynamic configuration' do - let(:provider_klass) { - Class.new { - def initialize(strategy) - end - - def client_id - 'id' - end - - def client_secret - 'secret' - end - - def tenant_id - 'tenant' - end - - def authorize_params - { custom_option: 'value' } - end - } - } - - subject do - OmniAuth::Strategies::AzureOauth2.new(app, provider_klass) - end - - before do - allow(subject).to receive(:request) { request } - end - - describe '#client' do - it 'has correct authorize url' do - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/authorize') - end - - it 'has correct authorize params' do - subject.client - expect(subject.authorize_params[:domain_hint]).to be_nil - expect(subject.authorize_params[:custom_option]).to eql('value') - end - - it 'has correct token url' do - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/tenant/oauth2/token') - end - - it 'has correct token params' do - subject.client - expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000') - end - - # todo: how to get this working? - # describe "overrides" do - # it 'should override domain_hint' do - # provider_klass.domain_hint = 'hint' - # subject.client - # expect(subject.authorize_params[:domain_hint]).to eql('hint') - # end - # end - end - - end - - describe 'dynamic configuration - german' do - let(:provider_klass) { - Class.new { - def initialize(strategy) - end - - def client_id - 'id' - end - - def client_secret - 'secret' - end - - def tenant_id - 'tenant' - end - - def base_azure_url - 'https://login.microsoftonline.de' - end - } - } - - subject do - OmniAuth::Strategies::AzureOauth2.new(app, provider_klass) - end - - before do - allow(subject).to receive(:request) { request } - end - - describe '#client' do - it 'has correct authorize url' do - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/authorize') - end - - it 'has correct authorize params' do - subject.client - expect(subject.authorize_params[:domain_hint]).to be_nil - end - - it 'has correct token url' do - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.de/tenant/oauth2/token') - end - - it 'has correct token params' do - subject.client - expect(subject.token_params[:resource]).to eql('00000002-0000-0000-c000-000000000000') - end - - # todo: how to get this working? - # describe "overrides" do - # it 'should override domain_hint' do - # provider_klass.domain_hint = 'hint' - # subject.client - # expect(subject.authorize_params[:domain_hint]).to eql('hint') - # end - # end - end - - end - - describe 'dynamic common configuration' do - let(:provider_klass) { - Class.new { - def initialize(strategy) - end - - def client_id - 'id' - end - - def client_secret - 'secret' - end - } - } - - subject do - OmniAuth::Strategies::AzureOauth2.new(app, provider_klass) - end - - before do - allow(subject).to receive(:request) { request } - end - - describe '#client' do - it 'has correct authorize url' do - expect(subject.client.options[:authorize_url]).to eql('https://login.microsoftonline.com/common/oauth2/authorize') - end - - it 'has correct token url' do - expect(subject.client.options[:token_url]).to eql('https://login.microsoftonline.com/common/oauth2/token') - end - end - end - - describe "raw_info" do - subject do - OmniAuth::Strategies::AzureOauth2.new(app, {client_id: 'id', client_secret: 'secret'}) - end - - let(:token) do - JWT.encode({"some" => "payload"}, "secret") - end - - let(:access_token) do - double(:token => token) - end - - before do - allow(subject).to receive(:access_token) { access_token } - allow(subject).to receive(:request) { request } - end - - it "does not clash if JWT strategy is used" do - expect do - subject.info - end.to_not raise_error - end - end - - describe 'token_params' do - let(:strategy) { OmniAuth::Strategies::AzureOauth2.new(app, client_id: 'id', client_secret: 'secret') } - let(:request) { double('Request', env: env) } - let(:env) { {} } - - subject { strategy.token_params } - - before { allow(strategy).to receive(:request).and_return request } - - it { is_expected.to be_a OmniAuth::Strategy::Options } - it 'has default resource' do - expect(subject.resource).to eq '00000002-0000-0000-c000-000000000000' - end - - context 'when custom crm url' do - let(:crm_url) { 'https://mydomain.crm.dynamics.com/' } - let(:env) { { 'omniauth.params' => { 'azure_resource' => crm_url } } } - - it 'has resource from url params' do - expect(subject.resource).to eq crm_url - end - end - end -end diff --git a/vendor/gems/omniauth-azure-oauth2/spec/spec_helper.rb b/vendor/gems/omniauth-azure-oauth2/spec/spec_helper.rb deleted file mode 100644 index 9d0890421a21b72456f2e858d3879a5b23aa7168..0000000000000000000000000000000000000000 --- a/vendor/gems/omniauth-azure-oauth2/spec/spec_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -require File.join('bundler', 'setup') -require 'rspec' \ No newline at end of file