Lab 5.2 - Create Users from the Secret

1. Login to cluster

oc login -u admin -p rahasia

2. Extract the file data from the secret into the temp file.

oc extract secret/htp-secret -n openshift-config \
 --to - > /root/temp
cat /root/temp

3. Create new users and place into the temp file.

htpasswd -b /root/temp manager rahasia
htpasswd -b /root/temp leader rahasia

4. Verify the manager user and hashed password exist

cat /root/temp

5. Add user from the temp file

oc create secret generic htp-secret \
  --from-file htpasswd=/root/temp --dry-run=client -o yaml \
  | oc replace -n openshift-config -f -

6. Verify user login

oc login -u manager -p rahasia

# If fail, try login again. It takes time to sync.

7. Create a new project named auth-provider

oc new-project auth-provider

8. Verify that the developer user cannot access the project

oc login -u developer -p rahasia
oc delete project auth-provider