I am attempting to integrate ldap authentication with grails 3. Essentially, here is what I am to do:
When a particular path is invoked, I want to make sure that the user is part of the right "group" in the directory.
To approach this, what I have done is configured the tomcat's server.xml file, to enable the jndi realm.
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionName="cn=angryIp,ou=People,o=cools,dc=mains,dc=com"
connectionPassword="angryIp"
connectionURL="ldap://localhost:10389"
userPattern="cn={0},ou=People,o=cools,dc=mains,dc=com"
roleBase="ou=Groups,o=cools,dc=mains,dc=com"
roleName="cn"
roleSearch="uniqueMember={1}"
/>
I have a configured version of apache directory studio running, and I am able to query and return back the results. (In another words, the above config so far, is correct)
To take this further, I need to add the security constraints in the web.xml file. However, grails 3 no longer supports the use of web.xml. (I have even created a web.xml file which was placed into the src/main/webapp/WEB-INF dir, as some reccomended for previous versions, but the application then becomes undeployable) This creates a problem for me, as all the tutorials assume we can create that file.
I have also looked at the grails 3 doccumentation for using ldap in the application.yml file, but the problem I have here, is that the connection paramaters are required. Ex: The ldap ip string, username, password, etc. While I know this data for my local env, the war file will be deployed to many clients, and I do not know their IP's.
So the problem/issue i have is that :
a) Since grails 3 does not have a web.xml file, how can I configure the same attributes programmatically? Even though this is horrible for the server admins, and really gives me little benefit.
b) Is there an alternative to the statically typed IP's for the ldap configuration in the application.yml?