Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure entity uri has scheme

  • Loading branch information...
commit 183c7c5aa7d6c4268e6ef7dcf0507c30d997f60e 1 parent 931777a
@jvatic jvatic authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/omniauth/strategies/tent.rb
View
10 lib/omniauth/strategies/tent.rb
@@ -25,7 +25,7 @@ def request_params
def request_phase
if request.post? && request_params.entity
- set_state(:entity, request_params.entity)
+ set_state(:entity, ensure_entity_has_scheme(request_params.entity))
perform_discovery!
find_or_create_app!
build_uri_and_redirect!
@@ -54,6 +54,14 @@ def callback_phase
private
+ def ensure_entity_has_scheme(entity_uri)
+ if entity_uri =~ %r{^[a-z]{3,}?://}
+ entity_uri
+ else
+ "https://#{entity_uri}"
+ end
+ end
+
def set_state(key, val)
session["omniauth.#{key}"] = val
val
Please sign in to comment.
Something went wrong with that request. Please try again.