Random password Transform issue

we are generating random password and the issue is whenever I do refresh it is generating the new password again and again.

I used below two different transforms but it didn’t worked

{
    "name": "PasswordGeneratorWithRandomNumber",
    "type": "static",
    "attributes": {
        "value": "pass${randomNumber}word",
        "randomNumber": {
            "type": "randomNumeric",
            "attributes": {
                "length": 4
            }
        }
    },
    "requiresPeriodicRefresh": false,
    "internal": false
}
{
    "name": " PasswordGeneratorWithRandomNumber",
    "type": "static",
    "attributes": {
        "value": "#if($currentValue == 'none')pass${randomNumber}word#{else}$currentValue#end",
        "randomNumber": {
            "type": "randomNumeric",
            "attributes": {
                "length": 4
            }
        },
        "currentValue": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "identityAttribute",
                        "attributes": {
                            "name": "aaTestAttribute2"
                        }
                    },
                    "none"
                ],
                "ignoreErrors": false
            }
        }
    },
    "internal": false
}

Hi,

You have to add the requiresPeriodicrefresh as part of attributes.

{
    "name": "PasswordGeneratorWithRandomNumber",
    "type": "static",
    "attributes": {
        "value": "pass${randomNumber}word",
        "randomNumber": {
            "type": "randomNumeric",
            "attributes": {
                "requiresPeriodicRefresh": false,
                "length": 4
            }
        }
    },    
    "internal": false
}

-Abhinov

@Abhinov7

I tried given transform and when I refresh page each time it will generating different password.

You can see below screenshot same user each page refresh it is generating new password.

image

image

Hi,

Yes it will refresh every time. Requires periodic refresh will ensure it will not change the value at SailPoint refresh.

can you elaborate on the complete use case?

-Abhinov

Hey @pkumar22 ,

I would suggest you use $oldValue to tackle this situation.
What $oldValue will do is; if the value was already present previously it will give us that.
Consider using this:

{
    "name": "PasswordGeneratorWithRandomNumber",
    "type": "static",
    "attributes": {
        "value": "#if(!$priorValue.equalsIgnoreCase('N/A'))$oldValue#{else}pass${randomNumber}word#end",
        "randomNumber": {
            "type": "randomNumeric",
            "attributes": {
                "requiresPeriodicRefresh": false,
                "length": 4
            }
        },
		"priorValue": {
			"type": "firstValid",
			"attributes": {
				"values": [
					{
						"attributes": {
							"value": "$oldValue"
						},
						"type": "static"
					},
					{
						"attributes": {
							"value": "N/A"
						},
						"type": "static"
					}
				]
			}
		}
    },    
    "internal": false
}

Hope this helps… :slight_smile:

Or this way.
This checks if the identity.attribute has a value, and if not generates one:

{
  "name": "PasswordGeneratorWithRandomNumber",
  "type": "firstValid",
  "attributes": {
    "values": [
      {
        "type": "identityAttribute",
        "attributes": {
          "name": "extensionAttribute3"  #name of your attribute
        }
      },
      {
        "type": "static",
        "attributes": {
          "value": "pass${randomNumber}word",
          "randomNumber": {
            "type": "randomNumeric",
            "attributes": {
              "requiresPeriodicRefresh": false,
              "length": 4
            }
          }
        }
      }
    ]
  }
}

Phil

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.