Retrieve NT Authentication details using java
Need to get the OS user name and password of the remote client machine from which accesses the server Application in my machine.
How to do this using java? Is there any java API to get this?
Also tried the NTLM code but its not working.
Any code will be appreciated.
Need to get the OS user name and password of the
remote client machine from which accesses the
server Application in my machine.
How to do this using java? Is there any java API to
get this?
Also tried the NTLM code but its not working.
Any code will be appreciated.Forget it. You can't get the password unless you ask the user for it.
Kaj
Similar Messages
-
Fetching NT Authentication details using java
I am accesing a jsp page of tomcat server in my machine from a browser client in another machine.I have to fetch the OS User name with which the user logged in the client machine using java.I tried using request.getRemoteHost() but it returned null.
I tried using NTLM .This is the code which i used
<%@ page language="java" import="java.io.*,java.util.*,java.lang.* " %>
<%@ page import="org.castor.util.*"%>
<%
String auth = request.getHeader("Authorization");
if (auth == null)
response.setStatus(response.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM");
response.flushBuffer();
return;
if (auth.startsWith("NTLM "))
byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
int off = 0, length, offset;
if (msg[8] == 1)
byte z = 0;
byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S', (byte)'S', (byte)'P', z,(byte)2, z, z, z, z, z, z, z,(byte)40, z, z, z, (byte)1, (byte)130, z, z,z, (byte)2, (byte)2, (byte)2, z, z, z, z, z, z, z, z, z, z, z, z};
response.setHeader("WWW-Authenticate", "NTLM " + new sun.misc.BASE64Encoder().encodeBuffer(msg1));
response.sendError(response.SC_UNAUTHORIZED);
return;
else if (msg[8] == 3)
off = 30;
length = msg[off+17]*256 + msg[off+16];
offset = msg[off+19]*256 + msg[off+18];
String remoteHost = new String(msg, offset, length);
length = msg[off+1]*256 + msg[off];
offset = msg[off+3]*256 + msg[off+2];
String domain = new String(msg, offset, length);
length = msg[off+9]*256 + msg[off+8];
offset = msg[off+11]*256 + msg[off+10];
String username = new String(msg, offset, length);
out.println("Username:"+username+"<BR>");
out.println("RemoteHost:"+remoteHost+"<BR>");
out.println("Domain:"+domain+"<BR>");
%>But it didnt work.Should i configure my environment in any way for NTLM to work?
Is there anyother way to do this.Any code will be appreciated.
Thanks,
VigneshJSP's execute on the server and not on the client machine. So I'm not sure how you exect to get details from the client here. Not to mention that JSP you wrote is pretty nasty IMO.
-
How to retrieve data from MDM using java API
hi experts
Please explain me the step by step procedure
how to retrieve data from MDM using java API
and please tell me what are the
important classes and packages in MDM Java API
thanks
ramuHi Ramchandra,
You can refer to following links
MDM Java API-pdf
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49
webinr of java API
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/89243c32-0601-0010-559d-80d5b0884d67
Following Fourm Threads will also help.
Java API
Java API
Re: usage of java API ,
Matching Record
Need Java API for Matching Record
Thanks and Regards,
Shruti.
Edited by: Shruti Shah on Jul 16, 2008 12:35 PM -
Retrieve OS up time using java
How to retrieve the Operating System's up time using Java.
avila wrote:
Hi,
I'm wondering if someone found a better solution than parsing a result from a OS call.
I was trying with System.nanoTime() function which seems to return the number of nanoseconds since the computer was turned on, but the Java documentation does not say much about where the nanoTime value comes from.
Any help?If I recall correctly, the docs say it's an offset from "some epoch," meaning a given implementation can use whatever it wants as time zero.
As far as I know, there's still no pure Java way to do this. -
Need help in getting MDM relationship details using Java Apis
Hi,
Is it possible to search records which are in relationship using Java Apis? Suppose Record A is Parent record and Record B,C,D ... are child records.
I have to search all the records which are in relationship with record A.
Can any one send code snippet on this.
Regards,
NirajHi Niraj,
You can use RetrieveRelationshipsCommand api to get the relationship child of the Anchor Record.
RetrieveRelationshipsCommand command = new RetrieveRelationshipsCommand(connectionAccesor);
command.setSession(session);
command.setAnchorRecord(anchorRecord); / command.setAnchorRecordId(anchorRecordId); (use any of the two statements)
command.setRelationship(relationshipId); //For child int type is 10, and for Parent_child int type is 5
command.setMemberResultDefinition(resultDefinition);
command.execute();
//Get Member Records' resuld definition
ResuldDefinition rd = command.getMemberResultDefinition();
Hope this helps you. -
Connectiing to PAMS - Pluggable Authentication Module using JAVA
Hi,
I am working on a security issue where there is PAM on the unix machine. How can I connect to that PAM using java? As I am new to this PAM concept, please give me a lead as of how can I do it using JAVA.
Thanks in advanceHi,
The usually procedure is to use ipsadmin change component iwtauth cust_auth.xml where cust_auth.xml has the attributes and values for the new module you have added. In your case you can try changing the client detection attribute alone using the ipsadmin command.
The first step is to modify the existing
<b> iwtAuth-clientDetectionEnabled </b>
attribute to have a new value and changeing again to have the right(correct) value.
Regards,
Raj_indts
Developer Technical Support
Sun Microsystems http://www.sun.com/developers/support -
Master detail using using java
Hi ,
I am using jdev 11.1.1 5
My requirement to create master detail using java code.My view don't have view link.How to achive through codeWhy cant u use view link..
btw you can see this
http://www.techartifact.com/blogs/2013/08/master-detail-iterations-using-tree-component-by-managed-bean.html -
Is it possible to retrieve Address Book from MS Exchange using Java IMAP
My JSP is required to display all valid email address to end user.
Is there any way i can retrieve Name & Email information (Address Book) from M.S Exchange server using Java implementation of IMAP protocal?
I believe M.S Exchange server is IMAP compatible so i should'nt be required to do any configuration on mail server side ?
If somebody has recently done this please share the implementation details , thanks,.
Please also let me know how to attach duke dollars with this thread.No, because that Java implementation you refer to is completely oriented towards handling messages. The Exchange address book has nothing to do with that.
-
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 make use of Windows authentication from my Java application
I have a Java application, Instead I design one more login page for my application, I want to make use of Windows Authentication.
How should I use that windows authentication in my java application
can any help me in suggesting a solutionHow will they be able to access your application if they aren't users of the system?
-
Re: Retrieve user role using Java
Dear all,
I have defined a role, says "Operator" in the Sun one Server. I tried to write a Java program to retrieve the role for my web application, but not successful. It only displayed the attribtues shown in Custom Editor such as givenName, cn and etc. But the attribute "nsrole" was shown in Generic Editor which I cannot retrieve in the Java Program.
How can I retrieve it using Java Program with using standard Java API only?
Regards,
CalvinThat attribute is an operational attribute. You must specify it in the list of attributes to retrieve in your search command.
-
How & where to use Java script to create new button in object detail page
Hi All,
I want to create "New/Add button" in object detail page. If i am not wrong i need to use java script for that but could you please let me know how & where to use Java script to create new button in object detail page in CRMOD.
Thanks in advance.
Regards,
ManishAny related object on the detail page should have an "Add" or "New" or both buttons by default - This is vanilla functionality and will do the required action.
If you want to modify this behaviour and do something tricky you will potentially have to go for javascript. You should add the javascript on a custom web tab on that Object.
Admin --> Application Customization --> Contact -->Contact Web Applet
Now, add your javascript in the code area, after you select the type = HTML for this web applet, expose this web applet on the Contact detail layout and your javascript will be invoked whenever this page is loaded.
Check this online document to see how javascript can be embedded in CRM on Demand http://helponmyproject.com/TTOCOD/
Cheers!
Royston -
How to retrieve CPU id in linux using java?
Hello everyone!!
I want to retrieve CPU Id from a liux system using java code.
Please reply with code if possible.
Thank you in advance.Open "/proc/cpuinfo" and parse.
-
Information Retrieval with Genetic Programming using J2ME and Java WTK
i have a big project to make a software using java programming especially n using J2ME and Java Wireless Toolkit, and i'm a begginer for java programming. I have no idea for the interface and how to setting connection between my phone mobile and GPRS. what should i do? thank you
I believe MIT has lots of sourcecode. Try searching their site.
-
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,
Satish1. 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.
Maybe you are looking for
-
Document templates with reference not working anymore with CRM2007 on SP7
Since we upgraded our CRM system(v 2007) to SP7 we are facing a serious problem with our document templates. The document templates do not contain any reference anymore (e.g. BP name and address details). This issue is a showstopper for the SP upgrad
-
Documents in business blueprint do not open
Hi, I have uploaded some documents in the "Project Documentation" tab in SOLAR01. However, after generating the blueprint, when I click on the link (document name), the document does not open at all. There is no error. I have installed SAP GUI 7.20 T
-
Hide unhide rolemenu in web with only one link
Hi together is it possible to hide unhide the role menu in web with only one link by using command urls? Regards, M. Erbil
-
Hi All, My database is performing very slow. Is there any thing which can tell me what is the state of my database and what problems it has and what kind of changes I need to do to make it better with respect Memory, Physical etc. I had enough SGA_MA
-
Cannot get Keyboard Shortcuts or create new
After updating to iOS 7.0.6 my iPhone 5S lost all keyboard shortcuts. I am currently not able to get them from iCloud or even create new ones. After saving a new one it does not appear under the shortcuts and is not working with the keyboard. I have