# # Copyright (C) 2007 Mobio Networks, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # =begin Some summary should go here =end require 'rmobio/utils' module Rmobio module Auth def get_msisdn() logHeaders() msisdn=request.env["HTTP_X_MSISDN"] msisdn=request.env["HTTP_X_NOKIA_MSISDN"] if msisdn ==nil msisdn=request.env["HTTP_MSISDN"] if msisdn ==nil if msisdn != nil logger.debug "msisdn = #{msisdn}" if msisdn.length == 11 msisdn=msisdn[1..-1] end if msisdn.length == 10 msisdn='91' + msisdn end end if(msisdn!=nil) if(msisdn.length == 12) return msisdn end end return '' end #== get_user_attributes #=== To get Access Attribuest #=== Sample device url: # http://marge.mobiolabs.com/gateway/public/authorizationServices/getAccessAttributes?auth_identity=910000000000&domain=airtel #=== Sample returned client info: # # # 910000000000 # airtel # ROLE_USER # Second Attribute # def get_user_attributes(user_access_att_url) temp=Array.new logger.debug("url= #{user_access_att_url}") if user_access_att_url doc = Hpricot(open(user_access_att_url)) doc.search("//attribute").each do |attributeElement| logger.debug "att = #{attributeElement.innerHTML} " temp<