简体   繁体   中英

Java - Authenticate user using web application's security framework without Http requests

So I have a Tomcat server within a Java web application, authentication is done using Tomcat's usernames and passwords specified in the tomcat-users.xml file, and form based authentication (posting to j_security_check ). I have now also registered a remote object (using Java RMI) that I want to access from outside of the web context, from an eclipse plugin.

My intention is to obtain the remote object which has a method

public AnotherRemoteClsWithRestrictedMethods login(user, pass);

and then the implementation uses the web application's security framework to verify the user and password combination. If valid, would then return another object with restricted methods.

How would I go about obtaining / querying the web application's security details?

Note: I do not have an HttpRequest object, should I call another URL to verfiy the user? Any other ways?

Thanks in advance.

j_security_check is a HTTP based authentication. You'll really need to fire a HTTP request. You can use java.net.URLConnection for this, or the more convenienced Apache Commons HttpClient .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM