source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgMiddleware.py @ 2858

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgMiddleware.py@2858
Revision 2858, 2.2 KB checked in by pjkersha, 12 years ago (diff)

base64 encode return URI 'r' argument in query strings. This is a fix for
#845 and may address #862

ows_server/ows_server/config/ndgMiddleware.py: added global for getCredentials
path

ows_server/ows_server/controllers/login.py: include code to decode return URL
in doRedirect

ows_server/ows_server/controllers/logout.py: ...likewise for logout

ows_server/ows_server/lib/security_util.py: use cls for class methods

ows_server/ows_server/templates/ndgPage.kid: base64 encode return URL for
login and logout callbacks.

ows_server/ows_server/templates/login.kid: use new global $g.getCredentials
to specify full URL path

ows_server/ows_server/templates/wayf.kid: altered help message for return URL
check. Hovering over URL won't help the user now because 'r' arg is base64
encoded.

Line 
1# ndg middleware
2from paste.deploy import CONFIG
3from ows_server.models.Utilities import myConfig
4class ndgMiddleware:
5   
6    def __init__(self,app,g):
7       
8        #this is the next application in the wsgi stack
9        self.app=app
10       
11        #set up the ndg configuration file
12       
13        #Changed by Dom: CONFIG.get wasn't respecting the %(home)s variable, so moved to app_conf section in ini file.
14        #cf=CONFIG.get('configfile')
15        cf= CONFIG['app_conf']['configfile']
16        cf=myConfig(cf)
17     
18        self.globals=g
19        self.globals.localLink=cf.get('layout','localLink',None)
20        self.globals.localImage=cf.get('layout','localImage',None)
21        self.globals.localAlt=cf.get('layout','localAlt','Visit Local Site')
22        self.globals.ndgLink=cf.get('layout','ndgLink','http://ndg.nerc.ac.uk')
23        self.globals.ndgImage=cf.get('layout','ndgImage',None)
24        self.globals.ndgAlt=cf.get('layout','ndgAlt','Visit NDG')
25        self.globals.stfcLink=cf.get('layout','stfcLink')
26        self.globals.stfcImage=cf.get('layout','stfcImage')
27        self.globals.helpIcon=cf.get('layout','helpIcon')
28        self.globals.LeftAlt=cf.get('layout','HdrLeftAlt')
29        self.globals.LeftLogo=cf.get('layout','HdrLeftLogo')
30        self.globals.pageLogo="bodcHdr"
31        self.globals.icons_xml=cf.get('layout','Xicon')
32        self.globals.icons_prn=cf.get('layout','printer')
33        self.globals.icons_A=cf.get('NDG_A_SERVICE','icon')
34        self.globals.icons_B=cf.get('NDG_B_SERVICE','icon')
35        self.globals.icons_D=cf.get('DISCOVERY','icon')
36        self.globals.icons_R=cf.get('RELATED','icon')
37        self.globals.icons_key=cf.get('layout','key')
38       
39        self.globals.discoveryURL=cf.get('SEARCH','discoveryURL')
40       
41        self.globals.server=cf.get('DEFAULT','server','')
42        self.globals.wayfuri='%s/wayf'%self.globals.server
43        self.globals.getCredentials='%s/getCredentials'%self.globals.server
44       
45        self.globals.logout='%s/logout'%self.globals.server
46       
47        self.config=cf
48       
49       
50    def __call__(self,environ,start_response):
51       
52        environ['ndgConfig']=self.config
53        return self.app(environ,start_response)
54   
Note: See TracBrowser for help on using the repository browser.