Update admin/mkassoc to enable to work#103
Update admin/mkassoc to enable to work#103tobiashm merged 1 commit intoopenid:masterfrom serihiro:follow-up-newest-version
Conversation
|
|
||
| require "openid/consumer/associationmanager" | ||
| require "openid/store/memstore" | ||
| require "openid/store/memory" |
| store = OpenID::Store::Memory.new | ||
| ARGV.each do |server_url| | ||
| mgr = OpenID::Consumer::AssociationManager.new(store, URI.parse(server_url)) | ||
| mgr = OpenID::Consumer::AssociationManager.new(store, server_url) |
There was a problem hiding this comment.
Why have you removed the URI.parse call?
I would guess that it's there to ensure that the arguments are valid URIs?
There was a problem hiding this comment.
@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
...
endThere was a problem hiding this comment.
Really like your last suggestion for validation.
Could you add that? Then I'll merge this.
|
Looking into the Travis CI build failure, which doesn't seem to have anything to do with this code. |
|
@serihiro thank you |
|
Thank you for your merging! 🍻 |
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
What will this pr change ?
admin/mkassoc.ruby-openid, errors occurred for some interface mismatch.