Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Update admin/mkassoc to enable to work #103

Merged
merged 1 commit into from
Feb 25, 2017
Merged

Update admin/mkassoc to enable to work #103

merged 1 commit into from
Feb 25, 2017

Conversation

serihiro
Copy link
Contributor

What will this pr change ?

  • Enable to work admin/mkassoc.
    • When I tried to use this script with the newest version of ruby-openid, errors occurred for some interface mismatch.

@@ -1,11 +1,11 @@
#!/usr/bin/env ruby

require "openid/consumer/associationmanager"
require "openid/store/memstore"
require "openid/store/memory"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

admin/mkassoc Outdated
ARGV.each do |server_url|
mgr = OpenID::Consumer::AssociationManager.new(store, URI.parse(server_url))
mgr = OpenID::Consumer::AssociationManager.new(store, server_url)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have you removed the URI.parse call?
I would guess that it's there to ensure that the arguments are valid URIs?

Copy link
Contributor Author

@serihiro serihiro Feb 23, 2017

Choose a reason for hiding this comment

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

@tobiashm
Thank you for your comment!

If OpenID::Consumer::AssociationManager#get_association with @server_url of URI object is called, bad URI error occured like the following:

$ ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

$ bundle exec ruby admin/mkassoc http://auth.livedoor.com/openid/server
==================================================
Server: http://auth.livedoor.com/openid/server
/Users/seri/Documents/ruby-work/ruby-openid/lib/openid/kvpost.rb:54:in `rescue in make_kv_post': Unable to contact OpenID server: bad URI(is not URI?): http://
auth.livedoor.com/openid/server (OpenID::KVPostNetworkError)
        from /Users/seri/Documents/ruby-work/ruby-openid/lib/openid/kvpost.rb:51:in `make_kv_post'
        from /Users/seri/Documents/ruby-work/ruby-openid/lib/openid/consumer/associationmanager.rb:195:in `request_association'
        from /Users/seri/Documents/ruby-work/ruby-openid/lib/openid/consumer/associationmanager.rb:130:in `negotiate_association'
        from /Users/seri/Documents/ruby-work/ruby-openid/lib/openid/consumer/associationmanager.rb:118:in `get_association'
        from admin/mkassoc:11:in `block in <main>'
        from admin/mkassoc:7:in `each'
        from admin/mkassoc:7:in `<main>

This is because URI.parse is called twice, 1st time is here, and second time is here.

So, if you want to validate server_url in admin/mkassoc, how about adding this?

ARGV.each do |server_url|
  unless URI::regexp =~ server_url
    puts "`#{server_url}` will be skipped for invalid URI format."
    next
  end
  ...

end

Copy link
Contributor

Choose a reason for hiding this comment

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

Really like your last suggestion for validation.
Could you add that? Then I'll merge this.

@tobiashm
Copy link
Contributor

Looking into the Travis CI build failure, which doesn't seem to have anything to do with this code.

@serihiro
Copy link
Contributor Author

@tobiashm
I added validation and squashed into 6bcd3d0 . Please check this 🙇

@tobiashm tobiashm merged commit b7b3316 into openid:master Feb 25, 2017
@tobiashm
Copy link
Contributor

@serihiro thank you

@serihiro
Copy link
Contributor Author

Thank you for your merging! 🍻

@serihiro serihiro deleted the follow-up-newest-version branch February 26, 2017 00:03
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 18, 2019
Update ruby-ruby-openid package to version 2.9.2.


## 2.9.2

* Perform all checks before verifying endpoints.
  [#126](openid/ruby-openid#126)

## 2.9.1

* Updated CHANGELOG.md

## 2.9.0

* Remove deprecated `autorequire` from gemspec.
  [#123](openid/ruby-openid#123)
* Rescue from `Yadis::XRI::XRIHTTPError` on discovery.
  [#106](openid/ruby-openid#106)
* Avoid SSRF for claimed_id request.
  [#121](openid/ruby-openid#121)
* Updated documentation.
  [#115](openid/ruby-openid#115), [#116](openid/ruby-openid#116), [#117](openid/ruby-openid#117), [#118](openid/ruby-openid#118)
* Reduce warnings output in test runs.
  [#119](openid/ruby-openid#119)
* Drop deprecated option from gemspec.
  [#120](openid/ruby-openid#120)
* Remove circular require.
  [#113](openid/ruby-openid#113)
* Updated Travis CI config with Ruby 2.6
  [#114](openid/ruby-openid#114)
* Simplify Bundler require; remove need for extra `:require`.
  [#112](openid/ruby-openid#112)

## 2.8.0

* Fix `admin/mkassoc` script.
  See openid/ruby-openid#103
* Allow specifying timeout for `OpenID::StandardFetcher` in environment variables.
  See openid/ruby-openid#109
* Fixed some documentation.
  See openid/ruby-openid#111
* Fixed example server.
  See openid/ruby-openid#91
* Fixed tests.
  See openid/ruby-openid#86
* Misc. changes to the CI setup.
  See
  - openid/ruby-openid#110
  - openid/ruby-openid#108
  - openid/ruby-openid#107
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants