Ejemplo n.º 1
0
    def init_auth(self, phone):

        try:
            evlog.log("Autentimispäring: ALGUS %s" % (phone))
            if not ElectionState().election_on():
                r1, r2 = ElectionState().election_off_msg()
                return protocol.msg_error(r1, r2)

            self.ctx().set_phone(phone)
            self.ctx().generate_challenge()
            service = MobileIDService()

            rsp_cert = service.get_cert(self.ctx())
            if not (rsp_cert._SignCertStatus == 'OK'):
                return self.__return_mid_error(rsp_cert._SignCertStatus)

            if rsp_cert._AuthCertStatus == 'OK':
                res, err = cert_ok(rsp_cert._AuthCertData)
                if not res:
                    evlog.log_error(err)
                    return self.__return_mid_policy_error()
            else:
                return self.__return_mid_error(rsp_cert._AuthCertStatus)

            rsp = service.init_auth(self.ctx())
            if rsp._Status == 'OK':
                self.ctx().save_post_auth(rsp)

                alog, elog = evlogdata.get_cert_data_log(
                        rsp._CertificateData, 'cand/auth', True)

                evlog.log('Autentimispäring (%s, %s, %s, %s)' % \
                    (rsp._UserIDCode, rsp._UserGivenname, \
                    rsp._UserSurname, rsp._Challenge))

                evlog.log(alog)
                if elog:
                    evlog.log_error(elog)

                return protocol.msg_mobid_auth_init_ok(\
                    self.ctx().sessid(), rsp._ChallengeID)

            return self.__return_mid_error(rsp._Status)

        except httplib.BadStatusLine, exc:
            return self.__return_badstatusline_error(exc)
Ejemplo n.º 2
0
    def init_auth(self, phone):

        try:
            evlog.log("Autentimispäring: ALGUS %s" % (phone))
            if not ElectionState().election_on():
                r1, r2 = ElectionState().election_off_msg()
                evlog.log_error('Viga operatsioonil "cand", teade "%s"' % r2)
                return protocol.msg_error(r1, r2)

            self.ctx().set_phone(phone)
            self.ctx().generate_challenge()
            service = MobileIDService()

            rsp = service.init_auth(self.ctx())
            if rsp._Status == 'OK':
                rsp._CertificateData = rsp._CertificateData.strip()

                self.ctx().save_post_auth(rsp)

                alog, elog = evlogdata.get_cert_data_log(
                    rsp._CertificateData, 'cand/auth', True)

                evlog.log('Autentimispäring (%s, %s, %s, %s)' %
                          (rsp._UserIDCode, rsp._UserGivenname,
                           rsp._UserSurname, rsp._Challenge))

                evlog.log(alog)
                if elog:
                    evlog.log_error(elog)

                return protocol.msg_mobid_auth_init_ok(self.ctx().sessid(),
                                                       rsp._ChallengeID)

            return self.__return_mid_error(rsp._Status)

        except httplib.BadStatusLine as exc:
            return self.__return_badstatusline_error(exc)
        except ZSI.FaultException as exc:
            return self.__return_zsi_error(exc)
        except:
            return self.__return_exception()
        finally:
            evlog.log('Autentimispäring: LÕPP')
Ejemplo n.º 3
0
    def init_auth(self, phone):

        try:
            evlog.log("Autentimispäring: ALGUS %s" % (phone))
            if not ElectionState().election_on():
                r1, r2 = ElectionState().election_off_msg()
                evlog.log_error('Viga operatsioonil "cand", teade "%s"' % r2)
                return protocol.msg_error(r1, r2)

            self.ctx().set_phone(phone)
            self.ctx().generate_challenge()
            service = MobileIDService()

            rsp = service.init_auth(self.ctx())
            if rsp._Status == "OK":
                rsp._CertificateData = rsp._CertificateData.strip()

                self.ctx().save_post_auth(rsp)

                alog, elog = evlogdata.get_cert_data_log(rsp._CertificateData, "cand/auth", True)

                evlog.log(
                    "Autentimispäring (%s, %s, %s, %s)"
                    % (rsp._UserIDCode, rsp._UserGivenname, rsp._UserSurname, rsp._Challenge)
                )

                evlog.log(alog)
                if elog:
                    evlog.log_error(elog)

                return protocol.msg_mobid_auth_init_ok(self.ctx().sessid(), rsp._ChallengeID)

            return self.__return_mid_error(rsp._Status)

        except httplib.BadStatusLine as exc:
            return self.__return_badstatusline_error(exc)
        except ZSI.FaultException as exc:
            return self.__return_zsi_error(exc)
        except:
            return self.__return_exception()
        finally:
            evlog.log("Autentimispäring: LÕPP")
Ejemplo n.º 4
0
    def init_auth(self, phone):

        try:
            evlog.log("Autentimispäring: ALGUS %s" % (phone))
            if not ElectionState().election_on():
                r1, r2 = ElectionState().election_off_msg()
                return protocol.msg_error(r1, r2)

            self.ctx().set_phone(phone)
            self.ctx().generate_challenge()
            service = MobileIDService()

            rsp_cert = service.get_cert(self.ctx())
            if not (rsp_cert._SignCertStatus == 'OK'):
                return self.__return_mid_error(rsp_cert._SignCertStatus)

            if rsp_cert._AuthCertStatus == 'OK':
                res, err = cert_ok(rsp_cert._AuthCertData)
                if not res:
                    evlog.log_error(err)
                    return self.__return_mid_policy_error()
            else:
                return self.__return_mid_error(rsp_cert._AuthCertStatus)

            rsp = service.init_auth(self.ctx())
            if rsp._Status == 'OK':
                self.ctx().save_post_auth(rsp)
                evlog.log('Autentimispäring (%s, %s, %s, %s)' % \
                    (rsp._UserIDCode, rsp._UserGivenname, \
                    rsp._UserSurname, rsp._Challenge))

                return protocol.msg_mobid_auth_init_ok(\
                    self.ctx().sessid(), rsp._ChallengeID)

            return self.__return_mid_error(rsp._Status)

        except httplib.BadStatusLine, exc:
            return self.__return_badstatusline_error(exc)