I want to secure the communication for a webservice component published with endpoint.publish() in an OSGi bundle. Therefor I'm struggling with three questions.
- How can I use a certificate in a truststore to build a https publisher using just the IP? As this bundle is running on an embedded computer without a machines name known to the client consuming the service.
- How do I load the *.jks keystore in my bundle? As there's another classpath I can't find the *.jks file using e.g. new File(./truststore.jks). Yes, I found similiar questions here, but they didn't work.
- I wan't to implement some kind of authentication. For now I send a username and password in the header files (that's the reason I want to secure the communication at first). Is there a way not to check the username/password in the header in every webservice method call? As I have about 20 published methods and copying the same check-code is odd.
Runtime is Java 1.6, equinox 3.7.1. The client is another web application (using php).
In general, are there best practises for secure publishing webservices (in respect to OSGi bundles especially)?
Thanks in advance!