lib/authpds-nyu/sun/opensso.rb in authpds-nyu-0.1.4 vs lib/authpds-nyu/sun/opensso.rb in authpds-nyu-0.2.0
- old
+ new
@@ -27,11 +27,11 @@
private
def get_cookie_name_for_token
return @cookies[:nyulibrary_opensso_cookiename] unless @cookies[:nyulibrary_opensso_cookiename].nil?
req = Net::HTTP::Get.new(@opensso_uri.path + '/identity/getCookieNameForToken')
res = @http.request(req, '')
- raise RuntimeError.new(
+ raise RuntimeError.new(
"Error in #{self.class}."+
"Unrecognized response: #{res}") unless res.body.starts_with?("string=")
cookie_name = res.body.split('=').at(1).chomp unless res.body.split('=').at(1).nil?
@cookies[:nyulibrary_opensso_cookiename] = { 'value' => cookie_name, 'domain' => ".library.nyu.edu", 'path' => "/" }
return cookie_name
@@ -40,20 +40,20 @@
def get_token_cookie(token_cookie_name)
return nil if token_cookie_name.nil?
token_cookie = @cookies[token_cookie_name]
token_cookie = @cookies[token_cookie_name.to_sym] if token_cookie.nil?
token_cookie = CGI.unescape(token_cookie.to_s.gsub('+', '%2B'))
- token_cookie = (token_cookie != '') ?
- (token_cookie.start_with?(token_cookie_name)) ?
+ token_cookie = (token_cookie != '') ?
+ (token_cookie.start_with?(token_cookie_name)) ?
token_cookie : "#{token_cookie_name}=#{token_cookie}; path=" : nil
end
def validate_token(token_cookie)
return false if token_cookie.nil?
req = Net::HTTP::Get.new(@opensso_uri.path + '/identity/isTokenValid')
req['Cookie'] = token_cookie
res = @http.request(req, '')
- raise RuntimeError.new(
+ raise RuntimeError.new(
"Error in #{self.class}."+
"Unrecognized response: #{res}") unless res.body.starts_with?("boolean=")
res.body.split('=').at(1).chomp == 'true'
end
\ No newline at end of file