- Customize httpd configuration file
<Location /restrict/contents>
Require all denied
AuthName "Protected Contents"
AuthType Basic
AuthUserFile /www/svn/etc/passwd
<RequireAny>
#Require user google
Require valid-user
</RequireAny>
</Location>
- Create password file
The password is encrypted with MD5, example: 5he#t?+lfRos07zonon7$ htpasswd /www/svn/etc/passwd google
- Restart/Reload httpd daemon
# systemctl reload httpd Encrypt username:password for 'Authorization:' header
$ echo google:5he#t?+lfRos07zonon7 | base64
Z29vZ2xlOjVoZSN0PytsZlJvczA3em9ub243Cg==
- Call with curl
curl --location --request POST 'https://www.goweekend.ca/restrict/contents' \
--header 'X-Authorization-Role: AUTHENTICATED' \
--header 'Authorization: Basic e3thdXRoLmFjY2Vzcy5rZXl9fTp7e2F1dGguYWNjZXNzLnNlY3JldH19' \ -H 'Content-Type: application/json' -d '{ "userid":"00019317", "lastName":"Qin"}'
Tuesday, November 24, 2020
HTTPD 2.4 Location Basic Authentication
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment