Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing to folder with specific user access.  RSS feed

 
Paul Yule
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a webApp that is generating a PDF. I'm looking for a way to write the PDF to a directory that only allows "User1" access to the folder. The password for "User1" is retrieved through a webservice using a stored key on the server. I don't know how I'm supposed to set the User/Password before writing the file to directory. Normally, I think this just uses the username and pass that the application was started under. I feel like I've looked everywhere for these options. Is this doable?
 
Stephan van Hulst
Saloon Keeper
Posts: 7706
141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't done this before in Java, but you can try messing with java.security.auth.Subject.doAs(Subject, PrivilegedAction), where you pass the user credentials using a Subject and open the file inside the PrivilegedAction.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!