htpasswd is one of the identity providers in openshift. In order to access OCP cluster have to create users, the users can create using htpasswd command, it has many options can use appropriately.
-c Create a new file. -n Don't update file; display results on stdout. -b Use the password from the command line rather than prompting for it. -i Read password from stdin without verification (for script usage). -m Force MD5 encryption of the password (default). -B Force bcrypt encryption of the password (very secure). -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31). -d Force CRYPT encryption of the password (8 chars max, insecure). -s Force SHA encryption of the password (insecure). -p Do not encrypt the password (plaintext, insecure). -D Delete the specified user. -v Verify password for the specified user.
The syntax for creating a new user with htpasswd is:
# htpassswd -b [htpasswd/file/path/] [user-name] [password
[htpasswd/file/path/] this path can find in the master configuration file /etc/origin/master/master-config.yaml below oauthConfig: sanza.
To add or update a login to the file, run:
# htpasswd [/path/to/users.htpasswd] [user_name]
The syntax for deleting a user with htpasswd is:
# htpasswd -D [htpasswd/file/path/] [user-name] [password]
it will remove only the username from the htpasswd file by default it won’t remove user identity so we should remove user identity as well if not – whenever new user created with old username it will give error: “Login failed (401 Unauthorized) and Error from server (InternalError): Internal error occurred: unexpected response: 500.”
# oc delete identity htpasswd_auth:user