Windows Ad Authentication using java
Hi,
My Requirement: We are using Java, JSP, Struts in our application.
We have a user login jsp page. Whenever user try signing by using the logiin page we have to use Ad(Active Directory) userid and Ad password available from operating system.
Can any one please suggest me how I can achieve this?
Thanks in advance
Best Regards,
Satish
1. Given a user name password and perhaps other information find out via the windows API how to 'log in'. This has nothing to do with java.
2. Write some C/C++ code that uses 1 to wrap that functionality in such a way that it describes what you want to do in your application. This has nothing to do with java.
3. Write a jni java class and C JNI code to wrap 2. This has something to do with java.
Similar Messages
-
How to set proxy authentication using java properties at run time
Hi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
GeorgeHi All,
How to set proxy authentication using java properties on the command line, or in Netbeans (Project => Properties
=> Run => Arguments). Below is a simple URL data extract program which works in absence of firewall:
import java.io.*;
import java.net.*;
public class DnldURLWithoutUsingProxy {
public static void main (String[] args) {
URL u;
InputStream is = null;
DataInputStream dis;
String s;
try {
u = new URL("http://www.yahoo.com.au/index.html");
is = u.openStream(); // throws an IOException
dis = new DataInputStream(new BufferedInputStream(is));
BufferedReader br = new BufferedReader(new InputStreamReader(dis));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//Close the input stream
dis.close();
} catch (MalformedURLException mue) {
System.out.println("Ouch - a MalformedURLException happened.");
mue.printStackTrace();
System.exit(1);
} catch (IOException ioe) {
System.out.println("Oops- an IOException happened.");
ioe.printStackTrace();
System.exit(1);
} finally {
try {
is.close();
} catch (IOException ioe) {
}However, it generated the following message when run behind the firewall:
cd C:\Documents and Settings\abc\DnldURL\build\classes
java -cp . DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:320)
at sun.net.www.http.HttpClient.New(HttpClient.java:315)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:510)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:487)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:615) at java.net.URL.openStream(URL.java:913) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
I have also tried the command without much luck either:
java -cp . -Dhttp.proxyHost=wwwproxy -Dhttp.proxyPort=80 DnldURLWithoutUsingProxy
Oops- an IOException happened.
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.yahoo.com.au/index.html
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1245) at java.net.URL.openStream(URL.java:1009) at DnldURLWithoutUsingProxy.main(DnldURLWithoutUsingProxy.java:17)
All outgoing traffic needs to use the proxy wwwproxy (alias to http://proxypac/proxy.pac) on port 80, where it will prompt for valid authentication before allowing to get through.
There is no problem pinging www.yahoo.com from this system.
I am running jdk1.6.0_03, Netbeans 6.0 on Windows XP platform.
I have tried Greg Sporar's Blog on setting the JVM option in Sun Java System Application Server (GlassFish) and
Java Control Panel - Use browser settings without success.
Thanks,
George -
How to manipulate Windows System Variables using Java
Hi There,
I want to manipulate Windows System variables (e.g. PATH, CLASSPATH) using Java program. Could anyone please let me know how it can be done in Java.
Regards,
Rakesh NagarThis is not just a Java question. It has never been possible in any Windows program to permanently change the value of an environment variable. You can only change it temporarily, and when the process that changed it ends, so does the change to the environment variable. This has been true since environment variables were added to DOS in about 1983.
-
Window shutdown when using java
Greetings, since a short time i've having probs when using the java.
For a time all goes well, but then the IE window just shuts down.
No warning or whatever....
Anyone any ideas?
Tnx in advancePossible a bug, probably and more likely something is corrupted. Not much you can do short of trying to reinstall if there are really no errors or dumps present. You should look in your System -> application log file first to see if there are in fact errors you are not seeing.
-
Executing WINWORD from both Windows and linux using Java
Dear All,
I have a problem when trying to use Runtime class to execute a winword document. My code is as follows.
Runtime r= Runtime.getRuntime();
try{
r.exec("rundll32"+" "+"url.dll,FileProtocolHandler"+" "+"WINWORD"+ " "+"file://C://welkom.doc");
catch(Exception ex){
System.out.println("Unable to open the doc file:"+ex);
When I execute this swing application with the above, the program is unable to open the specific file. And it says "Problem with the short cut, unable to open the file". When I run the program without the file name, it opens a new doc file.
Attn: what I want to do here is I need to open the winword file from both windows and linux. So I cannot use the relative path of the WINWORD.exe file.
Can anyone help me?
Thanks in advance.
Regards,
BalaIf you take a look at the api, there's an exec(String[]) method. This is the one you should use when calling a command with multiple parameters.
so something like...
String[] cmd = new String[] {"rundll32", "url.dll,FileProtocolHandler", "WINWORD", "file://C://welkom.doc"}
r.exec(cmd); -
How do I check processes running on a windows machine? using java?
like processes or services.
is there any way?The best thing would be to run the keychain on the older computer and expose the password.
I recall that some older passwords were not accepted on newer OSs. It was a bug from some years ago, as I recall, based on increased security levels. -
Accessing windows process table entries using java
Hello Everyone,
Can anyone help me by giving me an idea for acessing windows especially Windows 2000 professional using Java.@Op. You can't do that in pure Java
-
New "Windows Programming Using Java" Website
Our newly created "Windows Programming Using Java" website (http://fivedots.coe.psu.ac.th/~ad/winJava/) is for programmers who want to extend Java's capabilities on Windows XP and/or Vista, but aren't sure where to start. One of the drawbacks of Java's portability is that many Java programmers have a rather sketchy knowledge of Windows-specific programming.
We plan to explain how Java applications can utilize Windows application software, OS features, and hardware beyond the reach of Java's standard libraries. A variety of Java/Windows programming techniques will be explained, including:
* Java's employment of the Win32 API via C, JNI, and J/Invoke.
* Java's utilization of Window's Command Line Interface (CLI) and batch files, accessed through Java's Runtime, ProcessBuilder, and Process classes.
* Java and Windows object-based scripting, centered around the use of VBScript, Windows Script Host (WSH), and Windows Management Instrumentation (WMI).
* Java interoperability with COM, including hosting of ActiveX controls in Swing containers using jacoZoom.
This website is a work in progress, with four chapters available for download at the moment. We'll be adding more regularly, and would love feedback on what we're doing.
Thanks,
Gayathri Singh and Andrew Davison
[email protected] and [email protected]
Edited by: AndrewDavison on Jun 20, 2008 1:36 AMHi, I am looking the similar kind of requirement that you had done.. Do you have any more details on the code that is working for you . All i need is if the user logs in successfully in windows, the the app should be accessible. Please let me know if you have the code with you on this problem.
Thanks in advance
"what i meant is the we b applications running in my system, when i access the application iam able to to login automatically with windows authentication and now in case of other users following process happened:" -
Java webservice client with windows domain authentication
I'm writing (well attempting to) a Java web service client using netbeans that consumes a web service written in C#, that uses NTLM authentication.
If I consume the webservice from a .NET client, authentication isn't a problem; I can just pass the crediantails in on an engine object.
eg engine.Credentials = System.Net.CredentialCache.DefaultCredentials.
Upon consuming this webservice in java the Credentials method doesn't appear on the engine object like it doesn't with it's C# counterpart.
I assume that Java goes about a different way of doing windows domain authentication?
Cheersfor what ever reason it just seemed to start working.
-
Want to create a new folder in Windows using Java?
Hello everyone!!!
The situation is I want to create a folder using Java.
What I am doing is I am asking client to upload files.If the client is uploading for the first time a new folder is created on the server side and all the files related with that client will be uploaded in that folder only.Can anyone help me with the code.I am using html for letting client select the file to be uploaded and jsp to upload the file .The server I am using is Tomcat5.5 and OS is Windows Xp.
Please help me with the code or any alternate logic.
Thanks in advance.create a java.io.File object for the path you'd like your directory to have and call .mkdir() on it (or mkdirs() if you need to create a hierarchy of directories).
-
Using java on windows vista 64 bit
Hi, I am using a program for the univercity which use java, and it work fime on 32 bit operation systems such as ubuntu linux and XP/vista... but when I try to run it on the vista 64 bit on my AMD Athlon 64 bit I get the msg:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3184
at sun.awt.shell.Win32ShellFolder2.getFileChooserIcon(Unknown Source)
at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
at sun.awt.shell.ShellFolder.get(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$LazyWindowsIcon.cr
eateValue(Unknown Source)
at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
at javax.swing.UIDefaults.get(Unknown Source)
at javax.swing.MultiUIDefaults.get(Unknown Source)
at javax.swing.UIDefaults.getIcon(Unknown Source)
at javax.swing.UIManager.getIcon(Unknown Source)
at javax.swing.plaf.basic.BasicFileChooserUI.installIcons(Unknown Source)
at javax.swing.plaf.basic.BasicFileChooserUI.installDefaults(Unknown Source)
at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.JFileChooser.updateUI(Unknown Source)
at javax.swing.JFileChooser.setup(Unknown Source)
at javax.swing.JFileChooser.<init>(Unknown Source)
at javax.swing.JFileChooser.<init>(Unknown Source)
at SimulatorsGUI.ROMComponent.<init>(Unknown Source)
at SimulatorsGUI.CPUEmulatorComponent.<init>(Unknown Source)
at CPUEmulatorMain.main(Unknown Source)
I tryed to istall the 64 bit java but could not since when I tryed it said that my CPU does not support this program..
Any solution?
Thanks
AmirYes.
Mylenium -
How to access a file in Unix server from windows using java
I want to access a file in unix server from windows using java program.
I have the following code. I am able to open the url in a web browser.
String urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
URL url = new URL(urlStr);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream)));
String inputLine;
while((inputLine=in.readLine()))!=null){
System.out.println(inputLine);
in.close();
I get the following error
java.io.FileNotFoundException: /javatest/test.csv
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:333)
at java.net.URL.openStream(URL.java:960)
at com.test.samples.Test.main(Test.java:45)urlStr="ftp:user:passwd@unix-server:ftp-port//javatest/test.csv;type=i";
I have given the format of the urlStr that I am using in the code. The actiual values are used in my code. I have tried pasting this url in the browser and it opens the file. -
New to Java Script(Want to open a new window using Java Script)
Hi all,
I am new to using Java Script. Now I have a HTML(First.html) page with a ADD button at the end of the page. What I want to know is, if I drag and select some part of the First.html and click on the ADD button a second HTML page(Second.html) should open displaying only the selected contents....
Please help :-(myRef = window.open(self.location,'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); -
How to Use Windows XP theme in Java
How to Use Windows XP theme in Java.
I am an developing application which L&F should be like Windows XP.
Because I am going use this application in different OS.
Which LookAndFeel I have to use ittry this in main:
try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}
catch (Exception exc) {System.err.println("Eroare la incarcarea look & feel" + exc);} -
Use java code to start ftp server in Windows
I am writing an application using java to start the FTP server on Windows system Could anybody give me an idea on how to start?
http://java.sun.com/docs/books/tutorial/
http://java.sun.com/developer/onlineTraining/Programmin
/BasicJava1/compile.html
http://java.sun.com/learning/new2java/index.html
http://javaalmanac.com
http://www.jguru.com
http://www.javaranch.com
Bruce Eckel's
Thinkin
in Java
Joshua Bloch's
[url=http://www.amazon.co.uk/exec/obidos/Author=Bloch,%
0Josh]Effective Java
Bert Bates and Kathy Sierra's
[url=http://www.amazon.com/exec/obidos/tg/detail/-/0596
04656?v=glance]Head First Java
lol. That's one way to start.
But really, why would you want to start an ftp server from java?? You should use the right tool for whatever job you need to accomplish and you can set up windows to automatically start the server when it boots.
majinda might say: it si lkie thrownig chickne at palm to knock datse to ground. bettre to let donkey kick tree.
But if you insist, you'll probably need JNI.
Maybe you are looking for
-
OK. Equipment: Syncmaster 305t delivered up to 2560 resolution with the same cable when connected to Windows machine (will be relevant). New Mac Mini with HDMI out and HDMI to DVI converter (the one apple bundles). It LOOKS like a DVI-dual (I think
-
Problem with Call transaction method in function module
Dear Frndz, I am converting its services into webdynpro. I developed a rfc[function module] for travel management [TRIP] . In that rfc i used call transaction method[BDC] to upload the data. The same rfc will be called from the
-
Form on screen, not updating for new data on inputstream
I'm writing a j2me midlet that will initiate a bluetooth connection to another device. I have been able to set up the inputstreams and outputstreams and send some data between the two devices using serial port emulation. The following is the code for
-
I purchased a game name Einstein and I can't see it , it doesn't show up in the menu!?
-
I have an hp gateway lap top computer I think model E56R49u, and believe my wireless is turned off and there is no button to click on or anything. Can anybody help?