#2775 Need to add external reg attribute to indicate if operation is enroll or pin reset
Closed: migrated by dmoluguw. Opened by mharmsen.

If a token holder attempts to reset the token PIN but clicks on the "Update" button instead of the "Reset PIN" button in the CIW, the token is re-enrolled with new certificates instead of just getting the PIN reset. A new externalReg parameter should be added that can point to a value in the registration database to indicate the registration is for either "enroll" or "pinReset".

The TPS CS.cfg should contain the following:

auth.instance.#.externalReg.registrationType=registrationType
auth.instance.#.attributes=registrationType (along with other externalReg attributes)

In the TPSEnrollProcessor.java, check this value before authenticating the user (around line 172):

        configName = "auths.instance." + authId + ".externalReg.registrationType";
        CMS.debug(method + ": getting config: " + configName);
        String registrationType = configStore.getString(configName,
                "registrationType");
    if (registrationType != null) {
        CMS.debug(method + ": retrieved registrationType:" + registrationType);
        if (!registrationType.equalsIgnoreCase(currentTokenOperation) {
              CMS.debug(method + "Error: registrationType does not match currentTokenOperation");
              logMsg = "Registration record is not an enrollment registration type");
              tps.tdb.tdbActivity(ActivityDatabase.OP_ENROLLMENT, tokenRecord, session.getIpAddress(), logMsg,
                    "failure");
            throw new TPSException(logMsg, TPSStatus.STATUS_ERROR_INVALID_REG_TYPE);
    }

A similar thing should be done in the TPSPinResetProcessor.java class to prevent enrollment registrations from being used for PIN resets.


Metadata Update from @mharmsen:
- Custom field component adjusted to General
- Custom field feature adjusted to ''
- Custom field origin adjusted to Community
- Custom field proposedmilestone adjusted to ''
- Custom field proposedpriority adjusted to ''
- Custom field reviewer adjusted to ''
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1467413
- Custom field type adjusted to defect
- Custom field version adjusted to ''
- Issue priority set to: critical
- Issue set to the milestone: 10.4

Metadata Update from @mharmsen:
- Issue set to the milestone: 10.5 (was: 10.4)

Metadata Update from @mharmsen:
- Issue priority set to: major (was: critical)

[20171025] - Offline Triage ==> 10.6

Metadata Update from @mharmsen:
- Issue set to the milestone: 10.6 (was: 10.5)

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/2895

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata Update from @dmoluguw:
- Issue close_status updated to: migrated
- Issue status updated to: Closed (was: Open)

Metadata