def authorize
logger.debug('authorize filter:')
if params[:burl]
burl =params[:burl].gsub(/&/,'&')
else
burl= ''
end
surl=request.protocol + request.host_with_port + request.request_uri
logger.debug(" surl 0-=== #{surl}")
domain = Rmobio::Utils.get_domain(request.request_uri)
no_auth_domains =MOBIO_CONFIG['no_auth_domains']
if (no_auth_domains != nil)
no_auth_domains.each do |d|
if(domain == d)
logger.debug("No auth for domain: #{d}")
return
end
end
end
logger.debug("Here is the interpreted new domain: #{domain}")
label= MOBIO_CONFIG['app_label']
logger.debug("here is the label #{label}")
label_domain=label +'-wap-'+domain
if (session[:shared_session_auth])
attributes=session[:shared_session_auth]
attributes.each do |attr|
logger.debug("attribute #{attr}")
if(attr==label_domain)
logger.debug('find good')
return
end
end
end
logger.debug('get result')
user_access_att_url= MOBIO_CONFIG['http_access_attribute_service_url'] + get_msisdn() + '&domain=' + domain
result=get_user_attributes(user_access_att_url)
logger.debug("result = #{result[0]}")
session[:shared_session_auth]=result
result.each do |attr|
logger.debug("attribute #{attr}")
if(attr==label_domain)
logger.debug('find good finally')
return
end
end
auth_app_url=MOBIO_CONFIG['authorization_app_url'] + '?label=' + label + '&domain=' + domain + '&burl=' + burl + '&surl=' + surl
redirect_to("#{auth_app_url}")
end