在Java中,是否可以通过活动目录对用户进行身份验证,然后执行用户具有权限的任务?

时间:2021-12-21 02:58:47

I have a java app that is running as a service on a server.

我有一个在服务器上作为服务运行的Java应用程序。

The service is running as the local system user. Which does not have access to folder XYZ

该服务作为本地系统用户运行。哪个无法访问文件夹XYZ

However, let's say there is a user, who does have access to folder XYZ. Is it possible for this user to somehow login through the java app, thus giving the app permission to access the folder?

但是,假设有一个用户可以访问文件夹XYZ。该用户是否有可能以某种方式登录java应用程序,从而授予应用程序访问该文件夹的权限?

The network revolves around active directory.

网络围绕活动目录。

2 个解决方案

#1


0  

not really... the app while its running has only the privilege of the user account that started it..

不是真的...应用程序运行时只有启动它的用户帐户的权限..

now if you want to do some activity as a different user (when you have his/her credentials) you can start a new process & do the activity in it.

现在,如果您想以不同的用户身份进行某些活动(当您拥有他/她的凭据时),您可以启动一个新流程并在其中执行活动。

on windows you can say runas /user:<<username>> <<command to run>>. again this requires sufficient privilege to execute the runas command & the runas service must be running.

在Windows上你可以说runas / user:< <用户名> > < <命令运行> >。再次,这需要足够的权限来执行runas命令并且runas服务必须正在运行。

you could also try to start another instance of your app (but I wouldn't recommend this)

你也可以尝试启动你的应用程序的另一个实例(但我不建议这样做)

#2


0  

If you can install the server as a Windows service then you can chose the user that will be used to run the server. If you chose the user to be one that has access to the required folder, then your app will also have access to the folder.

如果您可以将服务器安装为Windows服务,则可以选择将用于运行服务器的用户。如果您选择的用户是可以访问所需文件夹的用户,那么您的应用也可以访问该文件夹。

On the run command or command prompt, run services.msc. Look at the 'Log On As' column of the services. 'Log On As' is set to 'Local system' by default. If you right-click the service and go to its properties, the Log On tab will have an option to start the service under any user that you desire.

在运行命令或命令提示符下,运行services.msc。查看服务的“登录身份”列。默认情况下,“登录身份”设置为“本地系统”。如果右键单击该服务并转到其属性,“登录”选项卡将具有在您希望的任何用户下启动服务的选项。

As for install a new windows service to automatically start your server with, try http://wsinnovations.com/softeng/support/manualservice.html

至于安装新的Windows服务以自动启动服务器,请尝试http://wsinnovations.com/softeng/support/manualservice.html

#1


0  

not really... the app while its running has only the privilege of the user account that started it..

不是真的...应用程序运行时只有启动它的用户帐户的权限..

now if you want to do some activity as a different user (when you have his/her credentials) you can start a new process & do the activity in it.

现在,如果您想以不同的用户身份进行某些活动(当您拥有他/她的凭据时),您可以启动一个新流程并在其中执行活动。

on windows you can say runas /user:<<username>> <<command to run>>. again this requires sufficient privilege to execute the runas command & the runas service must be running.

在Windows上你可以说runas / user:< <用户名> > < <命令运行> >。再次,这需要足够的权限来执行runas命令并且runas服务必须正在运行。

you could also try to start another instance of your app (but I wouldn't recommend this)

你也可以尝试启动你的应用程序的另一个实例(但我不建议这样做)

#2


0  

If you can install the server as a Windows service then you can chose the user that will be used to run the server. If you chose the user to be one that has access to the required folder, then your app will also have access to the folder.

如果您可以将服务器安装为Windows服务,则可以选择将用于运行服务器的用户。如果您选择的用户是可以访问所需文件夹的用户,那么您的应用也可以访问该文件夹。

On the run command or command prompt, run services.msc. Look at the 'Log On As' column of the services. 'Log On As' is set to 'Local system' by default. If you right-click the service and go to its properties, the Log On tab will have an option to start the service under any user that you desire.

在运行命令或命令提示符下,运行services.msc。查看服务的“登录身份”列。默认情况下,“登录身份”设置为“本地系统”。如果右键单击该服务并转到其属性,“登录”选项卡将具有在您希望的任何用户下启动服务的选项。

As for install a new windows service to automatically start your server with, try http://wsinnovations.com/softeng/support/manualservice.html

至于安装新的Windows服务以自动启动服务器,请尝试http://wsinnovations.com/softeng/support/manualservice.html