• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

after JNDI realm Authentication, need further specificity on authentication

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a jndi realm set up in my tomcat 4.12 which is working and authenticates against microsoft's Active Directory Server. (not my choice, mandated)

Within that same context, I have a need to secure several programs to an administrator only and would rather not have to edit every one of them to programmatically check for the user who is trying to access them. In other words, some programs within the context will be available to everyone and some should only be available to the administrator.

Any clever ideas on how to go about this?

Here is my context from my server.xml:

<Context path="/mrcjava" docBase="/mrcjava" debug="0" reloadable="true" privileged="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="mrcjava_log" suffix=".txt" timestamp="true"/>
<!-- Robyne's code: JNDI to ActiveDirectoryServer Authentication: -->
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
connectionURL="ldap://99.999.9.9:389"
connectionName="CN=name,OU=CO,dc=name1,dc=name2"
connectionPassword="password"
referrals="follow"
userBase="dc=name1,dc=name2"
userSearch="(&(sAMAccountName={0})(objectClass=user))"
userSubtree="true"
roleSearch="(uniqueMember={0})"
rolename="cn"
/>
</Context>


I wish I could add within the context this additional memory realm:

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>

Which I did try. Interestingly, tomcat will run, but nothing will authenticate.


ps. here is the bottom of my web.xml where I tried to enable the above:
<security-constraint>
<web-resource-collection>
<web-resource-name>/mrcjava</web-resource-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>/LNGDIST/mrcmenu.html</url-pattern>
<url-pattern>/GetAttsMaint</url-pattern>
<url-pattern>/GetAttsRpt</url-pattern>
<url-pattern>/GetAttsOptions</url-pattern>
<url-pattern>/GetAttsOptionsNew</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>


<security-constraint>
<web-resource-collection>
<web-resource-name>/mrcjava</web-resource-name>
<url-pattern>/GetAttsAdmin</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>NTSADMIN</role-name>
</auth-constraint>
</security-constraint>




<login-config>
<auth-method>FORM</auth-method>
<realm-name>ldapRealm</realm-name>
<form-login-config>
<form-login-page>/LNGDIST/login.jsp</form-login-page>
<form-error-page>/LNGDIST/login_error.jsp</form-error-page>
</form-login-config>
</login-config>

<security-role>
<role-name>LD</role-name>
</security-role>

<security-role>
<role-name>NTSADMIN</role-name>
</security-role>

</web-app>


newbie, would appreciate any creative ideas you have.
Thanks,
 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic