Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Chrome, Firefox and Edge, Ntlm Liferay
Hello to everyone! This is my problem: I use Liferay 7.1 ga-2 and I would want use Ntlm on Chrome, Firefox and Edge, the solution to do this as follows:Take NtlmFilter.class and modify this sample code:
I proved to view this articles but I resolved nothing:
-Could try extending the Liferay module.
-Could try exporting the packages so they are visible, but since you can't replace a servlet filter using a service ranking, you'll need to have your own component that is active and disable the Liferay filter.
So I've an idea: this class (NtlmFilter.class) it's part of Liferay CE Foundation - Liferay CE Security SSO - Impl.lpkg for override the lpkg there is a guide https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/overriding-lpkg-files but: how decompile, modify, and re-compile a file jar?
It's a correct way? There are others ways? Please tell me some method to resolve this problem. It's more important.
[code] public boolean isFilterEnabled(HttpServletRequest request, HttpServletResponse response)
{
if (!this._browserSniffer.isIe(request)) {
return false;//[color=#ff0000][u]onliy [u]I[/u]nternet explorer can use NTLM[/u][/color]
}
}
IN[code]public boolean isFilterEnabled(HttpServletRequest request, HttpServletResponse response)
{
if (!this._browserSniffer.isIe(request)) {
return true;//[u][color=#ff0000]all browser can use NTLM now[/color][/u]
}
}
How to change or replace or override or modify this NtlmFilter.class?I proved to view this articles but I resolved nothing:
-Could try extending the Liferay module.
-Could try exporting the packages so they are visible, but since you can't replace a servlet filter using a service ranking, you'll need to have your own component that is active and disable the Liferay filter.
So I've an idea: this class (NtlmFilter.class) it's part of Liferay CE Foundation - Liferay CE Security SSO - Impl.lpkg for override the lpkg there is a guide https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/overriding-lpkg-files but: how decompile, modify, and re-compile a file jar?
It's a correct way? There are others ways? Please tell me some method to resolve this problem. It's more important.
My blog https://community.liferay.com/blogs/-/blogs/extending-liferay-osgi-modules shows how to build a new jar to be dropped in osgi/martketplace/override from the old jar, replacing what file you need to.
Be forewarned, however... The other browsers may or may not actually support NTLM authentication, some require additional browser-based configuration to support (i.e. it is not just on by default), ...
You may be under the impression that all you need to do is change this one class, but I honestly think it is going to require a lot more.
Plus it is untested so any failure, you won't have anyone to turn to for support; While we may know Liferay here, I can't even begin to tell you how to make NTLM work correctly in firefox or how you would even go about troubleshooting an NTLM authentication issue there...
Be forewarned, however... The other browsers may or may not actually support NTLM authentication, some require additional browser-based configuration to support (i.e. it is not just on by default), ...
You may be under the impression that all you need to do is change this one class, but I honestly think it is going to require a lot more.
Plus it is untested so any failure, you won't have anyone to turn to for support; While we may know Liferay here, I can't even begin to tell you how to make NTLM work correctly in firefox or how you would even go about troubleshooting an NTLM authentication issue there...
Thanks for reply! This is my project:

When I compile this project, I have the jar file that I can put in / liferay/osgi /marketplace/overraide. So I put the file in the overraide folder, I do the shoutdown on the Tomcat
server and restart the server afterI have an error, unresolved requirement: Import-Package : jcifs_ [Sanitized], why? In the ntlmFilter.bnd file I introduced Bundle-ClassPath (Bundle-
ClassPath: \ ., \lib/jcifs-1.3.17) and in the build.grandle file I introduced (group compiled: 'jcifs', name: 'jcifs', version: '1.3.17'). Why do I have that mistake?

