예제 #1
0
    def actions(cls):
        """
        This method returns a dictionary of allowed actions and possible
        options in this handler module.

        :return: dict with actions
        """
        realm_list = get_realms().keys()
        actions = {ACTION_TYPE.SET_TOKENREALM:
                       {"realm":
                            {"type": "str",
                             "required": True,
                             "description": _("set a new realm of the token"),
                             "value": realm_list},
                        "only_realm":
                            {"type": "bool",
                             "description": _("The new realm will be the only "
                                              "realm of the token. I.e. all "
                                              "other realms will be removed "
                                              "from this token. Otherwise the "
                                              "realm will be added to the token.")
                            }
                        },
                   ACTION_TYPE.DELETE: {},
                   ACTION_TYPE.UNASSIGN: {},
                   ACTION_TYPE.DISABLE: {},
                   ACTION_TYPE.ENABLE: {},
                   ACTION_TYPE.INIT:
                       {"tokentype":
                            {"type": "str",
                             "required": True,
                             "description": _("Token type to create"),
                             "value": get_token_types()
                             },
                        "user":
                            {"type": "bool",
                             "description": _("Assign token to user in "
                                              "request or to tokenowner.")},
                        "realm":
                            {"type": "str",
                             "required": False,
                             "description": _("Set the realm of the newly "
                                              "created token."),
                             "value": realm_list},
                        "motppin": {
                            "type": "str",
                            "visibleIf": "tokentype",
                            "visibleValue": "motp",
                            "description": _("Set the MOTP PIN of the MOTP "
                                             "token during enrollment. This "
                                             "is a required value for "
                                             "enrolling MOTP tokens.")}
                        },
                   ACTION_TYPE.SET_DESCRIPTION:
                       {"description":
                            {
                                "type": "str",
                                "description": _("The new description of the "
                                                 "token.")
                            }
                       },
                   ACTION_TYPE.SET_VALIDITY:
                       {VALIDITY.START: {
                           "type": "str",
                           "description": _("The token will be valid starting "
                                            "at the given date. Can be a fixed "
                                            "date or an offset like +10m, "
                                            "+24h, +7d.")
                       },
                        VALIDITY.END: {
                            "type": "str",
                            "description": _("The token will be valid until "
                                             "the given date. Can be a fixed "
                                             "date or an offset like +10m, "
                                             "+24h, +7d.")
                        }
                       },
                   ACTION_TYPE.SET_COUNTWINDOW:
                       {"count window":
                            {
                                # TODO: should be "int" but we do not support
                                #  this at the moment.
                                "type": "str",
                                "required": True,
                                "description": _("Set the new count window of "
                                                 "the token.")
                            }
                       },
                   ACTION_TYPE.SET_TOKENINFO:
                       {"key":
                           {
                               "type": "str",
                               "required": True,
                               "description": _("Set this tokeninfo key.")
                           },
                        "value":
                            {
                                "type": "str",
                                "description": _("Set the above key the this "
                                                 "value.")
                            }
                       }
                   }
        return actions
예제 #2
0
    def actions(cls):
        """
        This method returns a dictionary of allowed actions and possible
        options in this handler module.

        :return: dict with actions
        """
        realm_list = list(get_realms())
        actions = {
            ACTION_TYPE.SET_TOKENREALM: {
                "realm": {
                    "type": "str",
                    "required": True,
                    "description": _("set a new realm of the token"),
                    "value": realm_list
                },
                "only_realm": {
                    "type":
                    "bool",
                    "description":
                    _("The new realm will be the only "
                      "realm of the token. I.e. all "
                      "other realms will be removed "
                      "from this token. Otherwise the "
                      "realm will be added to the token.")
                }
            },
            ACTION_TYPE.DELETE: {},
            ACTION_TYPE.UNASSIGN: {},
            ACTION_TYPE.DISABLE: {},
            ACTION_TYPE.ENABLE: {},
            ACTION_TYPE.SET_RANDOM_PIN: {
                "length": {
                    "type":
                    "int",
                    "required":
                    True,
                    "description":
                    _("set the PIN of the token to a random PIN of this length."
                      ),
                    "value":
                    list(range(1, 32))
                }
            },
            ACTION_TYPE.INIT: {
                "tokentype": {
                    "type": "str",
                    "required": True,
                    "description": _("Token type to create"),
                    "value": get_token_types()
                },
                "user": {
                    "type":
                    "bool",
                    "description":
                    _("Assign token to user in "
                      "request or to tokenowner.")
                },
                "realm": {
                    "type":
                    "str",
                    "required":
                    False,
                    "description":
                    _("Set the realm of the newly "
                      "created token."),
                    "value":
                    realm_list
                },
                "dynamic_phone": {
                    "type":
                    "bool",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "sms",
                    "description":
                    _("Dynamically read the mobile number "
                      "from the user store.")
                },
                "dynamic_email": {
                    "type":
                    "bool",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "email",
                    "description":
                    _("Dynamically read the email address "
                      "from the user store.")
                },
                "smtp_identifier": {
                    "type":
                    "str",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "email",
                    "description":
                    _("Use a specific SMTP server configuration for this token."
                      ),
                    "value":
                    [server.config.identifier for server in get_smtpservers()]
                },
                "sms_identifier": {
                    "type":
                    "str",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "sms",
                    "description":
                    _("Use a specific SMS gateway configuration for this token."
                      ),
                    "value":
                    [gateway.identifier for gateway in get_smsgateway()]
                },
                "additional_params": {
                    "type": "str",
                    "description":
                    _("A dictionary of additional init parameters.")
                },
                "motppin": {
                    "type":
                    "str",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "motp",
                    "description":
                    _("Set the MOTP PIN of the MOTP "
                      "token during enrollment. This "
                      "is a required value for "
                      "enrolling MOTP tokens.")
                }
            },
            ACTION_TYPE.SET_DESCRIPTION: {
                "description": {
                    "type": "str",
                    "description": _("The new description of the "
                                     "token.")
                }
            },
            ACTION_TYPE.SET_VALIDITY: {
                VALIDITY.START: {
                    "type":
                    "str",
                    "description":
                    _("The token will be valid starting "
                      "at the given date. Can be a fixed "
                      "date or an offset like +10m, "
                      "+24h, +7d.")
                },
                VALIDITY.END: {
                    "type":
                    "str",
                    "description":
                    _("The token will be valid until "
                      "the given date. Can be a fixed "
                      "date or an offset like +10m, "
                      "+24h, +7d.")
                }
            },
            ACTION_TYPE.SET_COUNTWINDOW: {
                "count window": {
                    # TODO: should be "int" but we do not support
                    #  this at the moment.
                    "type": "str",
                    "required": True,
                    "description": _("Set the new count window of "
                                     "the token.")
                }
            },
            ACTION_TYPE.SET_FAILCOUNTER: {
                "fail counter": {
                    "type": "str",
                    "required": True,
                    "description": _("Set the failcounter of "
                                     "the token.")
                }
            },
            ACTION_TYPE.CHANGE_FAILCOUNTER: {
                "change fail counter": {
                    "type":
                    "str",
                    "required":
                    True,
                    "description":
                    _("Increase or decrease the fail counter of the token. "
                      "Values of +n, -n with n being an integer are accepted.")
                }
            },
            ACTION_TYPE.SET_MAXFAIL: {
                "max failcount": {
                    "type": "str",
                    "required": True,
                    "description":
                    _("Set the maximum failcounter of the token.")
                }
            },
            ACTION_TYPE.SET_TOKENINFO: {
                "key": {
                    "type": "str",
                    "required": True,
                    "description": _("Set this tokeninfo key.")
                },
                "value": {
                    "type": "str",
                    "description": _("Set the above key the this "
                                     "value.")
                }
            },
            ACTION_TYPE.DELETE_TOKENINFO: {
                "key": {
                    "type": "str",
                    "required": True,
                    "description": _("Delete this tokeninfo key.")
                }
            }
        }
        return actions
