How to Do Java EE Container Security With MongoDB on Tomcat - java

I have used file realm and JDBC realm before to host the username and password combinations. I have not yet used MongoDB to perform the same function. I have read the Tomcat docs and searched around but have not seen any tutorials.
Is there a realm someone knows of or am I missing something?

You can create your own realm and manually connect to Mongo.
This article here describes the process and provides sample code:
http://www.tomitribe.com/blog/2013/10/creating-a-mongodb-security-realm-for-tomcat/

Related

Spring LDAP in dev environment

I'm building a spring boot application which use LDAP interaction for authentication but not only. I also retrieve information from LDAP for my users details.
I don't know how to manage this for a dev environment which does not have access to real LDAP.
Ldif file ? Embedded Apache DS Server ?
Thanks
So you want to mock LDAP in your local environment.
You'll need to,
inject JNDI implementation
implement JNDI layer
write mock which will return desired data.
Refer below mentioned link describing step by step guide to mock LDAP. Tried similar in 2014, hope it work for others.
Reference:
https://theholyjava.wordpress.com/2010/05/05/mocking-out-ldapjndi-in-unit-tests/
Note: Please rephrase your query so that others with similar issue can also benefit it. Happy coding :)

Where can I deploy my java REST webservice for free so that I can access it remotely?

I have developed a REST web-service in Java interacting with a MySQL database.I want to deploy the web-service and the create a database at a server so that I can invoke it from an application.I tried Microsoft Azure but was unable to get it done.Where can I find relevant information for this?
I had similar problems with a MySQL database using the third party option in the Azure Marketplace from ClearDb. What I ended up doing was switching my database from a MySQL instance to an Azure Database Instance (Subset of SQL Server's features.) This worked perfectly for me! I was able to query from my database feed data to my api, and access the API through my Azure Web App.
I understand this may not be an option for you, however, Digital Ocean is a great cloud hosting option (with scaling similar to Azure, although not as good in my honest opinion.) You can set up a Linux Environment with a MySQL Server and JVM and serve your whole API through there. Best of Luck!
#coderden, According to your description, I think you have been deployed your Java Application on an Azure WebApp. Then when you created a MySQL database on Azure for connection from the Java webapp, please make sure the webapp & mysql instance created in a same resource group and note the connection string of MySQL on Azure.
As reference, please see the article to try again although it's for PHP, the steps are the same for Java.

Does Websphere 8.5 provide an API to interface with an Active Directory using security details configured in Websphere security settings?

I am using Websphere Application Server, that has administrative and application security enabled, which uses LDAP to interface an Active Directory for authentication.
The web application that is deployed to the server is required to be able to retrieve information from this AD, as well as modify information in this AD (such as adding a new user to the AD). I could use JNDI to achieve this, however I need the application to use the settings configured in Websphere to do the connection so that I don't have to maintain multiple sets of LDAP information (one in the application and one in Websphere).
I have searched around but couldn't find anything concrete. The closest I saw was I can configure it as a federated user repository instead of standalone LDAP registry, after which I can retrieve some attribute values, but it does not explain if I am able to modify them.
Any help would be appreciated. Thanks!
If you will use federated repository, then you can use VMM API. It is quite complex comparing to JNDI or ldap related libraries, but should provide you with features you need.
Start by looking at this page - Developing with virtual member manager - and subpages, you will find some code examples there also.

How to connect to MongoDB on Azure, from Android?

Does anybody have specifics on how to connect an Android application to MongoDB running on Azure roles?
--
Hi, I have MongoDB replica set running on multiple Azure roles in the Cloud Service. I have used the mongo-azure library on GitHub to create the role instances and have them running in Azure.
Most articles online seem to only talk about connecting to Azure-MongoDB locally (via localhost). But, since my application won't be running locally to Azure, I feel that I have to use REST to somehow connect to Azure cloud servers, which may or may not propagate data to the MongoDB replica set.
Does anybody have more specifics on how to connect an Android application to MongoDB running on Azure roles?
(Or, for those that don't have experience with Android/Java: how to connect from non-localhost using non-.NET?)
ps - In other MongoDB questions, people have already answered Android is not natively support by MongoDB, and using non-native methods is fine by me. There are apps out there that already do this, mainly Foursquare. Unfortunately, they use AWS instead of Azure (the requirement for me).
pps - if anybody has any more resources for the linked mongo-library about how it works in more detailed terms, then that would be very helpful too.
UPDATE:
I found the most up-to-date version of mongo-java-driver.jar (currently 2.11.3) and am testing that.
Thanks to another question I've found the particular issue with Android not supported by the java driver, but that issue appears to be resolved.
Possible Solution:
In the Visual Studio project, I created an Input Endpoint for the role. So far that seems to do the trick, using MongoClient mongo = new MongoClient("<my_ip_address>", 27017);
Your 'possible solution' is the right one in my view - you need to open a (load balanced) TCP port in the firewall surrounding your roles and InputEndpoint is the way to do that.
You cannot use an input endpoint if you are doing writes when using a replica set of size > 1 if you are the github solution above. You do not want the Azure load balancer to route a write (insert or update) to a secondary of MongoDB in which case your write will fail.
If you use Azure virtual machines then you can create a port mapping per virtual machine instance and overcome this.

How to use JDBC 2.1 in Java to connect to LDAP

I downloaded JDBC 2.1 and added jdbcLdap.jar as well as ldap.jar in my class path ( http://sourceforge.net/projects/myvd/files/jdbc%20ldap%20bridge/jdbc%20ldap%20bridge%202.1/jdbc-ldap-2.1.zip/download ). I would like to use it in my java application to connect to an LDAP, though I have not found any examples or explanations on how to use it (only how to connect to an sql server).
Could someone here possibly give a hint ?
The reference for the JDBC-LDAP bridge is located at the the MyVD site. I think you've missed looking at it; it is fairly comprehensive on how to create connections and issue commands against a LDAP server.

Categories

Resources