We might have a requirement to specify/hardcode the password for an account when we are creating it through SOAP API so that the application that initiates the API call knows what the password is and can display or provide it to the user. One common use case is a Kiosk that a user operates which is programmed to make an API call to create a guest account in Clearpass with a password of its choice so that it can print out a badge for that user with that password.
We need to make sure that we use the field random_password to initiate the API call with the value you want as the password for that account. Please find the sample C# code that creates an account with the password for that account set to "thisisatest".
UserType createRequest = new UserType();
createRequest.username = "email@example.com";
createRequest.creator_accept_terms = true;
createRequest.creator_accept_termsSpecified = true;
createRequest.role_id = "2";
createRequest.random_password = "thisisatest";
IdResultType createResponse = client.CreateUser(createRequest);
This should create an account with the username "firstname.lastname@example.org" and User role "2" with the password as "thisisatest".
This article assumes that the configuration to get SOAP API working is already done. This article is specific to hardcoding the password when making an API call.
You can follow the 6.5 Guest User Guide to get the instructions on how to get SOAP API working. You can find it under SOAP API Services section from Page number 419 in the 6.5 Guest User Guide.
You can login to the ClearPass Guest Module and verify the password for the account created through the API and it would show that the password is set to the string we specified in the API call which is "thisisatest" in this case.
Please note that you need to have the password display turned on under ClearPass Guest >> Configuration>>Guest Manager>> Check the box for Password display to be able to see the password for an account.