Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for OmniAuth 2.0 series #6

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

jessieay
Copy link
Contributor

@jessieay jessieay commented Sep 7, 2022

* One of the breaking changes in OmniAuth 2.0+ relates to how relative
  URL installations are handled. See: omniauth/omniauth#903 and https://github.com/omniauth/omniauth/wiki/Upgrading-to-2.0#relative-root-apps
* As a result, when `azure_activedirectory_v2` is used with OmniAuth
  2.0+ for an app that lives at a relative URl, the `#callback_url` is incorrect (the relative URL is included twice).
* This is because OmniAuth is now prefixing the default
  Strategy#request_path and Strategy#callback_path with SCRIPT_NAME, but `azure_activedirectory_v2` is also adding `script_name` to `callback_url`.
* This update makes this gem compatible with OmniAuth 2.0+ but will break
  relative URL installatons for OmniAuth 1.x so I've also updated the
  gemspec to rely on a version of omniauth-oauth2 that has a dependency
  on omniauth 2.0: omniauth/omniauth-oauth2#152 (comment)
* Similar change to omniauth-google-oauth2 was made here: zquestz/omniauth-google-oauth2#403
it 'should set the callback path with script_name if present' do
allow(subject).to receive(:full_host) { base_url }
allow(subject).to receive(:script_name) { '/v1' }
expect(subject.callback_url).to eq(base_url + '/v1/auth/azure_activedirectory_v2/callback')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this spec failed before I made the code changes:

Screen Shot 2022-09-07 at 1 51 43 PM

@@ -45,5 +45,5 @@ Gem::Specification.new do |s|
'source_code_uri' => 'https://github.com/RIPGlobal/omniauth-azure-activedirectory-v2'
}

s.add_runtime_dependency('omniauth-oauth2', '~> 1.7')
s.add_runtime_dependency('omniauth-oauth2', '~> 1.8')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means that the gem is now dependent on omniauth 2.0. omniauth/omniauth-oauth2#152 (comment)

@whithajess whithajess merged commit c609abf into RIPAGlobal:master Sep 13, 2022
@whithajess whithajess mentioned this pull request Sep 13, 2022
@whithajess
Copy link
Contributor

Thanks @jessieay have bumped the version and pushed up to Rubygems - https://rubygems.org/gems/omniauth-azure-activedirectory-v2/versions/2.0.0

@jessieay
Copy link
Contributor Author

Thanks so much for merging and bumping @whithajess ! Much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants