File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -28,24 +28,29 @@ def discover!
2828 client . request ( :get , options [ :client_options ] [ :discovery_document ] , parse : :json ) . parsed
2929 end
3030
31- {
31+ discovery_params = {
3232 authorize_url : "authorization_endpoint" ,
3333 token_url : "token_endpoint" ,
3434 site : "issuer"
35- } . each do |internal_key , external_key |
35+ }
36+
37+ discovery_params . each do |internal_key , external_key |
3638 val = discovery_document [ external_key ] . to_s
3739 raise ::OmniAuth ::OpenIDConnect ::DiscoveryError . new ( "missing discovery parameter #{ external_key } " ) if val . nil? || val . empty?
3840 options [ :client_options ] [ internal_key ] = val
3941 end
4042
4143 userinfo_endpoint = options [ :client_options ] [ :userinfo_endpoint ] = discovery_document [ "userinfo_endpoint" ] . to_s
42- if userinfo_endpoint . nil? || userinfo_endpoint . empty?
43- options . use_userinfo = false
44- end
44+ options . use_userinfo = false if userinfo_endpoint . nil? || userinfo_endpoint . empty?
4545 end
4646
4747 def request_phase
48- discover! if options [ :discovery ]
48+ begin
49+ discover! if options [ :discovery ]
50+ rescue ::OmniAuth ::OpenIDConnect ::DiscoveryError => e
51+ fail! ( :openid_connect_discovery_error , e )
52+ end
53+
4954 super
5055 end
5156
You can’t perform that action at this time.
0 commit comments