Exemplo n.º 1
0
    def __init__(self, app, conf):
        '''
        Constructor
        '''
        self.conf = conf
        self.app = app

        self.cvm = CVM_Engine(self.app, self.conf)

        self.disco = AuthDiscover(app, conf)
        self.validator = AuthValidator(app, conf)

        LOG.info('Starting federated middleware wrapper')
        LOG.info('Init FederatedAuthentication!')
Exemplo n.º 2
0
 def __init__(self, app, conf):
     '''
     Constructor
     '''
     self.conf = conf
     self.app = app
     
     self.cvm = CVM_Engine(self.app, self.conf)
     
     self.disco = AuthDiscover(app,conf)
     self.validator = AuthValidator(app,conf)
     
     LOG.info('Starting federated middleware wrapper')
     LOG.info('Init FederatedAuthentication!')
Exemplo n.º 3
0
class FederatedAuthentication(object):
    
    def __init__(self, app, conf):
        '''
        Constructor
        '''
        self.conf = conf
        self.app = app
        
        self.cvm = CVM_Engine(self.app, self.conf)
        
        self.disco = AuthDiscover(app,conf)
        self.validator = AuthValidator(app,conf)
        
        LOG.info('Starting federated middleware wrapper')
        LOG.info('Init FederatedAuthentication!')
        
        
        
    @webob.dec.wsgify(RequestClass=Request)
    def __call__(self,req):
        
        
        LOG.debug('Request intercepted by CVM')
        LOG.debug('--------------------------')
        if not 'HTTP_X_AUTHENTICATION_TYPE' in req.environ:
            return self.app(req)
        if not req.environ['HTTP_X_AUTHENTICATION_TYPE'] in  ('federated'):
            return self.app(req)
        
        body = req.body 
        data = simplejson.loads(body)
       
        if 'idpResponse' in data:
            validatedUserAttributes = self.validator.validate(data)
		
            return self.cvm.engine(data, validatedUserAttributes)
        else:
            if 'realm' in data:
                return self.disco.discovery(data['realm'])
            
            return self.disco.getRealmList()
Exemplo n.º 4
0
class FederatedAuthentication(object):
    def __init__(self, app, conf):
        '''
        Constructor
        '''
        self.conf = conf
        self.app = app

        self.cvm = CVM_Engine(self.app, self.conf)

        self.disco = AuthDiscover(app, conf)
        self.validator = AuthValidator(app, conf)

        LOG.info('Starting federated middleware wrapper')
        LOG.info('Init FederatedAuthentication!')

    @webob.dec.wsgify(RequestClass=Request)
    def __call__(self, req):

        LOG.debug('Request intercepted by CVM')
        LOG.debug('--------------------------')
        if not 'HTTP_X_AUTHENTICATION_TYPE' in req.environ:
            return self.app(req)
        if not req.environ['HTTP_X_AUTHENTICATION_TYPE'] in ('federated'):
            return self.app(req)

        body = req.body
        data = simplejson.loads(body)

        if 'idpResponse' in data:
            validatedUserAttributes = self.validator.validate(data)

            return self.cvm.engine(data, validatedUserAttributes)
        else:
            if 'realm' in data:
                return self.disco.discovery(data['realm'])

            return self.disco.getRealmList()