OAuth library functions  1.0.3
OAuth library functions

Introduction

liboauth is a collection of POSIX-c functions implementing the OAuth Core RFC 5849 standard. liboauth provides functions to escape and encode parameters according to OAuth specification and offers high-level functionality to sign requests or verify OAuth signatures as well as perform HTTP requests.

liboauth depends on either on the OpenSSL library or on NSS (Mozilla's Network Security Services) , which are used for generating the hash/signature, and optionally libcurl for issuing HTTP requests.

The source includes example code and a self-tests based on http://wiki.oauth.net/TestCases. The library has been tested against the http://oauth-sandbox.mediamatic.nl (now offline) and http://term.ie/oauth/example test servers using commandline-cURL, libcurl and a QT4.3.2 QHttp C++ application on win32 (mingw), gnu/Linux and Mac/OSX.

Installation

The source is debianized. On Debian systems debian-buildpackage can be used to compile and dpkg -i to install liboauth and liboauth-dev packages.

liboauth uses autotools and libtools. The tar.gz package includes the configure script, but if you get the source from the repository, you first need to generate the build environment with something alike: aclocal; autoheader; libtoolize –copy; autoconf; automake –gnu –add-missing –copy. (OSX users use glibtoolize).

run ./configure and build liboauth with make. see the INSTALL file for further instructions on gnu autotools.

run ./configure –help for information on optional features (–disable-curl, –disable-libcurl, –enable-nss, –with-curltimeout[=<int>]).

If Doxygen is available, the documentation can be rendered from the source by calling make dox. The http://wiki.oauth.net/TestCases scenarios in the example code can be run with make check.

Built-in HTTP client

Consult oauth.h for a detailed reference of available functions. This documentation is also available as unix manual page: man 3 oauth.

See tests/oauthtest.c for the self-test code and example. tests/oauthexample.c implements a simple hardcoded OAuth-consumer. If you simply want to calculate the OAuth-signature, all you need is oauth_sign_url. Future releases might include more elaborate usage information: Feel free to ask questions.

oauth-utils includes a command-line OAuth-consumer and signature-verification tool using liboauth.

Built-in HTTP client

The curl wrapper interface should never have been part of libOauth. It came in handy during initial development and test deployments, and by the time I wanted to remove it, there were already too many users...

It is still convenient for self-tests and getting started, but application developers should rather aim for a dedicated optimized implementation appropriate for each app.

oauth_http.c does not do any error-handling for instance, also SSL certificate checking and/or similar CURL options depend on the use-case at hand. Furthermore the available curl options and parameters in oauth_http.c are limited.

Therefore with the release of version 1.0.0 all oauth_http functions have been marked as deprecated.

Developers of applications using oauth_http.c are advised to simply copy the relevent code into their application (the MIT license is very permissive) and adopt it, if neccesary.

Download

Download Source: liboauth-1.0.3.tar.gz  Changelog.

liboauth is maintained at github: liboauth repository and mirrored at the OAuth googlecode SVN repository.

Bugs

Send bug reports, patches or suggestions to robin @ gareus . org.

Ask the oauth-community or join the mailing list for discussion.

License

The source-code of liboauth can be distributed under MIT License, or at your option in terms of the the GNU General Public License.

Note: OpenSSL is not strictly compatible with the GPL license. An exemption (to the GPL) allowing to link and redistribute liboauth with the OpenSSL library is is included in the source files. More information is available in the README. You can avoid this whole issue by using NSS instead of OpenSSL, configuring liboauth with –enable-nss.

The Debian packaging that comes with the source-code is licensed under the GNU General Public License.

MIT License (source-code):

  Copyright 2007-2012 Robin Gareus
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.

GPL (Debian packaging and alternative source-code license):

  This package is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public
  License as published by the Free Software Foundation; either
  version 2 of the License, or (at your option) any later version.
  This package is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.
  You should have received a copy of the GNU General Public
  License along with this package; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA