I wanted to play with mod_auth_openid on my Macbook Pro. OS X ships with Apache installed, so all I needed to do was build the module and edit the Apache configuration.
I wasn’t able to build mod_auth_openid from the git repository because of issues with autotools on OSX, but I was able to build from the latest release tarball (in this case,
mod_auth_openid needs libopkele (a C++ OpenID library), which can be installed via Homebrew:
brew install libopkele
My initial attempt to build mod_auth_openid failed with:
/usr/share/apr-1/build-1/libtool: line 4575: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
For some reason, there’s a reference in an Apache config file to a non-existent path for the C compiler. I tried to edit the file in question, but that failed to resolve the issue. In the end, I just added a symlink:
cd /Applications/Xcode.app/Contents/Developer/Toolchains sudo ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain
Then it was just configure, make, sudo make install.
I then created a
/Library/WebServer/Documents/protected directory with an index.html file inside and configured Apache to only allow access via OpenID by adding the following to
<Directory "/Library/WebServer/Documents/protected"> AuthType OpenID require valid-user </Directory>
And I restarted Apache via launchctl:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Voila! An OpenID consumer on my laptop.