# How to: Integrate Waffle in XWiki using Tomcat on Windows

**URL:** <https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688>\
**Category:** Help / Discuss\
**Created:** [October 1, 2018, 8:15pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688 "2018-10-01T20:15:16Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 1, 2018, 8:15pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/1 "2018-10-01T20:15:16Z")

</div>

**How to: Integrate Waffle in XWiki using Tomcat on Windows**

1. Make sure to install the LDAP Authenticator extension ([https://extensions.xwiki.org/xwiki/bin/view/Extension/LDAP/Authenticator/](https://extensions.xwiki.org/xwiki/bin/view/Extension/LDAP/Authenticator/)).

2. Run the Tomcat service using a domain service account. You will need to set the service principal name (SPN) for the service account as noted in the Waffle documentation ([waffle/Docs/faq/NegotiateFailsWith401.md at master · Waffle/waffle · GitHub](https://github.com/Waffle/waffle/blob/master/Docs/faq/NegotiateFailsWith401.md)). Make sure that the domain service account has permission to write to the `temp`, `logs`, `work`, etc. in the Tomcat installation directory.

3. Download Waffle - [GitHub - Waffle/waffle: Enable drop-in Windows Single Sign On for popular Java web servers.](https://github.com/Waffle/waffle) (version 1.9.0 is the latest as I write this)

4. Copy the following files from the Waffle distribution into the Tomcat `lib` directory:

5. For XWiki 10.8, add `Valve` and `Realm` tags in `META-INF\context.xml`:

6. Modify `WEB-INF\web.xml` to add the `<security-constraint>` and `<security-role>` restrictions you want. Place these settings before the first `<filter>` tag in the file; e.g.:

7. Modify `WEB-INF\xwiki.cfg` to use the LDAP Authenticator settings you want to use; e.g.:

I have successfully set up restricted access using Windows domain authentication using this configuration. I can update this post in case I’ve forgotten any details.

---

<div class="post-metadata">

**Author:** ![rbr](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rbr](https://forum.xwiki.org/u/rbr)\
**Post date:** [October 1, 2018, 8:25pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/2 "2018-10-01T20:25:16Z")

</div>

> [@bstewart](#):
>
> (In the future if the LDAP Authenticator extension is updated to be able to perform an LDAP server binding without using credentials, `the xwiki.authentication.ldap.bind_DN` and `xwiki.authentication.ldap.bind_pass` settings will not be needed.)

I’m maybe a bit picky about this, but the update is not about “binding without using credentials”, but binding with reusing the container’s user credentials. Binding anonymously (i.e. without credentials) is already supported by the extension, if I read the code correctly, but Active Directory does not allow it.

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 1, 2018, 8:43pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/3 "2018-10-01T20:43:57Z")

</div>

Correct, that’s what I meant. I updated my post. (You can delete your post now to avoid confusion.)

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 2, 2018, 2:03pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/4 "2018-10-02T14:03:08Z")

</div>

> Binding anonymously (i.e. without credentials) is already supported by the extension, if I read the code correctly, but Active Directory does not allow it.

Since we don’t mind being pedantic (LOL), Actually Active Directory doesn’t allow it _by default_. It can be configured to allow anonymous binding, but it’s not the default.

---

<div class="post-metadata">

**Author:** ![rbr](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/r/58f4c7/32.png) [@rbr](https://forum.xwiki.org/u/rbr)\
**Post date:** [October 2, 2018, 3:53pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/5 "2018-10-02T15:53:50Z")

</div>

> [@bstewart](#):
>
> Since we don’t mind being pedantic (LOL)

I tried to help you getting your point across, because you clearly said “A” while I knew, from your other threads, that you meant “B”. Anybody joining the discussion just now may not have gotten your point.  
If you think that is “pedantic”, I’m fine with that, although I may have described it slightly different.

> [@bstewart](#):
>
> Actually Active Directory doesn’t allow it _by default_ .

Correct. But let me ask you a question: Why didn’t you configure your active directory to allow anonymous bind, although it would solve your problem (no hard coded passwords), created a feature request for the LDAP Authenticator and currently use a bind DN and a hardcoded password instead?

My guess: Maybe because changing the default and allow anonymous bind, while theoretically possible, is just not a good idea?

But to make our pedantic souls happy 😉 I revise my statement:

> but Active Directory ~~does not allow~~ almost never allows it. [Assuming production installation, and not some dodgy lab installation].

Almost forgot the most important: I rest my case.

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 2, 2018, 6:27pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/6 "2018-10-02T18:27:15Z")

</div>

It’s always enjoyable to interact with someone in a forum who is always right and insists on the last word in every thread 😉

> Why didn’t you configure your active directory to allow anonymous bind, although it would solve your problem (no hard coded passwords)

Yes that would solve the problem and you’re right, it’s not a good idea security-wise.

> but Active Directory almost never allows it

Again, I would reword this as “Active Directory doesn’t allow anonymous binding by default” or “most Active Directory instances are not going to allow anonymous bindings.”

I rest my case too. 😄

---

<div class="post-metadata">

**Author:** ![dannyscar](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/d/f6c823/32.png) [@dannyscar](https://forum.xwiki.org/u/dannyscar)\
**Post date:** [October 4, 2018, 9:40am UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/7 "2018-10-04T09:40:36Z")

</div>

Just wondered if I could get some help setting up SSO, I’ve followed your configuration steps above but it doesn’t seem to work for me. I’ve enabled debug logging for LDAP and i’m seeing these trace logs. Any ideas?

> 2018-10-04 10:34:57,568 [[http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png](http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png)] TRACE x.c.l.XWikiLDAPAuthServiceImpl - Starting LDAP authentication  
> 2018-10-04 10:34:57,568 [[http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png](http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png)] DEBUG x.c.l.XWikiLDAPAuthServiceImpl - The provided user is null. We don’t try to authenticate, it probably means the user is in non logged mode.  
> 2018-10-04 10:34:57,568 [[http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png](http://server/xwiki/bin/skin/resources/icons/xwiki/noavatar.png)] DEBUG x.c.l.XWikiLDAPAuthServiceImpl - XWikiUser: null  
> 2018-10-04 10:34:57,575 [[http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin](http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin)] TRACE x.c.l.XWikiLDAPAuthServiceImpl - Starting LDAP authentication  
> 2018-10-04 10:34:57,575 [[http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin](http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin)] DEBUG x.c.l.XWikiLDAPAuthServiceImpl - The provided user is null. We don’t try to authenticate, it probably means the user is in non logged mode.  
> 2018-10-04 10:34:57,575 [[http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin](http://server/xwiki/bin/skin/skins/flamingo/print.css?skin=XWiki.DefaultSkin)] DEBUG x.c.l.XWikiLDAPAuthServiceImpl - XWikiUser: null

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 4, 2018, 6:18pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/8 "2018-10-04T18:18:18Z")

</div>

Sorry; can’t reproduce. It’s working for me here.

I would recommend testing Waffle in Tomcat using the demo web apps included in the Waffle download. They’re pretty helpful.

---

<div class="post-metadata">

**Author:** ![nha4601](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@nha4601](https://forum.xwiki.org/u/nha4601)\
**Post date:** [October 5, 2018, 10:48am UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/9 "2018-10-05T10:48:32Z")

</div>

Thank you for posting this guide! Right now in our deployment we want our webserver logs to capture Active Directory account information in addition to IP address (but we do not want to have XWiki accounts pull from Active Directory). I spent a couple months trying to evaluate the numerous options of integrating Windows authentication. I was unsuccessful in setting up Waffle and all of the solutions which involved Tomcat integration. The only successful solution I was able to implement was to use IIS as a reverse proxy and handle Windows authentication in IIS.

---

<div class="post-metadata">

**Author:** ![mity-dave](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@mity-dave](https://forum.xwiki.org/u/mity-dave)\
**Post date:** [October 18, 2018, 7:21pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/10 "2018-10-18T19:21:09Z")

</div>

@nha4601  
How did you get this to work with reverse proxy?  
We’re trying to do the same thing with IIS, but it isn’t passing through the credentials correctly into XWiki.

---

<div class="post-metadata">

**Author:** ![nha4601](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@nha4601](https://forum.xwiki.org/u/nha4601)\
**Post date:** [October 18, 2018, 7:49pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/11 "2018-10-18T19:49:59Z")

</div>

Tomcat / XWiki isn’t aware of the Active Directory user when using an http reverse proxy. Right now we have separate accounts within XWiki. The main goal behind us using IIS as a reverse proxy was to have the server logs (now in IIS) reflect the Active Directory account for each user request.

We did get a IIS reverse proxy using ISAPI redirector / AJP working which passed the Active Directory user information to Tomcat; however, users with a lot of credentials (OUs) experienced the “request entity too large error”. Increasing the packet size did not solve the issue. We therefore pivoted to using an http reverse proxy instead of ISAPI / AJP.

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 30, 2018, 9:10pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/12 "2018-10-30T21:10:46Z")

</div>

I am wondering why you need the AD account in the IIS server logs? (Just curious)

---

<div class="post-metadata">

**Author:** ![nha4601](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/n/3e96dc/32.png) [@nha4601](https://forum.xwiki.org/u/nha4601)\
**Post date:** [October 31, 2018, 10:05am UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/13 "2018-10-31T10:05:19Z")

</div>

Our compliance office wanted to be able to log all activity by user. Without the AD account information we would only have IP addresses, which would have to be resolved to machines, then to users.

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [October 31, 2018, 6:29pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/14 "2018-10-31T18:29:17Z")

</div>

You could use the information in the audit logs and not have to worry about IIS. (Just a suggestion.)

---

<div class="post-metadata">

**Author:** ![mity-dave](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@mity-dave](https://forum.xwiki.org/u/mity-dave)\
**Post date:** [November 13, 2018, 4:56pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/15 "2018-11-13T16:56:56Z")

</div>

@bstewart

This is working great, but I have a few questions.

- Have you been able to get your photos from Active Directory to sync with XWiki when using this configuration? (I tried the

xwiki.authentication.ldap.update\_user=1  
xwiki.authentication.ldap.update\_photo=1  
xwiki.authentication.ldap.photo\_attribute=thumbnailPhoto

) settings, but the photos don’t sync.

- Is it possible to logon with a local account when we have waffle integration enabled?

Thanks!

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [November 13, 2018, 8:28pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/16 "2018-11-13T20:28:23Z")

</div>

> This is working great, but I have a few questions.

Glad it’s working!

> Have you been able to get your photos from Active Directory to sync with XWiki when using this configuration? (I tried the

> xwiki.authentication.ldap.update\_user=1  
> xwiki.authentication.ldap.update\_photo=1  
> xwiki.authentication.ldap.photo\_attribute=thumbnailPhoto

> ) settings, but the photos don’t sync.

I’ve never tried (we don’t use that attribute).

> Is it possible to logon with a local account when we have waffle integration enabled?

The short/simple answer is no, but I don’t think you need to?

My recommendation is to sync an AD group to the XWiki.XWikiAdminGroup group in XWiki; e.g.:

```
xwiki.authentication.ldap.group_mapping=\
  XWiki.XWikiAdminGroup=CN=XWiki Admins,OU=XWiki,DC=fabrikam,DC=com|\
  ...

```

Start your browser as member of that group, and you are an administrator in XWiki.

HTH,

Bill

---

<div class="post-metadata">

**Author:** ![mity-dave](https://forum.xwiki.org/letter_avatar_proxy/v4/letter/m/ecae2f/32.png) [@mity-dave](https://forum.xwiki.org/u/mity-dave)\
**Post date:** [November 13, 2018, 11:01pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/17 "2018-11-13T23:01:09Z")

</div>

Thanks, @bstewart!  
I’ll open a separate discussion for the LDAP Properties and add the LDAP Group Mapping that you recommended.

---

<div class="post-metadata">

**Author:** ![bstewart](https://forum.xwiki.org/user_avatar/forum.xwiki.org/bstewart/32/1585_2.png) [@bstewart](https://forum.xwiki.org/u/bstewart)\
**Post date:** [November 22, 2018, 5:30pm UTC](https://forum.xwiki.org/t/how-to-integrate-waffle-in-xwiki-using-tomcat-on-windows/3688/18 "2018-11-22T17:30:34Z")

</div>

@nha4601 wrote:

> Our compliance office wanted to be able to log all activity by user. Without the AD account information we would only have IP addresses, which would have to be resolved to machines, then to users.

I just wanted to mention something I forgot to mention before - when integrating Waffle into XWiki on Windows using Tomcat, the Tomcat access log lists the domain username that accesses each page.