예제 #3
0
    def actions(cls):
        """
        This method returns a dictionary of allowed actions and possible
        options in this handler module.

        :return: dict with actions
        """
        realm_list = get_realms().keys()
        actions = {ACTION_TYPE.SET_TOKENREALM:
                       {"realm":
                            {"type": "str",
                             "required": True,
                             "description": _("set a new realm of the token"),
                             "value": realm_list},
                        "only_realm":
                            {"type": "bool",
                             "description": _("The new realm will be the only "
                                              "realm of the token. I.e. all "
                                              "other realms will be removed "
                                              "from this token. Otherwise the "
                                              "realm will be added to the token.")
                            }
                        },
                   ACTION_TYPE.DELETE: {},
                   ACTION_TYPE.UNASSIGN: {},
                   ACTION_TYPE.DISABLE: {},
                   ACTION_TYPE.ENABLE: {},
                   ACTION_TYPE.INIT:
                       {"tokentype":
                            {"type": "str",
                             "required": True,
                             "description": _("Token type to create"),
                             "value": get_token_types()
                             },
                        "user":
                            {"type": "bool",
                             "description": _("Assign token to user in "
                                              "request or tokenowner.")},
                        "realm":
                            {"type": "str",
                             "required": False,
                             "description": _("Set the realm of the newly "
                                              "created token."),
                             "value": realm_list},
                        },
                   ACTION_TYPE.SET_DESCRIPTION:
                       {"description":
                            {
                                "type": "str",
                                "description": _("The new description of the "
                                                 "token.")
                            }
                       },
                   ACTION_TYPE.SET_VALIDITY:
                       {VALIDITY.START: {
                           "type": "str",
                           "description": _("The token will be valid starting "
                                            "at the given date. Can be a fixed "
                                            "date or an offset like +10m, "
                                            "+24h, +7d.")
                       },
                        VALIDITY.END: {
                            "type": "str",
                            "description": _("The token will be valid until "
                                             "the given date. Can be a fixed "
                                             "date or an offset like +10m, "
                                             "+24h, +7d.")
                        }

                       }
                   }
        return actions
예제 #4
0
    def actions(cls):
        """
        This method returns a dictionary of allowed actions and possible
        options in this handler module.

        :return: dict with actions
        """
        realm_list = get_realms().keys()
        actions = {
            ACTION_TYPE.SET_TOKENREALM: {
                "realm": {
                    "type": "str",
                    "required": True,
                    "description": _("set a new realm of the token"),
                    "value": realm_list
                },
                "only_realm": {
                    "type":
                    "bool",
                    "description":
                    _("The new realm will be the only "
                      "realm of the token. I.e. all "
                      "other realms will be removed "
                      "from this token. Otherwise the "
                      "realm will be added to the token.")
                }
            },
            ACTION_TYPE.DELETE: {},
            ACTION_TYPE.UNASSIGN: {},
            ACTION_TYPE.DISABLE: {},
            ACTION_TYPE.ENABLE: {},
            ACTION_TYPE.INIT: {
                "tokentype": {
                    "type": "str",
                    "required": True,
                    "description": _("Token type to create"),
                    "value": get_token_types()
                },
                "user": {
                    "type":
                    "bool",
                    "description":
                    _("Assign token to user in "
                      "request or to tokenowner.")
                },
                "realm": {
                    "type":
                    "str",
                    "required":
                    False,
                    "description":
                    _("Set the realm of the newly "
                      "created token."),
                    "value":
                    realm_list
                },
                "dynamic_phone": {
                    "type":
                    "bool",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "sms",
                    "description":
                    _("Dynamically read the mobile number "
                      "from the user store.")
                },
                "motppin": {
                    "type":
                    "str",
                    "visibleIf":
                    "tokentype",
                    "visibleValue":
                    "motp",
                    "description":
                    _("Set the MOTP PIN of the MOTP "
                      "token during enrollment. This "
                      "is a required value for "
                      "enrolling MOTP tokens.")
                }
            },
            ACTION_TYPE.SET_DESCRIPTION: {
                "description": {
                    "type": "str",
                    "description": _("The new description of the "
                                     "token.")
                }
            },
            ACTION_TYPE.SET_VALIDITY: {
                VALIDITY.START: {
                    "type":
                    "str",
                    "description":
                    _("The token will be valid starting "
                      "at the given date. Can be a fixed "
                      "date or an offset like +10m, "
                      "+24h, +7d.")
                },
                VALIDITY.END: {
                    "type":
                    "str",
                    "description":
                    _("The token will be valid until "
                      "the given date. Can be a fixed "
                      "date or an offset like +10m, "
                      "+24h, +7d.")
                }
            },
            ACTION_TYPE.SET_COUNTWINDOW: {
                "count window": {
                    # TODO: should be "int" but we do not support
                    #  this at the moment.
                    "type": "str",
                    "required": True,
                    "description": _("Set the new count window of "
                                     "the token.")
                }
            },
            ACTION_TYPE.SET_FAILCOUNTER: {
                "fail counter": {
                    "type": "str",
                    "required": True,
                    "description": _("Set the failcounter of "
                                     "the token.")
                }
            },
            ACTION_TYPE.SET_TOKENINFO: {
                "key": {
                    "type": "str",
                    "required": True,
                    "description": _("Set this tokeninfo key.")
                },
                "value": {
                    "type": "str",
                    "description": _("Set the above key the this "
                                     "value.")
                }
            }
        }
        return actions