Exemple #1
0
    def _create(self, *args, **kwargs):
        verb = kwargs.get('verb', None)
        params = web.input()
        if 'error' in web.ctx.session:
            del web.ctx.session.error
            del web.ctx.session.errorno
            del web.ctx.session.errormsg
        if KERBEROS_AUTH_ENABLED:
            try:
                do_kinit(params.username, params.password)
                web.ctx.session.authenticated = True
                web.ctx.session.username = params.username
                result = self._prepare_output(
                    verb['request_type'],
                    verb['request_content_type'],
                    output={'redirect': {'url': '/', 'absolute': True}})

            except KerberosAuthError, e:
                web.ctx.session.authenticated = False
                web.ctx.session.error = True
                web.ctx.session.errorno = 1020
                web.ctx.session.errormsg = e
                result = self._prepare_output(
                    verb['request_type'],
                    verb['request_content_type'],
                    output={'redirect': {'url': '/', 'absolute': True}})
Exemple #2
0
 def POST(self):
     params = web.input()
     if 'error' in web.ctx.session:
         del web.ctx.session.error
         del web.ctx.session.errorno
         del web.ctx.session.errormsg
     if KERBEROS_AUTH_ENABLED:
         try:
             do_kinit(params.username, params.password)
             web.ctx.session.authenticated = True
             web.ctx.session.username = params.username
             raise web.seeother('/')
         except KerberosAuthError, e:
             web.ctx.session.authenticated = False
             web.ctx.session.error = True
             web.ctx.session.errorno = 1020
             web.ctx.session.errormsg = e
             raise web.seeother('/')