Пример #1
0
    def index(self):
        '''Returns debugging information of Shibboleth.
        '''
        
        template = '''
            <html>
                <head>
                    <title>Shibboleth Test</title>
                </head>
                <body>
                    <h1>Shibboleth Test</h1>
                    <form action="signOut" method="get"><input value="Sign Out" type="submit" /></form>
                    <pre>%s</pre>
                </body>
            </html>
        '''

        try:
            service.getUsername()
        except KeyError:
            return template % 'No Shibboleth/Adfs headers found. Probably in a private VM/instance.'

        data = [
            ('Username', service.getUsername()),
            ('Current Time', time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())),
            ('Hostname', '%s:%s' % (socket.gethostname(), str(cherrypy.config.get('server.socket_port')))),
            ('In zh', 'zh' in service.getGroups()),
            ('In cms-cond-dev', 'cms-cond-dev' in service.getGroups()),
            ('In cms-cond-dev-admin', 'cms-cond-dev-admin' in service.getGroups()),
            ('Groups', '\n' + '\n'.join(['    %s' % group for group in sorted(service.getGroups())])),
            ('Headers', '\n' + '\n'.join(['    %s: %s' % header for header in sorted(cherrypy.request.headers.items())])),
        ]

        return template % '\n'.join(['%s: %s' % x for x in data])
Пример #2
0
 def get_username(self):
     if service.settings['productionLevel'] == 'private':
         username = pwd.getpwuid(os.getuid())[0]
     else:
         username = service.getUsername()
     #username = "******"
     return username
Пример #3
0
    def index(self):
        '''Returns debugging information of Shibboleth.
        '''

        template = '''
            <html>
                <head>
                    <title>Shibboleth Test</title>
                </head>
                <body>
                    <h1>Shibboleth Test</h1>
                    <form action="signOut" method="get"><input value="Sign Out" type="submit" /></form>
                    <pre>%s</pre>
                </body>
            </html>
        '''

        try:
            service.getUsername()
        except KeyError:
            return template % 'No Shibboleth/Adfs headers found. Probably in a private VM/instance.'

        data = [
            ('Username', service.getUsername()),
            ('Current Time',
             time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())),
            ('Hostname',
             '%s:%s' % (socket.gethostname(),
                        str(cherrypy.config.get('server.socket_port')))),
            ('In zh', 'zh' in service.getGroups()),
            ('In cms-cond-dev', 'cms-cond-dev' in service.getGroups()),
            ('In cms-cond-dev-admin', 'cms-cond-dev-admin'
             in service.getGroups()),
            ('Groups', '\n' + '\n'.join(
                ['    %s' % group for group in sorted(service.getGroups())])),
            ('Headers', '\n' + '\n'.join([
                '    %s: %s' % header
                for header in sorted(cherrypy.request.headers.items())
            ])),
        ]

        return template % '\n'.join(['%s: %s' % x for x in data])
Пример #4
0
 def get_username(self):
     if service.settings['productionLevel'] == 'private':
         username = pwd.getpwuid(os.getuid())[0]
     else:
         username = service.getUsername()
     return username