When I compile this project, I have the jar file that I can put in / liferay/osgi /marketplace/overraide. So I put the file in the overraide folder, I do the shoutdown on the Tomcat
server and restart the server afterI have an error, unresolved requirement: Import-Package : jcifs_ [Sanitized], why? In the ntlmFilter.bnd file I introduced Bundle-ClassPath (Bundle-
ClassPath: \ ., \lib/jcifs-1.3.17) and in the build.grandle file I introduced (group compiled: 'jcifs', name: 'jcifs', version: '1.3.17'). Why do I have that mistake?
I have no idea. A screenprint of something in eclipse is of little use.
The build is controled by the build.gradle file and the bnd.bnd. Start there.
The build is controled by the build.gradle file and the bnd.bnd. Start there.
This is my bnd.bnd file
Bundle-Name: ntlmFilter
Bundle-SymbolicName: ntlmFilter
Bundle-Version: 1.0.0
Bundle-ClassPath:\
.,\
lib/jcifs-1.3.17
and this is my grandle.build
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "3.13.26"
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "com.liferay.plugin"
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile group: "com.liferay", name:"com.liferay.portal.security.exportimport.api", version:"2.0.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.sso.ntlm.api", version: "1.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.ldap", version: "1.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.sso.ntlm", version: "3.0.1"
compile group: 'com.liferay', name: 'com.liferay.portal.security.sso.ntlm', version: '4.0.5'
compile group: 'com.liferay', name: 'com.liferay.portal.security.ldap', version: '2.4.1'
compile group: 'com.liferay', name: 'com.liferay.petra.string', version: '2.0.0'
compile group: 'com.liferay.portal', name: 'com.liferay.portal.impl', version: '2.21.0'
compile group: 'jcifs', name: 'jcifs', version: '1.3.17'
//compile files('lib/jcifs-1.3.17.jar')
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
I don't understand why there is that error (Unresolved requirement: Import-Package : jcifs_ [Sanitized]) all dependencies are declared. Any Ideas? Thanks
Bundle-Name: ntlmFilter
Bundle-SymbolicName: ntlmFilter
Bundle-Version: 1.0.0
Bundle-ClassPath:\
.,\
lib/jcifs-1.3.17
and this is my grandle.build
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "3.13.26"
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "com.liferay.plugin"
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "3.0.0"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile group: "com.liferay", name:"com.liferay.portal.security.exportimport.api", version:"2.0.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.sso.ntlm.api", version: "1.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.ldap", version: "1.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.sso.ntlm", version: "3.0.1"
compile group: 'com.liferay', name: 'com.liferay.portal.security.sso.ntlm', version: '4.0.5'
compile group: 'com.liferay', name: 'com.liferay.portal.security.ldap', version: '2.4.1'
compile group: 'com.liferay', name: 'com.liferay.petra.string', version: '2.0.0'
compile group: 'com.liferay.portal', name: 'com.liferay.portal.impl', version: '2.21.0'
compile group: 'jcifs', name: 'jcifs', version: '1.3.17'
//compile files('lib/jcifs-1.3.17.jar')
}
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
I don't understand why there is that error (Unresolved requirement: Import-Package : jcifs_ [Sanitized]) all dependencies are declared. Any Ideas? Thanks
I think you'd be a lot better off if you removed the Bundle-Classpath directive from bnd.bnd and change the jcifs line in build.gradle to be:
The compileInclude directive will compile the code using the given dependency(ies) but also include them in the built module jar, taking care of any unresolved requirements.
compileInclude group: 'jcifs', name: 'jcifs', version: '1.3.17'The compileInclude directive will compile the code using the given dependency(ies) but also include them in the built module jar, taking care of any unresolved requirements.
Thank a lot for your patience.
-The compileInclude directive will compile the code using the given dependency(ies) but also include them in the built module jar, taking care of any unresolved requirements. -
I've include the dependecy jcifs in the built module jar and I'm sure to do include the correct dependecy in the built module jar beacuse if I for example use
Nevertheless the I've always that error.
(ERROR [Framework Event Dispatcher: Equinox Container: 2d5b9ae3-325d-4233-a574-346dd86244fc][ntlmFilter:97] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: ntlmFilter [3204]_ Unresolved requirement: Import-Package: jcifs_ [Sanitized])
Some Ideas? In the attachment you can see the jar file buil.
-The compileInclude directive will compile the code using the given dependency(ies) but also include them in the built module jar, taking care of any unresolved requirements. -
I've include the dependecy jcifs in the built module jar and I'm sure to do include the correct dependecy in the built module jar beacuse if I for example use
compileInclude group: 'com.liferay.portal', name: 'com.liferay.portal.impl', version: '2.21.0'
I've an error as that dependecy is not include.Nevertheless the I've always that error.
(ERROR [Framework Event Dispatcher: Equinox Container: 2d5b9ae3-325d-4233-a574-346dd86244fc][ntlmFilter:97] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: ntlmFilter [3204]_ Unresolved requirement: Import-Package: jcifs_ [Sanitized])
Some Ideas? In the attachment you can see the jar file buil.
Not all of the dependencies are compileInclude, just the jcifs one.
https://community.liferay.com/blogs/-/blogs/gradle-compile-vs-compileonly-vs-compileinclude
https://community.liferay.com/blogs/-/blogs/gradle-compile-vs-compileonly-vs-compileinclude
-Not all of the dependencies are compileInclude, just the jcifs one- (your answer)
Yes I know, only jcifs have this structure:
But I don't resolve nothing. I contiunue have this ERROR [Framework Event Dispatcher: Equinox Container: 5a6db8f6-eb44-4b44-b2c0-477922129a8a][ntlmFilter:97] FrameworkEvent ERRORorg.osgi.framework.BundleException: Could not resolve module: ntlmFilter [3204]_ Unresolved requirement: Import-Package: jcifs_ [Sanitized].
For take all files in com.liferay.portal.security.sso.ntlm.impl.jar I went in https://github.com/liferay/com-liferay-portal-security-sso/tree/master/portal-security-sso-ntlm/src/main/java/com/liferay/portal/security/sso/ntlm/internal download all, create a new Liferay Module Project and put that files in src/main/java. Then I compile with grandle.
Any solution?
Yes I know, only jcifs have this structure:
compileInclude group: 'jcifs', name: 'jcifs', version: '1.3.17'The others have a structure like this:compileOnly group: 'com.liferay.portal', name: 'com.liferay.portal.impl', version: '2.21.0'But I don't resolve nothing. I contiunue have this ERROR [Framework Event Dispatcher: Equinox Container: 5a6db8f6-eb44-4b44-b2c0-477922129a8a][ntlmFilter:97] FrameworkEvent ERRORorg.osgi.framework.BundleException: Could not resolve module: ntlmFilter [3204]_ Unresolved requirement: Import-Package: jcifs_ [Sanitized].
For take all files in com.liferay.portal.security.sso.ntlm.impl.jar I went in https://github.com/liferay/com-liferay-portal-security-sso/tree/master/portal-security-sso-ntlm/src/main/java/com/liferay/portal/security/sso/ntlm/internal download all, create a new Liferay Module Project and put that files in src/main/java. Then I compile with grandle.
Any solution?
Don't use master, that code is for the upcoming 7.2 release.
Stick w/ a 7.1 branch if that's what you're building for.
Stick w/ a 7.1 branch if that's what you're building for.
Maybe you should just add the .jar extension to the jar file name in theBundle-ClassPath line. (ClassPath: \ ., \lib/jcifs-1.3.17.jar)
Thanks for reply. I proved but nothing change. You have another solution?