Monday, December 17, 2012

How we can provide custom authentication for apache webserver

How we can achive ?
Create authen.txt with the username and password separated by colon
authen.txt
sampleuser : sampleuser
Then use the htpasswd to encrypt the password
Apache2\bin>htpasswd.exe -b authen.txt  sampleuser sampleuser 
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:/Saple/wlproxy.log
WLTempDir c:/Saple
AuthUserFile C:/Saple/ authen.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.

No comments:

Post a Comment