vrk-kpa / xroad-joint-development

Unmaintained repository. Development moved to: https://github.com/nordic-institute/X-Road-development
19 stars 8 forks source link

As Security Server administrator I want that logging to hardware token would not fail when "Max PIN length" is set to "-1" #102

Closed VitaliStupin closed 7 years ago

VitaliStupin commented 7 years ago

Affected components: common-ui Affected documentation: - Estimated delivery: - External reference: https://jira.ria.ee/browse/XTE-318

Problem When hardware token (Thales) is configured with parameter "Max PIN length" set to "-1" (unlimited) then logging in to that token fails with error: "PIN format incorrect"

xtee6/common-ui/app/controllers/base_controller.rb#118:

    token.tokenInfo.each do |key, val|
      if (key == "Min PIN length" && pin.size < val.to_i) ||
          (key == "Max PIN length" && pin.size > val.to_i)
        raise t("activate_token.pin_format_incorrect")

Problem could be fixed by changing condition to:

    token.tokenInfo.each do |key, val|
      if (key == "Min PIN length" && pin.size < val.to_i) ||
          (key == "Max PIN length" && val.to_i >= 0 && pin.size > val.to_i)
        raise t("activate_token.pin_format_incorrect")

Acceptance criteria

VitaliStupin commented 7 years ago

Fixed in 6.9.2 version.