Integration of NTLM is supported with only Internet Explorer due to security issues.
To enable NTLM for other browsers, follow below instruction make necessary changes in NTLMFilter.java
Below is OOB code
@Override
public boolean isFilterEnabled(
HttpServletRequest request, HttpServletResponse response) {
try {
long companyId = PortalInstances.getCompanyId(request);
if (BrowserSnifferUtil.isIe(request) &&
AuthSettingsUtil.isNtlmEnabled(companyId)) {
return true;
}
}
catch (Exception e) {
_log.error(e, e);
}
return false;
}
Before Authentication liferay will perform check whether NTLM is enabled or not and also checks whether current browser is IE only.So in case if you try to access site with browser other then IE in that case you will see login screen and user will not be authenticated automatically.
So just to enable NTLM with other browser you have to override isFilterEnabled() method.
Remove check for IE and the updated code will be like this .
@Override
public boolean isFilterEnabled(
HttpServletRequest request, HttpServletResponse response) {
try {
long companyId = PortalInstances.getCompanyId(request);
if (AuthSettingsUtil.isNtlmEnabled(companyId)) {
return true;
}
}
catch (Exception e) {
_log.error(e, e);
}
return false;
}
About BrowserSnifferUtil
BrowserSnifferUtil is one of the good API which can help you to detect your current browser and operating system based on user agent.
BrowserSnifferUtil.getBrowserId(httpRequest)
Abvoe method will return string . If you current browser is Internet Explorer then this method will return ie .
If your current browser is FireFox then it will return firefox and for remaining browser it will return other.
BrowserSnifferUtil.isIe(httpRequest) will retuen true if your current browser is IE. There are other methods in this util to check for Mozila , chrome , safari etc.
You can also check your current operating system using this util.
like isWindows(httpRequest) method will check if current operating system is windows or not.
0 comments:
Post a Comment