def test(): """ Test the privacyIDEA definition :return: """ param = request.all_data identifier = getParam(param, "identifier", required) url = getParam(param, "url", required) tls = bool(int(getParam(param, "tls", default="1"))) user = getParam(param, "username", required) password = getParam(param, "password", required) s = PrivacyIDEAServerDB(identifier=identifier, url=url, tls=tls) r = PrivacyIDEAServer.request(s, user, password) g.audit_object.log({'success': r > 0, 'info': r}) return send_result(r > 0)
def add_privacyideaserver(identifier, url, tls=True, description=""): """ This adds a privacyIDEA server to the privacyideaserver database table. If the "identifier" already exists, the database entry is updated. :param identifier: The identifier or the name of the privacyIDEA Server definition. As the identifier is unique, providing an identifier will return a list with either one or no radius server :type identifier: basestring :param url: The url of the privacyIDEA server :type url: basestring :param tls: whether the certificate of the server should be checked :type tls: bool :param description: Human readable description of the RADIUS server definition :return: The Id of the database object """ r = PrivacyIDEAServerDB(identifier=identifier, url=url, tls=tls, description=description).save() return r