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 :)
Related
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.
I'm working on an RESTFul API that need to authenticate users on different realms based on the URL called. For example, if you call /service1 you need to be authenticated on a JDBCRealm, but if you call /service2, you need to be authenticated on a LDAPRealm.
Furthermore, I'd like to be able to configure (database or config file) which url uses which realm. This configuration wouldn't require a redeployment of my war if possible.
Do you have any idea how I can achieve this?
I'm using Glassfish 3.1.2 with Jersey and Spring 3.0.5
Thank you, have a nice day!
--
Samuel Dionne
You can add a separate layer for it so that it forwards the request to the proper device per authentication. Actually this is a good use case for the IBM DataPower device if you are a big enterprise, if not a simple proxy server can do the job for you.
I've been looking for a very basic example of using LDAP authentication in Spring 3.1. In the docs for the security download I found a page similar to this one
http://static.springsource.org/spring-security/site/docs/3.0.x/reference/sample-apps.html
3.3 LDAP Sample
The LDAP sample application provides a basic configuration and sets up
both a namespace configuration and an equivalent configuration using
traditional beans, both in the same application context file. This
means there are actually two identical authentication providers
configured in this application.
Trouble is, it is not there in the distribution or I am having a brain fart. Can anyone tell where I can find it or another modern Spring LDAP sample?
Thanks in advance
Steve
It's only in svn. You can find it in this URL. Take a look to /samples/samples-utils/ directory.
As it says at the start of the Spring Security samples chapter that you refer to:
To avoid an overly large download, only the "tutorial" and "contacts" samples are included in the distribution zip file. The others can be built directly from the source which you can obtain as described in the introduction.
So you need to use git to clone the repository and build the samples to get the LDAP authentication sample.
Not that Spring LDAP is a different project from Spring Security. Spring Security uses Spring LDAP for LDAP integration.
I'm working on a web application under Tomcat on a Linux server and all clients are under a windows domain. I need to get the user account from the request to assign it the right role on my application. So to summarize I just need to retrieve the user account becasue the authentication is not required.
What could be the more easy framework or solution to do that? Jaas could be the solution?
Could you help me, please?
thanks,
Andrea
Have you checked out Spring-Security?
http://static.springsource.org/spring-security/site/
Spring Security supports Single Sign On options using Kerberos, JNDI/LDAP, Active Directory, OAuth, OpenID, etc.
Integrate Single Sign On using Spring Security
Try the Apache Shiro project, former JSecurity.
We are currently implementing a portal to our web based services. The portal and services are written with Seam and we are using OpenLDAP to store the security data such as users, groups and permissions. So far we have looked at writing our own code to access LDAP but are there any existing APIs that we could use?
If you're a Spring user, I'd look into the Spring LDAP modules. They're beautifully done; they follow the idiom laid down by their JDBC implementation. Very clean, very nice.
We did this for our web application a while ago and investigated the following:
http://developers.sun.com/sw/docs/examples/appserver/ldap.html
However, we ended up just using the LDAP support built in to Tomcat, since basic authentication was enough for us.
Here is an example on how we set up out authentication in tomcat:
http://blog.mc-thias.org/?c=1&more=1&pb=1&tb=1&title=tomcat_ldap_authentication
JLDAP
The LDAP Class Libraries for Java (JLDAP) allow you to write applications to access, manage, update, and search for information stored in directories accessible using LDAPv3.