Best way to set configuration to a database - java

First, this is not a programming question, yes I know.
Now, I am developing a custom software (Java Swing) for a company as a sub contracting company. I create the code and database (MySQL), send them via a protected method online and their IT people install it there by them selves. I cannot reach their place as I am in a far far away city.
I am having a problem with the database, that is, should I hard-code the database configurations into the Java swing application (or .properties file) or else should I allow the user to decide the password, user name and server IP ? Which means user can edit them at any time, I am planning to use java.util.pref.Preferences in that case.
However I have heard that lot of development companies do not allow the user to edit the password, user name etc, mainly because they might go and edit the database.
So right now I am confused. which method should I select? Hard coding the configurations or allowing dynamic configurations? Any advice please?

Related

UI to control machine access

I've a generic design question. Hope you folks can help me. Our technology stack is Java, Angular, Spring and REST. We wish to implement a reservation system (to reserve machines/servers) so that if one user wishes to ssh to a machine then they first reserve it one our UI and then they only can use it and no-one else can.
Do you guys know a way/technology/design where we could control access to machines this way (possibly something like LDAP) ?. Even something where the user logs into our UI, reserves the box by clicking a Reserve button etc and then clicks a Launch button - which could then launch an actual ssh command window or a remote desktop access session etc. In this way we could set a certain predefined username+password for our boxes (which our application could control) and we can allow users to connect to boxes via our UI.
Wondering if any one you had to do anything similiar to this before or if there is anything obvious I'm missing. Is it easy to "launch" a remote desktop connection or indeed an ssh terminal from java.
I'm fine with the UI part, rest, java etc. It's more the connections / logic to the remote machines that I'd like to get peoples thoughts on.
Sorry if this is too generic. I'd like to get some directions on it.
Any thoughts/guidance would be great.
Thanks - Ro

Update client computer using web application

I am developing an e-commerce web application, and in that ads from other giants pop up. I figured out that this is done by PriceFountain, which is actually a spyware. I found the steps to remove that from my laptop. more found here.
but the problem is my clients can also have this adware. I want to programmatically do following or either of them, on the client side:: (and if it is not possible at least inform the user to do so)
If, PriceFountain is present, uninstall it from their system. If it is an add-on, remove that.
Activate the pop-up blocker (deactivation can be achieved through javascript and jquery). But I want to activate. My site does not need pop-ups.
Alter the registry of user for the contents of PriceFountain.
I know this is somewhat an unethical hack, but can this be achieved and if so, how?
More of that, it is just my curiosity can we affect client site settings.?
You used to be able to do that (with jscript/vbscript) in IE if and only if the user added your site to his trusted sites (and allowed pretty much everywhere there), or if it was the intranet-site with relaxed permissions.
Back in the old day's I had such a thing for the intranet-help-site where users could browse through the faq and click on the 'execute solution' button for the common 'problems' (previously solved and added to DB).
For rather obvious security-reasons this is no longer the case (although one can still pull some stuff in legacy IE environments).
The point is: you can't do this on other browsers then IE (unless maybe you'd develop separate plug-ins for them and ask your users to install something that will essentially give you access to their whole machine). Realize that effectively what you are asking for is a way to fully control the user's machine. Would you install such a browser (on your parents pc)?
The best course of action would be to face-up, inform your users on your main-website (enter-page) that something bad spread throughout an ad-network and guide them through the steps (that you already found) necessary to relieve them from their problem.
Even if what you asked was possible, you'd still need the user's cooperation somewhere along the way, even if you'd were to write an application for this that the users could download and run (administrative/elevated)..
Good Luck!
EDIT: for the registry you might try something with the answers in this question: read/write to Windows Registry using Java
Still, you'd still need the user's co-operation.

Authenticating from PHP to Java and retrieve data via WSDL

Ok, so I inherited a project where our core program is built by another company (built in Java) and I have to build another program around it. Problem is that the Java program has to stay as is and I am only allowed to authenticate through to it and pull the findings once users go through there. I am not even sure what to ask for cause I've never cross authenticated before nor used a WSDL etc...
I am an intermediate/advanced PHP coder and would have rather built the entire thing from the ground up (it would be faster and customizable) but, i can't. this java application needs to stand on its own--maybe in an iFrame--and once our users sign into our site, they need to automatically signed in there so when they click on it from the panel, they perform their actions which mark them complete there. We read their completion and mark them complete on our side (via PHP). Their develops have a WSDL file that supposedly we pass the information and we can read their completion and status stuff. No idea how to use it.
The dev environment is IIS 7 (im more used to linux and unix environments)
Any idea where I should start? How to do this? What questions I should ask their developer for so I can develop the PHP side of things?

How can I check if user has alread logged in into Windows Active Directory

I've got a problem and since I am new to login/authentication stuff, I do not have clear vision about where to find the answer.
Here is the issue:
I am going to create webapp ( jsf with primefaces + ejb3 ) which allows users be logged into it without login dialog - which means, that all the auth info, about user's roles, groups etc must be gathered from Active Directory. How can I get that ? How can I get users info, if user did not provide at least his or her user name ? What about I must ask Active Directory domain?
Can somebody provide if not working one than at least pseudo-code?
If you are talking about Windows systems, Microsoft offers two protocols that are able to do SSO (Single Sign On), which is what you are looking for: NTLM and SPNEGO (a variant of Kerberos).
The answer to your question depends a bit on the operating system your application will run on. If that is Windows, then there are a couple of options that use the Windows API to make it a lot easier. (mod-auth-sspi, Waffle)
If you are running other systems, you have to use libraries that provide the whole stack like Jespa, modauthkerb or others.

Java applet to connect different users to a shared screen window

No, Im not asking for a full made program :) Im kind of new to Java as language so Im not familiar with java libraries at all and my experience is mostly about php, but I understand OOP well.
My scenario:
I want to build a Java applet to my website, by which different users can share a same screen window in which they can drag and drop things(images) to specific positions and when one does, it would update the screen to the others. Before connecting, user would choose to build a new screen or join other. If he wants to join other he would just enter some existing (random) screen id to connect to. If he wants to create a new one he would access this screen in which he would see the screen id to share with someone else. I dont care if two persons wants to drag and drop different item to same spot, it would then just use the one that came last.
Now that you understand what I want to build...
What I really just need is the skeleton structure of something like this. What parts I will need to build something like this? Libraries and such, where should I look for tutorials, Best practices, hierarchy, should I use tcp or udp? I just need something where to start from.
An applet is run in the system memory of each individual client. There are strict rules about what applets can and cannot do, and I am not sure whether or not applets would be allowed to make remote connections to other users. I would advice doing some google leg work on java applet security and seeing what you dig up.
Assuming this is possible:
In terms of architecture, I think you would want one person designated as the host create the game and run all the game logic, while the clients just receive information pertinent to graphics being displayed (location, size, texture, what have you) and sends back information about what the client is doing.
I did something like this as a school project in high school, but I was forced to sign the applet to make it do remote http connections. I would assume this is still the same case.
Hope that helps a little bit.

Categories

Resources