BASIC Authentication with Apache

Create user.txt with the username and password separated by colon

user.txt
testuser:testuser

Then use the htpasswd to encrypt the password

Apache2\bin>htpasswd.exe -b user.txt testuser testuser
Automatically using MD5 format.
Updating password for user testuser

Add the following in the httpd.conf file present in C:\Program Files\Apache Group\Apache2\bin

LoadModule weblogic_module modules/mod_wl128_20.so

<Location />
SetHandler weblogic-handler
WebLogicHost localhost
WebLogicPort 7001
Debug ALL
WLLogFile c:/muthu/wlproxy.log
WLTempDir c:/muthu
AuthUserFile C:/muthu/user.txt
AuthName “This is a protected area”
AuthType Basic
Require valid-user
</Location>

Also copy WL_HOME\server\plugin\win\32\mod_wl_22.so to C:\Program Files\Apache Group\Apache2\modules

Restart the Apache Server.

Now if we try to access any unprotected resource on Weblogic Server, a BASIC Authentication Window will be popped up for authentication against Apache.

If authentication is successful, the request will go through provided we set the following in the config.xml

<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

Otherwise Weblogic Server will try to validate the BASIC authentication Header.

Leave a Reply