Network Authentication

M

Marco Roda

Hi,

I need to access a network resource that requires authentication
(user/password): typically when I access through Windows Explore the network
shared folder:
\\<server>\<shared_folder>
I am required to supply username and password.
How to implement it in Java code and supply the information required?

Thank you,
Marco
 
A

Abhijat Vatsyayan

You might want to try executing (Runtime.exec ) a command like this -

"net use \\server\shared-folder password /USER:username " before
trying to access any files on this folder.
So if the server name is "myserver.mycomp.com" , shared folder name is
"net-share", user name is "marco" and password is "marco123", this
command will look like -
net use \\myserver.mycomp.com\net-share marco123 /USER:marco

Note that this will make "net-share" accessible on the computer to other
processes as well and any user working on the computer will be able to
get to this share without providing user id and password.

Are you sure that you need to access your files this way though? What
about using some other network protocols for accessing this network
resource ?

Abhijat
 
M

Marco Roda

Thank you,

That should work, but I think it is not the right way, as you said.
Currently I am trying using Perl NetResource module...
Marco
 
R

Rogan Dawes

Marco said:
Hi,

I need to access a network resource that requires authentication
(user/password): typically when I access through Windows Explore the network
shared folder:
\\<server>\<shared_folder>
I am required to supply username and password.
How to implement it in Java code and supply the information required?

Thank you,
Marco

This is a very vague request, but if I understand what you are asking
correctly, you may be able to achieve what you are after using jcifs.

Google for it.

Rogan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top