Initial commit
authorAlberto Mardegan <alberto.mardegan@nokia.com>
Thu, 1 Apr 2010 12:32:37 +0000 (15:32 +0300)
committerAlberto Mardegan <alberto.mardegan@nokia.com>
Thu, 1 Apr 2010 12:32:37 +0000 (15:32 +0300)
35 files changed:
.gitignore [new file with mode: 0644]
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
docs/Makefile.am [new file with mode: 0644]
docs/reference/Makefile.am [new file with mode: 0644]
libsignon-glib.pc.in [new file with mode: 0644]
libsignon-glib/Makefile.am [new file with mode: 0644]
libsignon-glib/signon-auth-service.c [new file with mode: 0644]
libsignon-glib/signon-auth-service.h [new file with mode: 0644]
libsignon-glib/signon-auth-session.c [new file with mode: 0644]
libsignon-glib/signon-auth-session.h [new file with mode: 0644]
libsignon-glib/signon-dbus-queue.c [new file with mode: 0644]
libsignon-glib/signon-dbus-queue.h [new file with mode: 0644]
libsignon-glib/signon-errors.c [new file with mode: 0644]
libsignon-glib/signon-errors.h [new file with mode: 0644]
libsignon-glib/signon-identity.c [new file with mode: 0644]
libsignon-glib/signon-identity.h [new file with mode: 0644]
libsignon-glib/signon-internals.h [new file with mode: 0644]
libsignon-glib/signon-marshal.list [new file with mode: 0644]
libsignon-glib/signon-proxy.c [new file with mode: 0644]
libsignon-glib/signon-proxy.h [new file with mode: 0644]
libsignon-glib/signonauthsession.xml [new file with mode: 0644]
libsignon-glib/signondaemon.xml [new file with mode: 0644]
libsignon-glib/signonidentity.xml [new file with mode: 0644]
tests/Makefile.am [new file with mode: 0644]
tests/check_signon.c [new file with mode: 0644]
tests/signon-glib-test.sh.in [new file with mode: 0644]
tests/tests.xml [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ef5bfea
--- /dev/null
@@ -0,0 +1,29 @@
+Makefile
+Makefile.in
+aclocal.m4
+compile
+config.*
+configure
+debian
+depcomp
+.*
+*.o
+*.lo
+*.la
+*.stamp
+/docs/reference/html/
+/docs/reference/libsignon-glib*
+/docs/reference/tmpl/
+/docs/reference/xml/
+gtk-doc.make
+install-sh
+*.pc
+/libsignon-glib/signon-marshal.c
+/libsignon-glib/signon-marshal.h
+libtool
+ltmain.sh
+missing
+stamp-h1
+*~
+*.cache
+patches/
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..c7608de
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+alberto.mardegan@nokia.com
+
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..602bfc9
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..3b824e1
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1 @@
+Get the changelog by running git-log.
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..54caf7c
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,229 @@
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..c04cad2
--- /dev/null
@@ -0,0 +1,9 @@
+SUBDIRS = libsignon-glib docs tests
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libsignon-glib.pc
+
+libsignondocdir = ${prefix}/doc/reference
+libsignondoc_DATA= README COPYING AUTHORS ChangeLog INSTALL NEWS
+
+EXTRA_DIST = $(libsignondoc_DATA)
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..9096071
--- /dev/null
@@ -0,0 +1,3 @@
+gtkdocize
+autoreconf -i --force && ./configure "$@"
+
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..be24c21
--- /dev/null
@@ -0,0 +1,68 @@
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(libsignon-glib, 0.1-3)
+
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_CONFIG_HEADER(config.h)
+
+PKG_CHECK_MODULES(
+       DEPS,
+       glib-2.0
+       gobject-2.0
+        dbus-1
+        dbus-glib-1);
+AC_SUBST(DEPS_CFLAGS)
+AC_SUBST(DEPS_LIBS)
+
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AC_HEADER_STDC
+AC_PROG_LIBTOOL
+
+GTK_DOC_CHECK([1.3])
+
+AC_ARG_ENABLE(cast-checks,  [  --disable-cast-checks   compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes)
+if test "x$cchecks" = "xno"; then
+    CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
+fi
+
+AC_ARG_ENABLE(asserts,      [  --disable-asserts       compile with GLIB assertions disabled],[asserts=${enableval}],asserts=yes)
+if test "x$asserts" = "xno"; then
+    CFLAGS="$CFLAGS -DG_DISABLE_ASSERTS"
+fi
+
+AC_ARG_ENABLE(checks,       [  --disable-checks        compile with GLIB checks disabled],[checks=${enableval}],checks=yes) 
+if test "x$checks" = "xno"; then
+    CFLAGS="$CFLAGS -DG_DISABLE_CHECKS"
+fi
+
+AC_ARG_ENABLE(debug,     [  --enable-debug          enable printing of debug messages],[ddebug=${enableval}],ddebug=no)
+if test "x$ddebug" != "xyes"; then
+    CFLAGS="$CFLAGS -DG_DEBUG_DISABLE"
+fi
+
+AC_ARG_ENABLE(coverage, [  --enable-coverage      compile with coverage info],[coverage=${enableval}],coverage=no)
+if test "x$coverage" = "xyes"; then
+    CFLAGS="$CFLAGS -g -fprofile-arcs -ftest-coverage"
+fi
+
+PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.51, dbus-glib-1 >= 0.51], have_dbus=yes, have_dbus=no)
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
+testdatadir=${datadir}/libsignon-glib0-test
+AC_SUBST(testdatadir)
+
+AC_CONFIG_FILES([tests/signon-glib-test.sh], [chmod +x tests/signon-glib-test.sh])
+
+AC_OUTPUT([
+       Makefile
+       libsignon-glib/Makefile
+       libsignon-glib.pc
+       docs/Makefile
+       docs/reference/Makefile
+       tests/Makefile
+])
diff --git a/docs/Makefile.am b/docs/Makefile.am
new file mode 100644 (file)
index 0000000..dc5adb0
--- /dev/null
@@ -0,0 +1,2 @@
+SUBDIRS = reference
+
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
new file mode 100644 (file)
index 0000000..e3599af
--- /dev/null
@@ -0,0 +1,69 @@
+## Process this file with automake to produce Makefile.in
+
+# We require automake 1.6 at least.
+AUTOMAKE_OPTIONS = 1.6
+
+# This is a blank Makefile.am for using gtk-doc.
+# Copy this to your project's API docs directory and modify the variables to
+# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
+# of using the various options.
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=libsignon-glib
+
+# The top-level SGML file. You can change this if you want to.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting the functions and macros.
+# e.g. DOC_SOURCE_DIR=../../../gtk
+DOC_SOURCE_DIR=$(top_srcdir)
+
+# Extra options to pass to gtkdoc-scangobj. Not normally needed.
+SCANGOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan.
+# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" 
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
+MKDB_OPTIONS=--sgml-mode --output-format=xml
+
+# Extra options to supply to gtkdoc-fixref. Not normally needed.
+# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
+FIXXREF_OPTIONS=
+
+# Used for dependencies. The docs will be rebuilt if any of these change.
+# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
+# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
+HFILE_GLOB=$(top_srcdir)/libsignon-glib/*.h
+CFILE_GLOB=$(top_srcdir)/libsignon-glib/*.c
+
+# Header files to ignore when scanning.
+# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
+IGNORE_HFILES= so-marshal.h
+
+# Images to copy into HTML directory.
+# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
+HTML_IMAGES=
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
+content_files=
+
+# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
+# Only needed if you are using gtkdoc-scangobj to dynamically query widget
+# signals and properties.
+# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
+# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
+INCLUDES=-I$(top_srcdir) $(DEPS_CFLAGS)
+GTKDOC_LIBS=$(top_builddir)/libsignon-glib/libsignon-glib.la $(DEPS_LIBS)
+
+# This includes the standard gtk-doc make rules, copied by gtkdocize.
+include $(top_srcdir)/gtk-doc.make
+
+# Other files to distribute
+# e.g. EXTRA_DIST += version.xml.in
+EXTRA_DIST += 
diff --git a/libsignon-glib.pc.in b/libsignon-glib.pc.in
new file mode 100644 (file)
index 0000000..23f0d26
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+pluginlibdir=@pluginlibdir@
+
+Name: libsignon-glib
+Description: A low-level library for managing account credentials.
+Version: @VERSION@
+Libs: -L${libdir} -lsignon-glib
+Cflags: -I${includedir}
+
diff --git a/libsignon-glib/Makefile.am b/libsignon-glib/Makefile.am
new file mode 100644 (file)
index 0000000..c665673
--- /dev/null
@@ -0,0 +1,88 @@
+INCLUDES = $(DBUS_CFLAGS) -I$(top_srcdir) \
+          -DLIBDIR="@libdir@" -DLIBVERSION="0"
+lib_LTLIBRARIES = \
+       libsignon-glib.la
+
+libsignon_glib_la_CFLAGS = $(DEPS_CFLAGS) -Wall -Werror
+libsignon_glib_la_LIBADD = $(DEPS_LIBS)
+libsignon_glib_la_LDFLAGS = -version-info 0:1:0
+
+BUILT_SOURCES = \
+       signon-marshal.c \
+       signon-marshal.h \
+       signon-client-glib-gen.h \
+       signon-identity-glib-gen.h \
+       signon-auth-session-client-glib-gen.h \
+       signon-enum-types.h \
+       signon-enum-types.c \
+       stamp-signon-enum-types.h
+
+CLEANFILES = $(BUILT_SOURCES)
+
+libsignon_glib_la_SOURCES = \
+       signon-auth-service.h \
+       signon-identity.h \
+       signon-dbus-queue.h \
+       signon-auth-session.h \
+       signon-internals.h \
+       signon-auth-service.c \
+       signon-identity.c \
+       signon-dbus-queue.c \
+       signon-auth-session.c \
+       signon-errors.h \
+       signon-errors.c \
+       signon-proxy.h \
+       signon-proxy.c \
+       $(BUILT_SOURCES)
+
+libsignon_glib_includedir = $(includedir)/libsignon-glib
+libsignon_glib_include_HEADERS = \
+       signon-auth-service.h \
+       signon-auth-session.h \
+       signon-identity.h \
+       signon-errors.h \
+       $(signon_headers)
+
+signon-client-glib-gen.h: signondaemon.xml
+       dbus-binding-tool --prefix=signon-client-glib --mode=glib-client $< > $@
+
+signon-auth-session-client-glib-gen.h: signonauthsession.xml
+       dbus-binding-tool --prefix=signon-auth-session-client-glib --mode=glib-client $< > $@
+
+signon-identity-glib-gen.h: signonidentity.xml
+       dbus-binding-tool --prefix=signon-identity-glib --mode=glib-client $< > $@
+
+%-marshal.h: %-marshal.list Makefile
+       glib-genmarshal --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h
+
+%-marshal.c: %-marshal.list Makefile
+       glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.c
+
+signon-enum-types.h: stamp-signon-enum-types.h
+       @true
+
+stamp-signon-enum-types.h: Makefile signon-errors.h
+       ( cd $(srcdir) &&  glib-mkenums \
+           --fhead "#ifndef __SIGNON_ENUM_TYPES_H__\n#define __SIGNON_ENUM_TYPES_H__\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+           --fprod "/* enumerations from \"@filename@\" */\n" \
+           --vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define SIGNON_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+           --ftail "G_END_DECLS\n\n#endif /* __SIGNON_ENUM_TYPES_H__ */" \
+           signon-errors.h ) >> xgen-geth \
+           && (cmp -s xgen-geth signon-enum-types.h || cp xgen-geth signon-enum-types.h ) \
+           && rm -f xgen-geth \
+           && echo timestamp > $(@F)
+
+signon-enum-types.c: Makefile signon-errors.h
+       ( cd $(srcdir) && glib-mkenums \
+           --fhead "#include \"signon-enum-types.h\"\n#include \"signon-errors.h\"\n#define g_intern_static_string(s) (s)\n" \
+           --fprod "\n/* enumerations from \"@filename@\" */" \
+           --ftail "\n#define __SIGNON_ENUM_TYPES_C__\n" \
+           --vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {" \
+           --vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+           --vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n  }\n  return etype;\n}\n" \
+           signon-errors.h ) > xgen-getc \
+           && cp xgen-getc signon-enum-types.c  \
+           && rm -f xgen-getc
+
+EXTRA_DIST = signon-marshal.list \
+            stamp-signon-enum-types.h
diff --git a/libsignon-glib/signon-auth-service.c b/libsignon-glib/signon-auth-service.c
new file mode 100644 (file)
index 0000000..3311142
--- /dev/null
@@ -0,0 +1,237 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/**
+ * SECTION:signon-auth-service
+ * @title: SignonAuthService
+ * @short_description: The authorization service object
+ *
+ * The #SignonAuthService is the main object in this library.
+ */
+
+#include "signon-auth-service.h"
+#include "signon-client-glib-gen.h"
+#include "signon-internals.h"
+#include "signon-errors.h"
+#include "signon-proxy.h"
+#include <glib.h>
+
+G_DEFINE_TYPE (SignonAuthService, signon_auth_service, G_TYPE_OBJECT);
+
+struct _SignonAuthServicePrivate
+{
+    SignonProxy *signon_proxy;
+};
+
+typedef struct _MethodCbData
+{
+    SignonAuthService *service;
+    SignonQueryMethodsCb cb;
+    gpointer userdata;
+} MethodCbData;
+
+typedef struct _MechanismCbData
+{
+    SignonAuthService *service;
+    SignonQueryMechanismCb cb;
+    gpointer userdata;
+    gchar *method;
+} MechanismCbData;
+
+#define SIGNON_AUTH_SERVICE_PRIV(obj) (SIGNON_AUTH_SERVICE(obj)->priv)
+
+static void
+signon_auth_service_init (SignonAuthService *auth_service)
+{
+    SignonAuthServicePrivate *priv;
+
+    priv = G_TYPE_INSTANCE_GET_PRIVATE (auth_service, SIGNON_TYPE_AUTH_SERVICE,
+                                        SignonAuthServicePrivate);
+    auth_service->priv = priv;
+
+    priv->signon_proxy = signon_proxy_new ();
+}
+
+static GObject *
+signon_auth_service_constructor (GType type, guint n_params,
+                                 GObjectConstructParam *params)
+{
+    GObjectClass *object_class =
+        (GObjectClass *)signon_auth_service_parent_class;
+    SignonAuthServicePrivate *priv;
+    GObject *object;
+
+    object = object_class->constructor (type, n_params, params);
+    g_return_val_if_fail (SIGNON_IS_AUTH_SERVICE (object), NULL);
+
+    priv = SIGNON_AUTH_SERVICE_PRIV (object);
+
+    return object;
+}
+
+static void
+signon_auth_service_dispose (GObject *object)
+{
+    SignonAuthService *auth_service = SIGNON_AUTH_SERVICE (object);
+    SignonAuthServicePrivate *priv = auth_service->priv;
+
+    if (priv->signon_proxy)
+    {
+        g_object_unref (priv->signon_proxy);
+        priv->signon_proxy = NULL;
+    }
+
+    G_OBJECT_CLASS (signon_auth_service_parent_class)->dispose (object);
+}
+
+static void
+signon_auth_service_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (signon_auth_service_parent_class)->finalize (object);
+}
+
+static void
+signon_auth_service_class_init (SignonAuthServiceClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    g_type_class_add_private (object_class, sizeof (SignonAuthServicePrivate));
+
+    object_class->dispose = signon_auth_service_dispose;
+    object_class->constructor = signon_auth_service_constructor;
+    object_class->finalize = signon_auth_service_finalize;
+}
+
+/**
+ * signon_auth_service_new:
+ * @type: the name of the service type.
+ *
+ * Returns: an instance of an #SignonAuthService.
+ */
+SignonAuthService *
+signon_auth_service_new ()
+{
+    return g_object_new (SIGNON_TYPE_AUTH_SERVICE, NULL);
+}
+
+static void
+auth_query_methods_cb (DBusGProxy *proxy, char **value,
+                       GError *error, gpointer user_data)
+{
+    MethodCbData *data = (MethodCbData*)user_data;
+    GError *new_error = NULL;
+    g_return_if_fail (data != NULL);
+
+    if (error)
+        new_error = _signon_errors_get_error_from_dbus (error);
+
+    (data->cb)
+        (data->service, value, new_error, data->userdata);
+
+    if (new_error)
+        g_error_free (new_error);
+    g_slice_free (MethodCbData, data);
+}
+
+static void
+auth_query_mechanisms_cb (DBusGProxy *proxy, char **value,
+                          GError *error, gpointer user_data)
+{
+    MechanismCbData *data = (MechanismCbData*) user_data;
+    GError *new_error = NULL;
+    g_return_if_fail (data != NULL);
+
+    if (error)
+        new_error = _signon_errors_get_error_from_dbus (error);
+
+    (data->cb)
+        (data->service, data->method, value, new_error, data->userdata);
+
+    if (new_error)
+        g_error_free (new_error);
+    g_free (data->method);
+    g_slice_free (MechanismCbData, data);
+}
+
+/**
+ * signon_auth_service_query_methods:
+ * @auth_service: the #SignonAuthService.
+ * @cb: callback to be invoke.
+ * @user_data: user data.
+ *
+ * Lists all the available methods.
+ */
+void
+signon_auth_service_query_methods (SignonAuthService *auth_service,
+                                   SignonQueryMethodsCb cb, gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SERVICE (auth_service));
+    g_return_if_fail (cb != NULL);
+
+    SignonAuthServicePrivate *priv;
+    priv = SIGNON_AUTH_SERVICE_PRIV (auth_service);
+
+    MethodCbData *cb_data;
+    cb_data = g_slice_new (MethodCbData);
+    cb_data->service = auth_service;
+    cb_data->cb = cb;
+    cb_data->userdata = user_data;
+
+    com_nokia_singlesignon_SignonDaemon_query_methods_async (DBUS_G_PROXY(priv->signon_proxy),
+                                                             auth_query_methods_cb,
+                                                             cb_data);
+}
+/**
+ * signon_auth_service_query_mechanisms:
+ * @auth_service: the #SignonAuthService.
+ * @method: the name of the method to get mechanisms.
+ * @cb: callback to be invoke.
+ * @user_data: user data.
+ *
+ * Lists all the available mechanisms.
+ */
+void
+signon_auth_service_query_mechanisms (SignonAuthService *auth_service,
+                                      const gchar *method,
+                                      SignonQueryMechanismCb cb,
+                                      gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SERVICE (auth_service));
+    g_return_if_fail (cb != NULL);
+
+    MechanismCbData *cb_data;
+    cb_data = g_slice_new (MechanismCbData);
+    cb_data->service = auth_service;
+    cb_data->cb = cb;
+    cb_data->userdata = user_data;
+    cb_data->method = g_strdup (method);
+
+    SignonAuthServicePrivate *priv;
+    priv = SIGNON_AUTH_SERVICE_PRIV (auth_service);
+
+    com_nokia_singlesignon_SignonDaemon_query_mechanisms_async (DBUS_G_PROXY(priv->signon_proxy),
+                                                                method,
+                                                                auth_query_mechanisms_cb,
+                                                                cb_data);
+}
diff --git a/libsignon-glib/signon-auth-service.h b/libsignon-glib/signon-auth-service.h
new file mode 100644 (file)
index 0000000..86b2235
--- /dev/null
@@ -0,0 +1,83 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _SIGNON_AUTH_SERVICE_H_
+#define _SIGNON_AUTH_SERVICE_H_
+
+#include <glib-object.h>
+#include <dbus/dbus-glib.h>
+#include "signon-identity.h"
+
+G_BEGIN_DECLS
+
+#define SIGNON_TYPE_AUTH_SERVICE             (signon_auth_service_get_type ())
+#define SIGNON_AUTH_SERVICE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_AUTH_SERVICE, SignonAuthService))
+#define SIGNON_AUTH_SERVICE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_AUTH_SERVICE, SignonAuthServiceClass))
+#define SIGNON_IS_AUTH_SERVICE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_AUTH_SERVICE))
+#define SIGNON_IS_AUTH_SERVICE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_AUTH_SERVICE))
+#define SIGNON_AUTH_SERVICE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_AUTH_SERVICE, SignonAuthServiceClass))
+
+typedef struct _SignonAuthServiceClass SignonAuthServiceClass;
+typedef struct _SignonAuthServicePrivate SignonAuthServicePrivate;
+typedef struct _SignonAuthService SignonAuthService;
+
+struct _SignonAuthServiceClass
+{
+    GObjectClass parent_class;
+};
+
+struct _SignonAuthService
+{
+    GObject parent_instance;
+    SignonAuthServicePrivate *priv;
+};
+
+GType signon_auth_service_get_type (void) G_GNUC_CONST;
+
+typedef void (*SignonQueryMethodsCb) (SignonAuthService *auth_service,
+                                      gchar **methods,
+                                      const GError *error,
+                                      gpointer user_data);
+
+typedef void (*SignonQueryMechanismCb) (SignonAuthService *auth_service,
+                                        const gchar *method,
+                                        gchar **mechanisms,
+                                        const GError *error,
+                                        gpointer user_data);
+
+SignonAuthService *signon_auth_service_new ();
+
+void signon_auth_service_query_methods (SignonAuthService *auth_service,
+                                        SignonQueryMethodsCb cb,
+                                        gpointer user_data);
+void signon_auth_service_query_mechanisms (SignonAuthService *auth_service,
+                                           const gchar *method,
+                                           SignonQueryMechanismCb cb,
+                                           gpointer user_data);
+SignonIdentity* signon_auth_service_get_existing_identity (SignonAuthService *auth_service,
+                                                           guint32 id);
+
+G_END_DECLS
+
+#endif /* _SIGNON_AUTH_SERVICE_H_ */
diff --git a/libsignon-glib/signon-auth-session.c b/libsignon-glib/signon-auth-session.c
new file mode 100644 (file)
index 0000000..ce6781c
--- /dev/null
@@ -0,0 +1,608 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "signon-internals.h"
+#include "signon-auth-session.h"
+#include "signon-dbus-queue.h"
+#include "signon-client-glib-gen.h"
+#include "signon-auth-session-client-glib-gen.h"
+#include "signon-marshal.h"
+#include "signon-proxy.h"
+
+G_DEFINE_TYPE (SignonAuthSession, signon_auth_session, G_TYPE_OBJECT);
+
+/* Signals */
+enum
+{
+        STATE_CHANGED,
+        LAST_SIGNAL
+};
+
+static guint auth_session_signals[LAST_SIGNAL] = { 0 };
+static gchar auth_session_process_pending_message[] = "The request is added to queue.";
+
+struct _SignonAuthSessionPrivate
+{
+    DBusGProxy *proxy;
+    SignonProxy *signon_proxy;
+
+    gint id;
+    gchar *method_name;
+
+    gboolean busy;
+    gboolean canceled;
+};
+
+typedef struct _AuthSessionQueryAvailableMechanismsData
+{
+    gchar **wanted_mechanisms;
+    gpointer cb_data;
+} AuthSessionQueryAvailableMechanismsData;
+
+typedef struct _AuthSessionProcessData
+{
+    GHashTable *session_data;
+    gchar *mechanism;
+    gpointer cb_data;
+} AuthSessionProcessData;
+
+typedef struct _AuthSessionQueryAvailableMechanismsCbData
+{
+    SignonAuthSession *self;
+    SignonAuthSessionQueryAvailableMethodsCb cb;
+    gpointer user_data;
+} AuthSessionQueryAvailableMechanismsCbData;
+
+typedef struct _AuthSessionProcessCbData
+{
+    SignonAuthSession *self;
+    SignonAuthSessionProcessCb cb;
+    gpointer user_data;
+} AuthSessionProcessCbData;
+
+#define SIGNON_AUTH_SESSION_PRIV(obj) (SIGNON_AUTH_SESSION(obj)->priv)
+#define SIGNON_AUTH_SESSION_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionPrivate))
+
+
+//TODO: remove with implementing normal error management
+#define SSO_AUTH_SESSION_CONNECTION_PROBLEM_G \
+    "Cannot create remote AuthSession object: check the signon daemon and authentication plugin."
+#define SSO_AUTH_SESSION_BUSY_PROBLEM_G \
+    "AuthSession: client is busy."
+#define SSO_AUTH_SESSION_CANCELED_PROBLEM_G \
+    "Challenge was canceled"
+static void auth_session_state_changed_cb (DBusGProxy *proxy, gint state, gchar *message, gpointer user_data);
+
+static gboolean auth_session_priv_init (SignonAuthSession *self, guint id, const gchar *method_name, GError **err);
+static void auth_session_get_object_path_reply (DBusGProxy *proxy, char * object_path, GError *error, gpointer userdata);
+
+static void auth_session_query_available_mechanisms_ready_cb (gpointer object, const GError *error, gpointer user_data);
+static void auth_session_process_ready_cb (gpointer object, const GError *error, gpointer user_data);
+static void auth_session_cancel_ready_cb (gpointer object, const GError *error, gpointer user_data);
+
+static void auth_session_query_mechanisms_reply (DBusGProxy *proxy, char **object_path, GError *error, gpointer userdata);
+static void auth_session_process_reply (DBusGProxy *proxy, GHashTable *object_path, GError *error, gpointer userdata);
+
+static GHashTable* auth_session_copy_sessiondata (const GHashTable* old_session_data);
+static void auth_session_copy_gvalue (gchar* key, GValue* value, GHashTable* dest);
+static void auth_session_free_gvalue (gpointer val);
+
+static GQuark
+auth_session_errors_quark ()
+{
+  static GQuark quark = 0;
+
+  if (!quark)
+    quark = g_quark_from_static_string ("com.nokia.singlesignon.AuthSession.Errors");
+
+  return quark;
+}
+
+static GQuark
+auth_session_object_quark ()
+{
+  static GQuark quark = 0;
+
+  if (!quark)
+    quark = g_quark_from_static_string ("auth_session_object_quark");
+
+  return quark;
+}
+
+static void
+signon_auth_session_init (SignonAuthSession *self)
+{
+    self->priv = SIGNON_AUTH_SESSION_GET_PRIV (self);
+    self->priv->signon_proxy = signon_proxy_new ();
+}
+
+static void
+signon_auth_session_dispose (GObject *object)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
+    SignonAuthSessionPrivate *priv = self->priv;
+    g_return_if_fail (priv != NULL);
+
+    if (self->dispose_has_run)
+        return;
+
+    GError *err = NULL;
+
+    if (priv->proxy)
+    {
+        com_nokia_singlesignon_SignonAuthSession_object_unref (priv->proxy, &err);
+        g_object_unref (priv->proxy);
+        priv->proxy = NULL;
+    }
+
+    if (priv->signon_proxy)
+    {
+        g_object_unref (priv->signon_proxy);
+        priv->signon_proxy = NULL;
+    }
+
+    G_OBJECT_CLASS (signon_auth_session_parent_class)->dispose (object);
+
+    self->dispose_has_run = TRUE;
+}
+
+static void
+signon_auth_session_finalize (GObject *object)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION(object));
+    SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (object);
+    g_return_if_fail (priv != NULL);
+
+    g_free (priv->method_name);
+
+    G_OBJECT_CLASS (signon_auth_session_parent_class)->finalize (object);
+}
+
+static void
+signon_auth_session_class_init (SignonAuthSessionClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    g_type_class_add_private (object_class, sizeof (SignonAuthSessionPrivate));
+
+    auth_session_signals[STATE_CHANGED] =
+            g_signal_new ("auth_sesson_state_changed",
+                          G_TYPE_FROM_CLASS (klass),
+                          G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                          0,
+                          NULL,
+                          NULL,
+                          signon_marshal_VOID__INT_STRING,
+                          G_TYPE_NONE, 2,
+                          G_TYPE_INT,
+                          G_TYPE_STRING);
+
+    object_class->dispose = signon_auth_session_dispose;
+    object_class->finalize = signon_auth_session_finalize;
+}
+
+SignonAuthSession *
+signon_auth_session_new (gint id,
+                         const gchar *method_name,
+                         SignonAuthSessionStateCahngedCb cb,
+                         gpointer user_data,
+                         GError **err)
+{
+    SignonAuthSession *self = SIGNON_AUTH_SESSION(g_object_new (SIGNON_TYPE_AUTH_SESSION, NULL));
+    g_return_val_if_fail (self != NULL, NULL);
+
+    if (!auth_session_priv_init(self, id, method_name, err))
+    {
+        if (*err)
+            g_warning ("%s returned error: %s", G_STRFUNC, (*err)->message);
+
+        g_object_unref (self);
+        return NULL;
+    }
+
+    if (cb)
+    {
+        g_signal_connect (self,
+                          "auth_sesson_state_changed",
+                          G_CALLBACK (cb),
+                          user_data);
+    }
+
+    return self;
+}
+
+gchar *
+signon_auth_session_name (SignonAuthSession *self)
+{
+    g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), NULL);
+    SignonAuthSessionPrivate *priv = self->priv;
+    gchar *result = (priv ? priv->method_name : NULL);
+    return result;
+}
+
+void
+signon_auth_session_query_available_mechanisms (SignonAuthSession *self,
+                                                const gchar **wanted_mechanisms,
+                                                SignonAuthSessionQueryAvailableMethodsCb cb,
+                                                gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
+    SignonAuthSessionPrivate* priv = self->priv;
+    g_return_if_fail (priv != NULL);
+
+    AuthSessionQueryAvailableMechanismsCbData *cb_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsCbData);
+    cb_data->self = self;
+    cb_data->cb = cb;
+    cb_data->user_data = user_data;
+
+    AuthSessionQueryAvailableMechanismsData *operation_data = g_slice_new0 (AuthSessionQueryAvailableMechanismsData);
+    operation_data->wanted_mechanisms = g_strdupv ((gchar **)wanted_mechanisms);
+    operation_data->cb_data = cb_data;
+
+    _signon_object_call_when_ready (self,
+                                    auth_session_object_quark(),
+                                    auth_session_query_available_mechanisms_ready_cb,
+                                    operation_data);
+}
+
+void
+signon_auth_session_process (SignonAuthSession *self,
+                             const GHashTable *session_data,
+                             const gchar* mechanism,
+                             SignonAuthSessionProcessCb cb,
+                             gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
+    SignonAuthSessionPrivate *priv = self->priv;
+    g_return_if_fail (priv != NULL);
+
+    AuthSessionProcessCbData *cb_data = g_slice_new0 (AuthSessionProcessCbData);
+    cb_data->self = self;
+    cb_data->cb = cb;
+    cb_data->user_data = user_data;
+
+    AuthSessionProcessData *operation_data = g_slice_new0 (AuthSessionProcessData);
+
+    operation_data->session_data = auth_session_copy_sessiondata (session_data);
+    operation_data->mechanism = g_strdup (mechanism);
+    operation_data->cb_data = cb_data;
+
+    priv->busy = TRUE;
+
+    _signon_object_call_when_ready (self,
+                                    auth_session_object_quark(),
+                                    auth_session_process_ready_cb,
+                                    operation_data);
+}
+
+void
+signon_auth_session_cancel (SignonAuthSession *self)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (self));
+    SignonAuthSessionPrivate *priv = self->priv;
+    g_return_if_fail (priv != NULL);
+
+    if (!priv->busy)
+        return;
+
+    priv->canceled = TRUE;
+    _signon_object_call_when_ready (self,
+                                    auth_session_object_quark(),
+                                    auth_session_cancel_ready_cb,
+                                    NULL);
+}
+
+static void
+auth_session_get_object_path_reply (DBusGProxy *proxy, char * object_path,
+                                    GError *error, gpointer userdata)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (userdata));
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (userdata);
+    SignonAuthSessionPrivate *priv = self->priv;
+    g_return_if_fail (priv != NULL);
+
+    if (!g_strcmp0(object_path, "") || error)
+    {
+        if (error)
+            DEBUG ("Error message is %s", error->message);
+        else
+            error = g_error_new (auth_session_errors_quark(), 1, SSO_AUTH_SESSION_CONNECTION_PROBLEM_G);
+    }
+    else
+    {
+        priv->proxy = dbus_g_proxy_new_from_proxy (DBUS_G_PROXY (priv->signon_proxy),
+                                                   SIGNON_AUTH_SESSION_IFACE,
+                                                   object_path);
+
+        dbus_g_object_register_marshaller (signon_marshal_VOID__INT_STRING,
+                                           G_TYPE_NONE,
+                                           G_TYPE_INT,
+                                           G_TYPE_STRING,
+                                           G_TYPE_INVALID);
+
+        dbus_g_proxy_add_signal (priv->proxy,
+                                 "stateChanged",
+                                 G_TYPE_INT,
+                                 G_TYPE_STRING,
+                                 G_TYPE_INVALID);
+
+
+        dbus_g_proxy_connect_signal (priv->proxy,
+                                     "stateChanged",
+                                     G_CALLBACK (auth_session_state_changed_cb),
+                                     self,
+                                     NULL);
+    }
+
+    _signon_object_ready (self, auth_session_object_quark (), error);
+    g_clear_error (&error);
+}
+
+static void
+auth_session_state_changed_cb (DBusGProxy *proxy,
+                               gint state,
+                               gchar *message,
+                               gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (user_data));
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (user_data);
+
+    g_signal_emit ((GObject *)self,
+                    auth_session_signals[STATE_CHANGED],
+                    0,
+                    state,
+                    message);
+}
+
+static gboolean
+auth_session_priv_init (SignonAuthSession *self, guint id,
+                        const gchar *method_name, GError **err)
+{
+    g_return_val_if_fail (SIGNON_IS_AUTH_SESSION (self), FALSE);
+    SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self);
+    g_return_val_if_fail (priv, FALSE);
+
+    priv->id = id;
+    priv->method_name = g_strdup (method_name);
+
+    (void)com_nokia_singlesignon_SignonDaemon_get_auth_session_object_path_async (DBUS_G_PROXY (priv->signon_proxy),
+                                                                                  (const guint)id,
+                                                                                  method_name,
+                                                                                  auth_session_get_object_path_reply,
+                                                                                  self);
+    priv->busy = FALSE;
+    priv->canceled = FALSE;
+    return TRUE;
+}
+
+static void
+auth_session_query_mechanisms_reply (DBusGProxy *proxy, char **object_path,
+                                     GError *error, gpointer userdata)
+{
+    GError *new_error = NULL;
+    AuthSessionQueryAvailableMechanismsCbData *cb_data =
+        (AuthSessionQueryAvailableMechanismsCbData *)userdata;
+    g_return_if_fail (cb_data != NULL);
+
+    if (error)
+        new_error = _signon_errors_get_error_from_dbus (error);
+
+    (cb_data->cb)
+        (cb_data->self, object_path, new_error, cb_data->user_data);
+
+    if (new_error)
+        g_error_free (new_error);
+
+    g_slice_free (AuthSessionQueryAvailableMechanismsCbData, cb_data);
+}
+
+static void
+auth_session_process_reply (DBusGProxy *proxy, GHashTable *object_path,
+                            GError *error, gpointer userdata)
+{
+    GError *new_error = NULL;
+    AuthSessionProcessCbData *cb_data = (AuthSessionProcessCbData *)userdata;
+    g_return_if_fail (cb_data != NULL);
+    g_return_if_fail (cb_data->self != NULL);
+    g_return_if_fail (cb_data->self->priv != NULL);
+
+    if (error)
+        new_error = _signon_errors_get_error_from_dbus (error);
+
+    (cb_data->cb)
+        (cb_data->self, object_path, new_error, cb_data->user_data);
+
+    cb_data->self->priv->busy = FALSE;
+    if (new_error)
+        g_error_free (new_error);
+
+    g_slice_free (AuthSessionProcessCbData, cb_data);
+}
+
+static void
+auth_session_query_available_mechanisms_ready_cb (gpointer object, const GError *error,
+                                                  gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
+    SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self);
+
+    AuthSessionQueryAvailableMechanismsData *operation_data =
+        (AuthSessionQueryAvailableMechanismsData *)user_data;
+    g_return_if_fail (operation_data != NULL);
+
+    AuthSessionQueryAvailableMechanismsCbData *cb_data = operation_data->cb_data;
+    g_return_if_fail (cb_data != NULL);
+
+    if (error)
+    {
+        (cb_data->cb)
+            (self, NULL, error, cb_data->user_data);
+
+        g_slice_free (AuthSessionQueryAvailableMechanismsCbData, cb_data);
+    }
+    else if (priv->proxy)
+    {
+        (void) com_nokia_singlesignon_SignonAuthSession_query_available_mechanisms_async (
+                    priv->proxy,
+                    (const char **)operation_data->wanted_mechanisms,
+                    auth_session_query_mechanisms_reply,
+                    cb_data);
+
+        g_signal_emit (self,
+                       auth_session_signals[STATE_CHANGED],
+                       0,
+                       (gint)AS_STATE_PROCESS_PENDING,
+                       auth_session_process_pending_message);
+
+    }
+    else if (!priv->proxy)
+        g_critical ("AuthSessionError: proxy is not initialized but error is NULL");
+
+    g_strfreev (operation_data->wanted_mechanisms);
+    g_slice_free (AuthSessionQueryAvailableMechanismsData, operation_data);
+}
+
+static void
+auth_session_process_ready_cb (gpointer object, const GError *error, gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
+
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
+    SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self);
+
+    AuthSessionProcessData *operation_data =
+        (AuthSessionProcessData *)user_data;
+    g_return_if_fail (operation_data != NULL);
+
+    AuthSessionProcessCbData *cb_data = operation_data->cb_data;
+    g_return_if_fail (cb_data != NULL);
+
+    if (error || priv->canceled)
+    {
+        GError *err = ( error ? (GError *)error : g_error_new(auth_session_errors_quark(),
+                                                              1,
+                                                              SSO_AUTH_SESSION_CANCELED_PROBLEM_G) );
+
+        DEBUG ("AuthSessionError: %s", err->message);
+
+        (cb_data->cb)
+            (self, operation_data->session_data, err, cb_data->user_data);
+
+        if (!error)
+            g_clear_error (&err);
+
+        g_slice_free (AuthSessionProcessCbData, cb_data);
+
+        priv->busy = FALSE;
+        priv->canceled = FALSE;
+    }
+    else if (priv->proxy)
+    {
+
+        (void)com_nokia_singlesignon_SignonAuthSession_process_async(
+                    priv->proxy,
+                    operation_data->session_data,
+                    operation_data->mechanism,
+                    auth_session_process_reply,
+                    cb_data);
+
+        g_hash_table_destroy (operation_data->session_data);
+
+        g_signal_emit (self,
+                       auth_session_signals[STATE_CHANGED],
+                       0,
+                       (gint)AS_STATE_PROCESS_PENDING,
+                       auth_session_process_pending_message);
+    }
+    else if (!priv->proxy)
+    {
+        g_critical ("AuthSessionError: proxy is not initialized but error is NULL");
+        return;
+    }
+
+    g_free (operation_data->mechanism);
+    g_slice_free (AuthSessionProcessData, operation_data);
+}
+
+static void
+auth_session_cancel_ready_cb (gpointer object, const GError *error, gpointer user_data)
+{
+    g_return_if_fail (SIGNON_IS_AUTH_SESSION (object));
+    g_return_if_fail (user_data == NULL);
+
+    SignonAuthSession *self = SIGNON_AUTH_SESSION (object);
+    SignonAuthSessionPrivate *priv = SIGNON_AUTH_SESSION_PRIV (self);
+    g_return_if_fail (priv != NULL);
+
+    if (error)
+    {
+        //TODO: in general this function does not return any values,
+        // that is why I think it should not emit anything for this particular case
+        DEBUG("error during initialization");
+    }
+    else if (priv->proxy && priv->busy)
+        com_nokia_singlesignon_SignonAuthSession_cancel (priv->proxy, NULL);
+
+    priv->busy = FALSE;
+    priv->canceled = FALSE;
+}
+
+static GHashTable*
+auth_session_copy_sessiondata (const GHashTable* old_session_data)
+{
+    GHashTable* new_session_data = g_hash_table_new_full (g_str_hash,
+                                                          g_str_equal,
+                                                          g_free,
+                                                          auth_session_free_gvalue);
+
+   g_hash_table_foreach ((GHashTable*)old_session_data,
+                         (GHFunc)auth_session_copy_gvalue,
+                         (gpointer)new_session_data);
+
+   return new_session_data;
+}
+
+static void
+auth_session_copy_gvalue (gchar* key,
+                          GValue* value,
+                          GHashTable* dest)
+{
+    GValue *copy_value = g_new0 (GValue, 1);
+    g_value_init (copy_value, value->g_type);
+    g_value_copy (value, copy_value);
+
+    g_hash_table_insert (dest, g_strdup(key), copy_value);
+}
+
+static void
+auth_session_free_gvalue (gpointer val)
+{
+    g_return_if_fail (G_IS_VALUE(val));
+
+    GValue* value = (GValue*)val;
+    g_value_unset (value);
+    g_free (value);
+}
diff --git a/libsignon-glib/signon-auth-session.h b/libsignon-glib/signon-auth-session.h
new file mode 100644 (file)
index 0000000..13ee16d
--- /dev/null
@@ -0,0 +1,132 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef SIGNONAUTHSESSION_H_
+#define SIGNONAUTHSESSION_H_
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define SIGNON_SESSION_DATA_USERNAME      "UserName"
+#define SIGNON_SESSION_DATA_SECRET        "Secret"
+#define SIGNON_SESSION_DATA_REALM         "Realm"
+
+enum AuthSessionState {
+    SessionNotStarted = 0,          /**< No message. */
+    HostResolving,                  /**< Resolving remote server host name. */
+    ServerConnecting,               /**< Connecting to remote server. */
+    DataSending,                    /**< Sending data to remote server. */
+    ReplyWaiting,                   /**< Waiting reply from remote server. */
+    UserPending,                    /**< Waiting response from user. */
+    UiRefreshing,                   /**< Refreshing ui request. */
+    ProcessPending,                 /**< Waiting another process to start. */
+    SessionStarted,                 /**< Authentication session is started. */
+    ProcessCanceling,               /**< Canceling.current process: is this really needed??? */
+    ProcessDone,                    /** < ???? Is this really needed > */
+    CustomState,                    /**< Custom message. */
+    MaxState,
+};
+
+typedef enum
+{
+    AS_STATE_NOT_STARTED = 0,           /**< No message. */
+    AS_STATE_HOST_RESOLVING,            /**< Resolving remote server host name. */
+    AS_STATE_SERVER_CONNECTING,         /**< Connecting to remote server. */
+    AS_STATE_DATA_SENDING,              /**< Sending data to remote server. */
+    AS_STATE_DATA_WAITING,              /**< Waiting reply from remote server. */
+    AS_STATE_USER_PENDING,
+    AS_STATE_UI_REFRESHING,
+    AS_STATE_PROCESS_PENDING,
+    AS_STATE_SESSION_STARTED,
+    AS_STATE_PROCESS_CANCELLING,
+    AS_STATE_PROCESS_DONE,
+    AS_STATE_CUSTOM_STATE,
+    AS_STATE_MAX_STATE,
+} SessionObjectState;
+
+
+#define SIGNON_TYPE_AUTH_SESSION                 (signon_auth_session_get_type ())
+#define SIGNON_AUTH_SESSION(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSession))
+#define SIGNON_AUTH_SESSION_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionClass))
+#define SIGNON_IS_AUTH_SESSION(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_AUTH_SESSION))
+#define SIGNON_IS_AUTH_SESSION_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_AUTH_SESSION))
+#define SIGNON_AUTH_SESSION_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_AUTH_SESSION, SignonAuthSessionClass))
+
+typedef struct _SignonAuthSession        SignonAuthSession;
+typedef struct _SignonAuthSessionPrivate SignonAuthSessionPrivate;
+typedef struct _SignonAuthSessionClass   SignonAuthSessionClass;
+
+struct _SignonAuthSession {
+    GObject parent;
+
+    SignonAuthSessionPrivate *priv;
+    gboolean dispose_has_run;
+};
+
+struct _SignonAuthSessionClass {
+    GObjectClass parent;
+};
+
+GType signon_auth_session_get_type (void) G_GNUC_CONST;
+
+//TODO: move it to private header
+typedef void (*SignonAuthSessionStateCahngedCb) (SignonAuthSession* self,
+                                                 gint state,
+                                                 gchar *message,
+                                                 gpointer user_data);
+
+SignonAuthSession *signon_auth_session_new(gint id,
+                                           const gchar *method_name,
+                                           SignonAuthSessionStateCahngedCb cb,
+                                           gpointer user_data,
+                                           GError **err);
+
+gchar *signon_auth_session_name(SignonAuthSession* self);
+
+typedef void (*SignonAuthSessionQueryAvailableMethodsCb) (SignonAuthSession* self,
+                                                          gchar **mechanisms,
+                                                          const GError *error,
+                                                          gpointer user_data);
+void signon_auth_session_query_available_mechanisms(SignonAuthSession* self,
+                                                   const gchar **wanted_mechanisms,
+                                                   SignonAuthSessionQueryAvailableMethodsCb cb,
+                                                   gpointer user_data);
+
+typedef void (*SignonAuthSessionProcessCb) (SignonAuthSession *self,
+                                            GHashTable *session_data,
+                                            const GError *error,
+                                            gpointer user_data);
+void signon_auth_session_process(SignonAuthSession *self,
+                                const GHashTable *session_data,
+                                const gchar *mechanism,
+                                SignonAuthSessionProcessCb cb,
+                                gpointer user_data);
+
+void signon_auth_session_cancel(SignonAuthSession *self);
+
+G_END_DECLS
+
+#endif //SIGNONAUTHSESSIONIMPL_H_
diff --git a/libsignon-glib/signon-dbus-queue.c b/libsignon-glib/signon-dbus-queue.c
new file mode 100644 (file)
index 0000000..d178ca1
--- /dev/null
@@ -0,0 +1,151 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "signon-dbus-queue.h"
+
+typedef struct {
+    SignonReadyCb callback;
+    gpointer user_data;
+} SignonReadyCbData;
+
+typedef struct {
+    gpointer self;
+    GSList *callbacks;
+} SignonReadyData;
+
+static GQuark
+_signon_object_ready_quark()
+{
+  static GQuark quark = 0;
+
+  if (!quark)
+    quark = g_quark_from_static_string ("signon_object_ready_quark");
+
+  return quark;
+}
+
+static GQuark
+_signon_object_error_quark()
+{
+  static GQuark quark = 0;
+
+  if (!quark)
+    quark = g_quark_from_static_string ("signon_object_error_quark");
+
+  return quark;
+}
+
+static void
+signon_object_invoke_ready_callbacks (SignonReadyData *rd, const GError *error)
+{
+    GSList *list;
+
+    for (list = rd->callbacks; list != NULL; list = list->next)
+    {
+        SignonReadyCbData *cb = list->data;
+
+        cb->callback (rd->self, error, cb->user_data);
+        g_slice_free (SignonReadyCbData, cb);
+    }
+    g_slist_free (rd->callbacks);
+}
+
+static void
+signon_ready_data_free (SignonReadyData *rd)
+{
+    if (rd->self)
+    {
+        //TODO: Signon error codes need be presented instead of 555 and 666
+        GError error = { 555, 666, "Object disposed" };
+        signon_object_invoke_ready_callbacks (rd, &error);
+    }
+    g_slice_free (SignonReadyData, rd);
+}
+
+void
+_signon_object_call_when_ready (gpointer object, GQuark quark, SignonReadyCb callback,
+                                gpointer user_data)
+{
+    SignonReadyData *rd;
+    SignonReadyCbData *cb;
+
+    g_return_if_fail (G_IS_OBJECT (object));
+    g_return_if_fail (quark != 0);
+    g_return_if_fail (callback != NULL);
+
+    if (g_object_get_qdata((GObject *)object,
+                           _signon_object_ready_quark()))
+    {
+        //TODO: specify the last error in object initialization
+        GError * err = g_object_get_qdata((GObject *)object,
+                                          _signon_object_error_quark());
+        return (*callback)(object, err, user_data);
+    }
+
+    cb = g_slice_new (SignonReadyCbData);
+    cb->callback = callback;
+    cb->user_data = user_data;
+
+    rd = g_object_get_qdata ((GObject *)object, quark);
+    if (!rd)
+    {
+        rd = g_slice_new (SignonReadyData);
+        rd->self = object;
+        rd->callbacks = NULL;
+        g_object_set_qdata_full ((GObject *)object, quark, rd,
+                                 (GDestroyNotify)signon_ready_data_free);
+    }
+
+    rd->callbacks = g_slist_append (rd->callbacks, cb);
+}
+
+void
+_signon_object_ready (gpointer object, GQuark quark, const GError *error)
+{
+    SignonReadyData *rd;
+
+    g_object_set_qdata((GObject *)object, _signon_object_ready_quark(), (gpointer)TRUE);
+
+    if(error)
+        g_object_set_qdata_full ((GObject *)object, _signon_object_error_quark(),
+                                  g_error_copy(error),
+                                 (GDestroyNotify)g_error_free);
+
+    /* steal the qdata so the callbacks won't be invoked again, even if the
+     * object becomes ready or is finalized while still invoking them */
+
+    rd = g_object_steal_qdata ((GObject *)object, quark);
+    if (!rd) return;
+
+    g_object_ref (object);
+
+    signon_object_invoke_ready_callbacks (rd, error);
+    rd->self = NULL; /* so the callbacks won't be invoked again */
+    signon_ready_data_free (rd);
+
+    g_object_unref (object);
+
+    //TODO: set some sort of ready information
+}
+
diff --git a/libsignon-glib/signon-dbus-queue.h b/libsignon-glib/signon-dbus-queue.h
new file mode 100644 (file)
index 0000000..a39b3ba
--- /dev/null
@@ -0,0 +1,42 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef SIGNONDBUSQUEUEDDATA_H
+#define SIGNONDBUSQUEUEDDATA_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef void (*SignonReadyCb) (gpointer object, const GError *error,
+                               gpointer user_data);
+
+void _signon_object_call_when_ready (gpointer object, GQuark quark,
+                                    SignonReadyCb callback, gpointer user_data);
+
+void _signon_object_ready (gpointer object, GQuark quark, const GError *error);
+
+G_END_DECLS
+#endif /* SIGNONDBUSQUEUEDDATA_H */
diff --git a/libsignon-glib/signon-errors.c b/libsignon-glib/signon-errors.c
new file mode 100644 (file)
index 0000000..48bd0e0
--- /dev/null
@@ -0,0 +1,81 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "signon-errors.h"
+#include "signon-enum-types.h"
+#include "signon-internals.h"
+#include <dbus/dbus-glib.h>
+
+GQuark signon_error_quark (void)
+{
+    static gsize quark = 0;
+
+    if (g_once_init_enter (&quark))
+    {
+        GQuark domain = g_quark_from_static_string ("signon-errors");
+
+        g_assert (sizeof (GQuark) <= sizeof (gsize));
+
+        g_type_init ();
+        dbus_g_error_domain_register (domain, SIGNON_ERROR_PREFIX, SIGNON_TYPE_ERROR);
+        g_once_init_leave (&quark, domain);
+    }
+    return (GQuark) quark;
+}
+
+GError *
+_signon_errors_get_error_from_dbus (GError *error)
+{
+    const gchar *error_name;
+    const gchar *nick;
+    GType enum_type;
+    GEnumClass *enum_class;
+    GEnumValue *enum_value;
+    GError *new_error;
+    gint code = SIGNON_ERROR_UNKNOWN;
+
+    if (error == NULL)
+        return NULL;
+
+    error_name = dbus_g_error_get_name (error);
+
+    if (!g_str_has_prefix (error_name, SIGNON_ERROR_PREFIX))
+        return error;
+
+    nick = error_name + sizeof(SIGNON_ERROR_PREFIX);
+
+    enum_type = signon_error_get_type ();
+    enum_class = g_type_class_ref (enum_type);
+    enum_value = g_enum_get_value_by_nick (enum_class, nick);
+
+    if (enum_value)
+        code = enum_value->value;
+
+    new_error = g_error_new (SIGNON_ERROR, code, error->message);
+
+    g_error_free (error);
+    g_type_class_unref (enum_class);
+
+    return new_error;
+}
diff --git a/libsignon-glib/signon-errors.h b/libsignon-glib/signon-errors.h
new file mode 100644 (file)
index 0000000..0af1ac4
--- /dev/null
@@ -0,0 +1,63 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef __LIBSIGNON_ERRORS_H__
+#define __LIBSIGNON_ERRORS_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include "signon-enum-types.h"
+
+#define SIGNON_ERROR_PREFIX "com.nokia.singlesignon.Error"
+
+#define SIGNON_ERROR (signon_error_quark())
+
+typedef enum {
+    SIGNON_ERROR_INTERNAL_SERVER, /*< nick=InternalServer >*/
+    SIGNON_ERROR_METHOD_NOT_KNOWN, /*< nick=MethodNotKnown >*/
+    SIGNON_ERROR_INVALID_QUERY, /*< nick=InvalidQuery >*/
+    SIGNON_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/
+    SIGNON_ERROR_UNKNOWN, /*< nick=Unknown >*/
+    SIGNON_ERROR_NOT_FOUND, /*< nick=NotFound >*/
+    SIGNON_ERROR_METHOD_NOT_AVAILABLE, /*< nick=MethodNotAvaliable >*/
+    SIGNON_ERROR_STORE_FAILED, /*< nick=StoreFailed >*/
+    SIGNON_ERROR_REMOVE_FAILED, /*< nick=RemoveFailed >*/
+    SIGNON_ERROR_SIGNOUT_FAILED, /*< nick=SignOutFailed >*/
+    SIGNON_ERROR_CANCELED, /*< nick=Canceled >*/
+    SIGNON_ERROR_CREDENTIALS_NOT_AVAILABLE, /*< nick=CredentialsNotAvailable >*/
+    SIGNON_ERROR_MECHANISM_NOT_AVAILABLE, /*< nick=MechanismNotAvailable >*/
+    SIGNON_ERROR_WRONG_STATE, /*< nick=WrongState >*/
+    SIGNON_ERROR_OPERATION_NOT_SUPPORTED, /*< nick=OperationNotSupported >*/
+    SIGNON_ERROR_NO_CONNECTION, /*< nick=NoConnection >*/
+    SIGNON_ERROR_SSL, /*< nick=SslError >*/
+    SIGNON_ERROR_TIMEDOUT, /*< nick=TimedOut >*/
+    SIGNON_ERROR_RUNTIME /*< nick=Runtime >*/
+} SignonError;
+
+#define SignonError SignonError
+
+GQuark signon_error_quark (void);
+
+
+#endif
diff --git a/libsignon-glib/signon-identity.c b/libsignon-glib/signon-identity.c
new file mode 100644 (file)
index 0000000..c6c2c06
--- /dev/null
@@ -0,0 +1,277 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/**
+ * SECTION:signon-identity
+ * @title: SignonIdentity
+ * @short_description: client side presentation of a credential.
+ *
+ * The #SignonIdentity represents an database entry for a single identity.
+ */
+
+#include "signon-identity.h"
+#include "signon-internals.h"
+#include "signon-proxy.h"
+#include "signon-identity-glib-gen.h"
+#include "signon-client-glib-gen.h"
+#include <glib.h>
+
+#define SIGNON_IDENTITY_IFACE  "com.nokia.singlesignon.SignonIdentity"
+
+G_DEFINE_TYPE (SignonIdentity, signon_identity, G_TYPE_OBJECT);
+
+enum
+{
+    PROP_0,
+
+    PROP_ID
+};
+
+typedef struct _SignonIdentityInfo
+{
+    gchar *user_name;
+    gchar *password;
+    gchar *caption;
+} SignonIdentityInfo;
+
+struct _SignonIdentityPrivate
+{
+    SignonProxy *signon_proxy;
+    SignonIdentityInfo *identityInfo;
+    GError *last_error;
+    guint id;
+};
+
+#define SIGNON_IDENTITY_PRIV(obj) (SIGNON_IDENTITY(obj)->priv)
+
+static void
+signon_identity_set_property (GObject *object,
+                              guint property_id,
+                              const GValue *value,
+                              GParamSpec *pspec)
+{
+    SignonIdentity *self = SIGNON_IDENTITY (object);
+
+    switch (property_id)
+    {
+    case PROP_ID:
+        self->priv->id = g_value_get_uint (value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+
+    }
+}
+
+static void
+signon_identity_get_property (GObject *object,
+                              guint property_id,
+                              GValue *value,
+                              GParamSpec *pspec)
+{
+    SignonIdentity *self = SIGNON_IDENTITY (object);
+
+    switch (property_id)
+    {
+    case PROP_ID:
+        g_value_set_uint (value, self->priv->id);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+signon_identity_init (SignonIdentity *identity)
+{
+    identity->priv = G_TYPE_INSTANCE_GET_PRIVATE (identity, SIGNON_TYPE_IDENTITY,
+                                                  SignonIdentityPrivate);
+    identity->priv->signon_proxy = signon_proxy_new();
+}
+
+static void
+signon_identity_dispose (GObject *object)
+{
+    SignonIdentity *identity = SIGNON_IDENTITY (object);
+    SignonIdentityPrivate *priv = identity->priv;
+
+    if (priv->identityInfo)
+    {
+        g_slice_free (SignonIdentityInfo, priv->identityInfo);
+        priv->identityInfo = NULL;
+    }
+
+    if (priv->last_error)
+        g_error_free (priv->last_error);
+
+    if (priv->signon_proxy)
+    {
+        g_object_unref (priv->signon_proxy);
+        priv->signon_proxy = NULL;
+    }
+
+    G_OBJECT_CLASS (signon_identity_parent_class)->dispose (object);
+}
+
+static void
+signon_identity_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (signon_identity_parent_class)->finalize (object);
+}
+
+static void
+signon_identity_class_init (SignonIdentityClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    GParamSpec *pspec;
+
+    object_class->set_property = signon_identity_set_property;
+    object_class->get_property = signon_identity_get_property;
+
+    pspec = g_param_spec_uint ("id",
+                               "Identity ID",
+                               "Set/Get Identity ID",
+                               0, G_MAXUINT, 0,
+                               G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+
+    g_object_class_install_property (object_class,
+                                     PROP_ID,
+                                     pspec);
+
+    g_type_class_add_private (object_class, sizeof (SignonIdentityPrivate));
+
+    object_class->dispose = signon_identity_dispose;
+    object_class->finalize = signon_identity_finalize;
+}
+
+void
+_signon_identity_registered (SignonIdentity *identity, DBusGProxy *proxy,
+                             char *objectPath, GPtrArray *identityArray,
+                             GError *error)
+{
+    g_return_if_fail (SIGNON_IS_IDENTITY (identity));
+    g_return_if_fail (objectPath != NULL);
+
+    SignonIdentityPrivate *priv;
+    priv = identity->priv;
+
+    if (error)
+    {
+        g_warning ("%s: %s", G_STRFUNC, error->message);
+
+        if (priv->last_error)
+            g_error_free (priv->last_error);
+
+        priv->last_error = error;
+
+        return;
+    }
+
+    priv->identityInfo = g_slice_new(SignonIdentityInfo);
+
+    GValue *value;
+
+    /* get the user name (gchar*) */
+    value = g_ptr_array_index (identityArray, 1);
+    g_assert (G_VALUE_HOLDS_STRING(value));
+    priv->identityInfo->user_name = g_value_dup_string (value);
+    g_value_unset (value);
+
+    /* get the password (gchar*) */
+    value = g_ptr_array_index (identityArray, 2);
+    g_assert (G_VALUE_HOLDS_STRING(value));
+    priv->identityInfo->password = g_value_dup_string (value);
+    g_value_unset (value);
+
+    /* get the caption (gchar*) */
+    value = g_ptr_array_index (identityArray, 3);
+    g_assert (G_VALUE_HOLDS_STRING(value));
+    priv->identityInfo->caption = g_value_dup_string (value);
+    g_value_unset (value);
+
+    g_ptr_array_free (identityArray, TRUE);
+}
+
+gchar*
+signon_identity_get_username (SignonIdentity *identity)
+{
+    g_return_val_if_fail (SIGNON_IS_IDENTITY (identity), NULL);
+    SignonIdentityPrivate *priv;
+
+    priv = SIGNON_IDENTITY_PRIV (identity);
+
+    return priv->identityInfo->user_name;
+}
+
+GError*
+signon_identity_get_last_error (SignonIdentity *identity)
+{
+    g_return_val_if_fail (SIGNON_IS_IDENTITY (identity), NULL);
+
+    SignonIdentityPrivate *priv;
+    priv = identity->priv;
+
+    return priv->last_error;
+}
+
+static void
+identity_new_from_db_cb (DBusGProxy *proxy, char *objectPath,
+                         GPtrArray *identityData,
+                         GError *error, gpointer userdata)
+{
+    SignonIdentity *identity = (SignonIdentity*)userdata;
+    GError *new_error = NULL;
+    g_return_if_fail (identity != NULL);
+
+    if (error)
+        new_error = _signon_errors_get_error_from_dbus (error);
+
+    _signon_identity_registered (identity, proxy, objectPath, identityData, new_error);
+}
+
+/**
+ * signon_identity_new_from_db:
+ * @id: identity ID.
+ *
+ * Construct an identity object associated with an existing identity record.
+ * Returns: an instance of an #SignonIdentity.
+ */
+SignonIdentity*
+signon_identity_new_from_db (guint32 id)
+{
+    SignonIdentity *identity;
+
+    if (id == 0)
+        return NULL;
+
+    identity = g_object_new (SIGNON_TYPE_IDENTITY, "id", id, NULL);
+    g_return_val_if_fail (SIGNON_IS_IDENTITY (identity), NULL);
+
+    com_nokia_singlesignon_SignonDaemon_register_stored_identity_async
+        (DBUS_G_PROXY (identity->priv->signon_proxy), id, identity_new_from_db_cb, identity);
+
+    return identity;
+}
diff --git a/libsignon-glib/signon-identity.h b/libsignon-glib/signon-identity.h
new file mode 100644 (file)
index 0000000..4ccb521
--- /dev/null
@@ -0,0 +1,64 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _SIGNON_IDENTITY_H_
+#define _SIGNON_IDENTITY_H_
+
+#include <glib-object.h>
+#include <dbus/dbus-glib.h>
+
+G_BEGIN_DECLS
+
+#define SIGNON_TYPE_IDENTITY             (signon_identity_get_type ())
+#define SIGNON_IDENTITY(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_IDENTITY, SignonIdentity))
+#define SIGNON_IDENTITY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_IDENTITY, SignonIdentityClass))
+#define SIGNON_IS_IDENTITY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_IDENTITY))
+#define SIGNON_IS_IDENTITY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_IDENTITY))
+#define SIGNON_IDENTITY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_IDENTITY, SignonIdentityClass))
+
+typedef struct _SignonIdentityClass SignonIdentityClass;
+typedef struct _SignonIdentityPrivate SignonIdentityPrivate;
+typedef struct _SignonIdentity SignonIdentity;
+
+struct _SignonIdentityClass
+{
+    GObjectClass parent_class;
+};
+
+struct _SignonIdentity
+{
+    GObject parent_instance;
+    SignonIdentityPrivate *priv;
+};
+
+GType signon_identity_get_type (void) G_GNUC_CONST;
+
+SignonIdentity *signon_identity_new_from_db (guint32 id);
+
+gchar *signon_identity_get_username (SignonIdentity *identity);
+GError *signon_identity_get_last_error (SignonIdentity *identity);
+
+G_END_DECLS
+
+#endif /* _SIGNON_IDENTITY_H_ */
diff --git a/libsignon-glib/signon-internals.h b/libsignon-glib/signon-internals.h
new file mode 100644 (file)
index 0000000..21fd519
--- /dev/null
@@ -0,0 +1,59 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _SIGNONINTERNALS_H_
+#define _SIGNONINTERNALS_H_
+
+#ifndef SIGNON_TRACE
+#define SIGNON_TRACE
+#endif
+
+#ifdef SIGNON_TRACE
+    #define DEBUG(format...) g_debug (G_STRLOC ": " format)
+#else
+    #define DEBUG(...) do {} while (0)
+#endif
+
+#define SIGNON_SERVICE  "com.nokia.singlesignon"
+#define SIGNON_PATH  "/SignonDaemon"
+#define SIGNON_IFACE  "com.nokia.singlesignon.SignonDaemon"
+#define SIGNON_AUTH_SESSION_IFACE  "com.nokia.singlesignon.SignonAuthSession"
+
+#include "signon-identity.h"
+#include "signon-auth-session.h"
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL
+void _signon_identity_registered (SignonIdentity *identity, DBusGProxy *proxy,
+                                  char *objectPath, GPtrArray *identityArray,
+                                  GError *error);
+
+G_GNUC_INTERNAL
+GError *_signon_errors_get_error_from_dbus (GError *error);
+
+G_END_DECLS
+
+#endif
+
diff --git a/libsignon-glib/signon-marshal.list b/libsignon-glib/signon-marshal.list
new file mode 100644 (file)
index 0000000..f9dbce5
--- /dev/null
@@ -0,0 +1,3 @@
+VOID:POINTER,UINT,BOXED
+VOID:INT,STRING
+
diff --git a/libsignon-glib/signon-proxy.c b/libsignon-glib/signon-proxy.c
new file mode 100644 (file)
index 0000000..a09887f
--- /dev/null
@@ -0,0 +1,106 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "signon-proxy.h"
+#include "signon-internals.h"
+#include <dbus/dbus-glib.h>
+
+G_DEFINE_TYPE (SignonProxy, signon_proxy, DBUS_TYPE_G_PROXY);
+
+static SignonProxy *signon_proxy = NULL;
+
+static void
+signon_proxy_init (SignonProxy *self)
+{
+}
+
+static GObject *
+signon_proxy_constructor (GType type, guint n_params,
+                          GObjectConstructParam *params)
+{
+    GObjectClass *object_class =
+        (GObjectClass *)signon_proxy_parent_class;
+    GObject *object;
+
+    if (!signon_proxy)
+    {
+        object = object_class->constructor (type,
+                                            n_params,
+                                            params);
+        signon_proxy = SIGNON_PROXY (object);
+    }
+    else
+        object = g_object_ref (G_OBJECT (signon_proxy));
+
+    return object;
+}
+
+static void
+signon_proxy_dispose (GObject *object)
+{
+    G_OBJECT_CLASS (signon_proxy_parent_class)->dispose (object);
+}
+
+static void
+signon_proxy_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (signon_proxy_parent_class)->finalize (object);
+}
+
+static void
+signon_proxy_class_init (SignonProxyClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->dispose = signon_proxy_dispose;
+    object_class->constructor = signon_proxy_constructor;
+    object_class->finalize = signon_proxy_finalize;
+}
+
+SignonProxy *
+signon_proxy_new ()
+{
+    SignonProxy *proxy;
+    GError *error = NULL;
+
+    DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+    if (error)
+    {
+        g_warning ("%s returned error: %s", G_STRFUNC, error->message);
+        g_error_free (error);
+        return NULL;
+    }
+
+    proxy = g_object_new (SIGNON_TYPE_PROXY,
+                          "name", SIGNON_SERVICE,
+                          "path", SIGNON_PATH,
+                          "interface", SIGNON_IFACE,
+                          "connection", connection,
+                          NULL);
+
+    dbus_g_connection_unref (connection);
+
+    return proxy;
+}
diff --git a/libsignon-glib/signon-proxy.h b/libsignon-glib/signon-proxy.h
new file mode 100644 (file)
index 0000000..c0ef0ad
--- /dev/null
@@ -0,0 +1,59 @@
+/* vi: set et sw=4 ts=4 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of libsignon-glib
+ *
+ * Copyright (C) 2009-2010 Nokia Corporation.
+ *
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _SIGNON_AUTH_PROXY_H_
+#define _SIGNON_AUTH_PROXY_H_
+
+
+#include <glib-object.h>
+#include <dbus/dbus-glib.h>
+
+#define SIGNON_TYPE_PROXY             (signon_proxy_get_type ())
+#define SIGNON_PROXY(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), SIGNON_TYPE_PROXY, SignonProxy))
+#define SIGNON_PROXY_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), SIGNON_TYPE_PROXY, SignonProxyClass))
+#define SIGNON_IS_PROXY(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SIGNON_TYPE_PROXY))
+#define SIGNON_IS_PROXY_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), SIGNON_TYPE_PROXY))
+#define SIGNON_PROXY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), SIGNON_TYPE_PROXY, SignonProxyClass))
+
+
+typedef struct _SignonProxyClass SignonProxyClass;
+typedef struct _SignonProxy SignonProxy;
+
+struct _SignonProxyClass
+{
+    DBusGProxyClass parent_class;
+};
+
+struct _SignonProxy
+{
+    DBusGProxyClass parent_instance;
+};
+
+GType signon_proxy_get_type (void) G_GNUC_CONST;
+
+SignonProxy *signon_proxy_new ();
+
+G_END_DECLS
+
+#endif /* _SIGNON_PROXY_H_ */
diff --git a/libsignon-glib/signonauthsession.xml b/libsignon-glib/signonauthsession.xml
new file mode 100644 (file)
index 0000000..6d4dd03
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="com.nokia.singlesignon.SignonAuthSession">
+    <signal name="stateChanged">
+      <arg name="state" type="i" direction="out"/>
+      <arg name="message" type="s" direction="out"/>
+    </signal>
+    <method name="queryAvailableMechanisms">
+      <arg type="as" direction="out"/>
+      <arg name="wantedMechanisms" type="as" direction="in"/>
+    </method>
+    <method name="process">
+      <arg type="a{sv}" direction="out"/>
+      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+      <arg name="sessionDataVa" type="a{sv}" direction="in"/>
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg name="mechanism" type="s" direction="in"/>
+    </method>
+    <method name="cancel">
+      <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+    </method>
+    <method name="setId">
+      <arg name="id" type="u" direction="in"/>
+      <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+    </method>
+    <method name="objectUnref">
+      <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+    </method>
+  </interface>
+</node>
diff --git a/libsignon-glib/signondaemon.xml b/libsignon-glib/signondaemon.xml
new file mode 100644 (file)
index 0000000..315d1d2
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="com.nokia.singlesignon.SignonDaemon">
+    <method name="registerNewIdentity">
+      <arg name="objectPath" type="o" direction="out"/>
+    </method>
+    <method name="registerStoredIdentity">
+      <arg name="id" type="u" direction="in"/>
+      <arg type="o" direction="out"/>
+      <arg name="identityData" type="av" direction="out"/>
+    </method>
+    <method name="queryMethods">
+      <arg type="as" direction="out"/>
+    </method>
+    <method name="queryMechanisms">
+      <arg type="as" direction="out"/>
+      <arg name="method" type="s" direction="in"/>
+    </method>
+    <method name="queryIdentities">
+      <arg type="av" direction="out"/>
+      <arg name="filter" type="a{sv}" direction="in"/>
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+    </method>
+    <method name="clear">
+      <arg type="b" direction="out"/>
+    </method>
+    <method name="getAuthSessionObjectPath">
+      <arg type="s" direction="out"/>
+      <arg name="id" type="u" direction="in"/>
+      <arg name="type" type="s" direction="in"/>
+    </method>
+    <method name="setDeviceLockCode">
+      <arg type="b" direction="out"/>
+      <arg name="oldLockCode" type="ay" direction="in"/>
+      <arg name="newLockCode" type="ay" direction="in"/>
+    </method>
+    <method name="setSim">
+      <arg type="b" direction="out"/>
+      <arg name="simData" type="ay" direction="in"/>
+      <arg name="checkData" type="ay" direction="in"/>
+    </method>
+    <method name="remoteLock">
+      <arg type="b" direction="out"/>
+      <arg name="lockCode" type="ay" direction="in"/>
+    </method>
+  </interface>
+</node>
diff --git a/libsignon-glib/signonidentity.xml b/libsignon-glib/signonidentity.xml
new file mode 100644 (file)
index 0000000..039e396
--- /dev/null
@@ -0,0 +1,40 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="com.nokia.singlesignon.SignonIdentity">
+    <signal name="infoUpdated">
+      <arg type="i" direction="out"/>
+    </signal>
+    <method name="requestCredentialsUpdate">
+      <arg type="u" direction="out"/>
+      <arg name="message" type="s" direction="in"/>
+    </method>
+    <method name="queryInfo">
+      <arg type="av" direction="out"/>
+    </method>
+    <method name="verifyUser">
+      <arg type="b" direction="out"/>
+      <arg name="message" type="s" direction="in"/>
+    </method>
+    <method name="verifySecret">
+      <arg type="b" direction="out"/>
+      <arg name="secret" type="s" direction="in"/>
+    </method>
+    <method name="remove">
+    </method>
+    <method name="signOut">
+      <arg type="b" direction="out"/>
+    </method>
+    <method name="storeCredentials">
+      <arg type="u" direction="out"/>
+      <arg name="id" type="u" direction="in"/>
+      <arg name="userName" type="s" direction="in"/>
+      <arg name="secret" type="s" direction="in"/>
+      <arg name="storeSecret" type="b" direction="in"/>
+      <arg name="methods" type="a{sv}" direction="in"/>
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In4" value="QVariantMap"/>
+      <arg name="caption" type="s" direction="in"/>
+      <arg name="realms" type="as" direction="in"/>
+      <arg name="accessControlList" type="as" direction="in"/>
+    </method>
+  </interface>
+</node>
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644 (file)
index 0000000..da78d9b
--- /dev/null
@@ -0,0 +1,18 @@
+## Process this file with automake to produce Makefile.in
+
+INCLUDES=-I$(top_srcdir) $(DEPS_CFLAGS)
+
+bin_PROGRAMS = signon-glib-testsuite
+bin_SCRIPTS = signon-glib-test.sh
+CLEANFILES = $(bin_SCRIPTS)
+
+signon_glib_testsuite_SOURCES = check_signon.c
+signon_glib_testsuite_CFLAGS = $(CHECK_FLAGS) -I$(top_srcdir)
+signon_glib_testsuite_LDADD = \
+       $(CHECK_LIBS) \
+       $(DEPS_LIBS) \
+       $(top_builddir)/libsignon-glib/libsignon-glib.la
+
+TESTS = signon-glib-testsuite
+
+testdata_DATA = tests.xml
diff --git a/tests/check_signon.c b/tests/check_signon.c
new file mode 100644 (file)
index 0000000..c4b6877
--- /dev/null
@@ -0,0 +1,601 @@
+/**
+ * Copyright (C) 2009 Nokia Corporation.
+ * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
+ * Licensed under the terms of Nokia EUSA (see the LICENSE file)
+ */
+
+/**
+ * @example check_signon.c
+ * Shows how to initialize the framework.
+ */
+#include "libsignon-glib/signon-internals.h"
+#include "libsignon-glib/signon-auth-service.h"
+#include "libsignon-glib/signon-auth-session.h"
+#include "libsignon-glib/signon-identity.h"
+#include "libsignon-glib/signon-client-glib-gen.h"
+#include "libsignon-glib/signon-identity-glib-gen.h"
+#include "libsignon-glib/signon-errors.h"
+
+#include <glib.h>
+#include <check.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dbus/dbus-glib.h>
+
+static GMainLoop *main_loop = NULL;
+static SignonAuthService *auth_service = NULL;
+static SignonIdentity *identity = NULL;
+
+static SignonAuthSession *auth_session = NULL;
+
+static void
+end_test ()
+{
+    if (auth_service)
+    {
+        g_object_unref (auth_service);
+        auth_service = NULL;
+    }
+
+    if (identity)
+    {
+        g_object_unref (identity);
+        identity = NULL;
+    }
+
+    if (main_loop)
+    {
+        g_main_loop_quit (main_loop);
+        g_main_loop_unref (main_loop);
+        main_loop = NULL;
+    }
+}
+
+START_TEST(test_init)
+{
+    g_type_init ();
+
+    auth_service = signon_auth_service_new ();
+    main_loop = g_main_loop_new (NULL, FALSE);
+
+    fail_unless (SIGNON_IS_AUTH_SERVICE (auth_service),
+                 "Failed to initialize the AuthService.");
+    end_test ();
+}
+END_TEST
+
+static void
+signon_query_methods_cb (SignonAuthService *auth_service, gchar **methods,
+                         GError *error, gpointer user_data)
+{
+    if (error)
+    {
+        g_warning ("%s: %s", G_STRFUNC, error->message);
+        g_main_loop_quit (main_loop);
+        fail();
+    }
+
+    gboolean has_sasl = FALSE;
+
+    fail_unless (g_strcmp0 (user_data, "Hello") == 0, "Got wrong string");
+    fail_unless (methods != NULL, "The methods does not exist");
+
+    while (*methods)
+    {
+        if (g_strcmp0 (*methods, "sasl") == 0)
+        {
+            has_sasl = TRUE;
+            break;
+        }
+        methods++;
+    }
+    fail_unless (has_sasl, "sasl method does not exist");
+
+    g_main_loop_quit (main_loop);
+}
+
+START_TEST(test_query_methods)
+{
+    g_type_init ();
+
+    if(!main_loop)
+        main_loop = g_main_loop_new (NULL, FALSE);
+
+    auth_service = signon_auth_service_new ();
+
+    fail_unless (SIGNON_IS_AUTH_SERVICE (auth_service),
+                 "Failed to initialize the AuthService.");
+
+    signon_auth_service_query_methods (auth_service, (SignonQueryMethodsCb)signon_query_methods_cb, "Hello");
+    g_main_loop_run (main_loop);
+    end_test ();
+}
+END_TEST
+
+static void
+signon_query_mechanisms_cb (SignonAuthService *auth_service, gchar *method,
+        gchar **mechanisms, GError *error, gpointer user_data)
+{
+    if (error)
+    {
+        g_warning ("%s: %s", G_STRFUNC, error->message);
+        g_main_loop_quit (main_loop);
+        fail();
+    }
+
+    gboolean has_plain = FALSE;
+    gboolean has_digest = FALSE;
+
+    fail_unless (strcmp (user_data, "Hello") == 0, "Got wrong string");
+    fail_unless (mechanisms != NULL, "The mechanisms does not exist");
+
+    while (*mechanisms)
+    {
+        if (g_strcmp0 (*mechanisms, "PLAIN") == 0)
+            has_plain = TRUE;
+
+        if (g_strcmp0 (*mechanisms, "DIGEST-MD5") == 0)
+            has_digest = TRUE;
+
+        mechanisms++;
+    }
+
+
+    fail_unless (has_plain, "PLAIN mechanism does not exist");
+    fail_unless (has_digest, "DIGEST-MD5 mechanism does not exist");
+
+    g_main_loop_quit (main_loop);
+}
+
+START_TEST(test_query_mechanisms)
+{
+    g_type_init ();
+
+    auth_service = signon_auth_service_new ();
+
+    fail_unless (SIGNON_IS_AUTH_SERVICE (auth_service),
+                 "Failed to initialize the AuthService.");
+
+    signon_auth_service_query_mechanisms (auth_service,
+                                          "sasl",
+                                          (SignonQueryMechanismCb)signon_query_mechanisms_cb,
+                                          "Hello");
+    if(!main_loop)
+        main_loop = g_main_loop_new (NULL, FALSE);
+
+    g_main_loop_run (main_loop);
+    end_test ();
+}
+END_TEST
+
+static void
+test_auth_session_query_mechanisms_cb (SignonAuthSession *self,
+                                      gchar **mechanisms,
+                                      const GError *error,
+                                      gpointer user_data)
+{
+    if (error)
+    {
+        g_warning ("%s: %s", G_STRFUNC, error->message);
+        g_main_loop_quit (main_loop);
+        fail();
+    }
+
+    fail_unless (mechanisms != NULL, "The mechanisms does not exist");
+
+    gchar** patterns = (gchar**)user_data;
+
+    int i = g_strv_length(mechanisms);
+    fail_unless( i == g_strv_length(patterns), "The number of obtained methods is wrong: %d %s", i);
+
+    while ( i > 0 )
+    {
+        gchar* pattern = patterns[--i];
+        fail_unless(g_strcmp0(pattern, mechanisms[i]) == 0, "The obtained mechanism differs from predefined pattern: %s vs %s", mechanisms[i], pattern);
+    }
+
+    g_strfreev(mechanisms);
+    g_main_loop_quit (main_loop);
+}
+
+START_TEST(test_auth_session_query_mechanisms)
+{
+    g_type_init();
+
+    if(!auth_session)
+    {
+        GError *err = NULL;
+        auth_session = signon_auth_session_new(0, "ssotest", NULL, NULL, &err);
+        g_clear_error(&err);
+        fail_unless (auth_session != NULL, "Cannot create AuthSession object");
+    }
+
+    gchar* patterns[4];
+    patterns[0] = g_strdup("mech1");
+    patterns[1] = g_strdup("mech2");
+    patterns[2] = g_strdup("mech3");
+    patterns[3] = NULL;
+
+    signon_auth_session_query_available_mechanisms(auth_session,
+                                                  (const gchar**)patterns,
+                                                  test_auth_session_query_mechanisms_cb,
+                                                  (gpointer)patterns);
+    if(!main_loop)
+        main_loop = g_main_loop_new (NULL, FALSE);
+
+    g_main_loop_run (main_loop);
+
+    g_free(patterns[2]);
+    patterns[2] = NULL;
+
+    signon_auth_session_query_available_mechanisms(auth_session,
+                                                  (const gchar**)patterns,
+                                                  test_auth_session_query_mechanisms_cb,
+                                                  (gpointer)patterns);
+
+    g_main_loop_run (main_loop);
+
+    g_free(patterns[1]);
+    patterns[1] = NULL;
+
+    signon_auth_session_query_available_mechanisms(auth_session,
+                                                  (const gchar**)patterns,
+                                                  test_auth_session_query_mechanisms_cb,
+                                                  (gpointer)patterns);
+
+    g_main_loop_run (main_loop);
+
+    g_free(patterns[0]);
+    end_test ();
+}
+END_TEST
+
+static void
+test_auth_session_query_mechanisms_nonexisting_cb (SignonAuthSession *self,
+                                                  gchar **mechanisms,
+                                                  const GError *error,
+                                                  gpointer user_data)
+{
+    if (!error)
+    {
+        g_main_loop_quit (main_loop);
+        fail();
+        return;
+    }
+
+    g_warning ("%s: %s", G_STRFUNC, error->message);
+    g_main_loop_quit (main_loop);
+}
+
+START_TEST(test_auth_session_query_mechanisms_nonexisting)
+{
+    g_type_init();
+
+    if(!auth_session)
+    {
+        g_object_unref(auth_session);
+        auth_session = NULL;
+    }
+
+    GError *err = NULL;
+    auth_session = signon_auth_session_new(0, "nonexisting", NULL, NULL, &err);
+    g_clear_error(&err);
+    fail_unless (auth_session != NULL, "Cannot create AuthSession object");
+
+    gchar* patterns[4];
+    patterns[0] = g_strdup("mech1");
+    patterns[1] = g_strdup("mech2");
+    patterns[2] = g_strdup("mech3");
+    patterns[3] = NULL;
+
+    signon_auth_session_query_available_mechanisms(auth_session,
+                                                  (const gchar**)patterns,
+                                                  test_auth_session_query_mechanisms_nonexisting_cb,
+                                                  (gpointer)patterns);
+    if(!main_loop)
+        main_loop = g_main_loop_new (NULL, FALSE);
+
+    g_main_loop_run (main_loop);
+
+    g_free(patterns[0]);
+    end_test ();
+}
+END_TEST
+
+static void
+test_auth_session_states_cb (SignonAuthSession *self,
+                             gint state,
+                             gchar *message,
+                             gpointer user_data)
+{
+    gint *state_counter = (gint *)user_data;
+    g_printf("State: %d %s\n", *state_counter, message);
+
+    (*state_counter)++;
+}
+
+static void
+test_auth_session_process_cb (SignonAuthSession *self,
+                             GHashTable *sessionData,
+                             const GError *error,
+                             gpointer user_data)
+{
+    if (error)
+    {
+        g_warning ("%s: %s", G_STRFUNC, error->message);
+        g_main_loop_quit (main_loop);
+        fail();
+    }
+
+    fail_unless (sessionData != NULL, "The result is empty");
+
+    gchar* usernameKey = g_strdup(SIGNON_SESSION_DATA_USERNAME);
+    GValue* usernameVa = (GValue*)g_hash_table_lookup(sessionData, usernameKey);
+
+    gchar* realmKey = g_strdup(SIGNON_SESSION_DATA_REALM);
+    GValue* realmVa = (GValue*)g_hash_table_lookup(sessionData, realmKey);
+
+    fail_unless(g_strcmp0(g_value_get_string(usernameVa), "test_username") == 0, "Wrong value of username");
+    fail_unless(g_strcmp0(g_value_get_string(realmVa), "testRealm_after_test") == 0, "Wrong value of realm");
+
+    g_hash_table_destroy(sessionData);
+
+    g_free(usernameKey);
+    g_free(realmKey);
+
+    g_main_loop_quit (main_loop);
+}
+
+START_TEST(test_auth_session_process)
+{
+    g_type_init();
+
+    gint state_counter = 0;
+
+    if(auth_session)
+    {
+        g_object_unref(auth_session);
+        fail_unless (auth_session == NULL, "Cannot delete AuthSession object");
+    }
+
+    GError *err = NULL;
+    auth_session = signon_auth_session_new (0, "ssotest", test_auth_session_states_cb, &state_counter, &err);
+    g_clear_error(&err);
+    fail_unless (auth_session != NULL, "Cannot create AuthSession object");
+
+    GHashTable* sessionData = g_hash_table_new(g_str_hash,
+                                               g_str_equal);
+    GValue* usernameVa = g_new0(GValue, 1);
+    gchar* usernameKey = g_strdup(SIGNON_SESSION_DATA_USERNAME);
+    g_value_init (usernameVa, G_TYPE_STRING);
+    g_value_set_static_string(usernameVa, "test_username");
+
+    g_hash_table_insert (sessionData,
+                         usernameKey,
+                         usernameVa);
+
+    GValue* passwordVa = g_new0(GValue, 1);
+    gchar* passwordKey = g_strdup(SIGNON_SESSION_DATA_SECRET);
+
+    g_value_init (passwordVa, G_TYPE_STRING);
+    g_value_set_static_string(passwordVa, "test_username");
+
+    g_hash_table_insert (sessionData,
+                         passwordKey,
+                         passwordVa);
+
+    signon_auth_session_process(auth_session,
+                               sessionData,
+                               "mech1",
+                               test_auth_session_process_cb,
+                               sessionData);
+    if(!main_loop)
+        main_loop = g_main_loop_new (NULL, FALSE);
+
+    g_main_loop_run (main_loop);
+    fail_unless (state_counter == 12, "Wrong numer of state change signals: %d", state_counter);
+    state_counter = 0;
+
+    signon_auth_session_process(auth_session,
+                               sessionData,
+                               "mech1",
+                               test_auth_session_process_cb,
+                               sessionData);
+
+    g_main_loop_run (main_loop);
+    fail_unless (state_counter == 12, "Wrong numer of state change signals: %d", state_counter);
+    state_counter = 0;
+
+    signon_auth_session_process(auth_session,
+                               sessionData,
+                               "mech1",
+                               test_auth_session_process_cb,
+                               sessionData);
+
+    g_main_loop_run (main_loop);
+    fail_unless (state_counter == 12, "Wrong numer of state change signals: %d", state_counter);
+    state_counter = 0;
+
+
+    g_value_unset(usernameVa);
+    g_free(usernameVa);
+    g_free(usernameKey);
+
+    g_value_unset(passwordVa);
+    g_free(passwordVa);
+    g_free(passwordKey);
+}
+END_TEST
+
+static guint
+new_identity()
+{
+    DBusGConnection *connection;
+    DBusGProxy *proxy;
+    guint id = 0;
+    GError *error = NULL;
+
+    connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+    if(connection)
+    {
+        proxy = dbus_g_proxy_new_for_name (connection,
+                                           "com.nokia.singlesignon",
+                                           "/SignonDaemon",
+                                           "com.nokia.singlesignon.SignonDaemon");
+    }
+    else if (error)
+    {
+        g_warning ("%s %d returned error: %s", G_STRFUNC, __LINE__, error->message);
+        g_error_free (error);
+    }
+
+    gchar *objectPath;
+    com_nokia_singlesignon_SignonDaemon_register_new_identity (proxy, &objectPath, &error);
+
+    if (error)
+    {
+        g_warning ("%s %d returned error: %s", G_STRFUNC, __LINE__, error->message);
+        g_error_free (error);
+        fail();
+    }
+
+    GHashTable *hash_table;
+    gchar *key = "key";
+    GValue value = {0};
+
+    g_type_init ();
+    g_value_init (&value, G_TYPE_STRING);
+    g_value_set_static_string (&value, "value");
+
+    hash_table = g_hash_table_new (g_str_hash, g_str_equal);
+    g_hash_table_insert (hash_table, g_strdup(key),&value);
+
+    proxy = dbus_g_proxy_new_for_name (connection,
+                                       "com.nokia.singlesignon",
+                                       objectPath,
+                                       "com.nokia.singlesignon.SignonIdentity");
+
+    com_nokia_singlesignon_SignonIdentity_store_credentials (proxy,
+                                                             0,
+                                                             "James Bond",
+                                                             "007",
+                                                             1,
+                                                             hash_table,
+                                                             "caption",
+                                                             NULL,
+                                                             NULL,
+                                                             &id,
+                                                             &error);
+
+    if(error)
+    {
+        g_warning ("%s %d: %s", G_STRFUNC, __LINE__, error->message);
+        fail();
+    }
+
+    return id;
+
+}
+
+static gboolean
+identity_registered_cb (gpointer data)
+{
+    g_main_loop_quit (main_loop);
+    return FALSE;
+}
+
+START_TEST(test_get_existing_identity)
+{
+    g_type_init ();
+
+    guint id = new_identity();
+
+    fail_unless (id != 0);
+
+    identity = signon_identity_new_from_db(id);
+
+    fail_unless (identity != NULL);
+    fail_unless (SIGNON_IS_IDENTITY (identity),
+                 "Failed to initialize the Identity.");
+
+    g_timeout_add (1000, identity_registered_cb, identity);
+    main_loop = g_main_loop_new (NULL, FALSE);
+    g_main_loop_run (main_loop);
+
+    gchar *user_name;
+    user_name = signon_identity_get_username(identity);
+    fail_unless (strcmp (user_name, "James Bond") == 0);
+
+    g_free (user_name);
+    end_test ();
+}
+END_TEST
+
+START_TEST(test_get_nonexisting_identity)
+{
+    g_type_init ();
+
+    identity = signon_identity_new_from_db(65556546);
+
+    fail_unless (identity != NULL);
+    fail_unless (SIGNON_IS_IDENTITY (identity),
+                 "Failed to initialize the Identity.");
+
+    g_timeout_add (1000, identity_registered_cb, identity);
+    main_loop = g_main_loop_new (NULL, FALSE);
+    g_main_loop_run (main_loop);
+
+    GError *error = NULL;
+    error = signon_identity_get_last_error(identity);
+    fail_unless (error != NULL);
+
+    GQuark domain = error->domain;
+    const char *domain_name = g_quark_to_string (domain);
+
+    fail_unless (error->domain == SIGNON_ERROR);
+    fail_unless (error->code == SIGNON_ERROR_NOT_FOUND);
+
+    end_test ();
+}
+END_TEST
+
+Suite *
+signon_suite(void)
+{
+    Suite *s = suite_create ("signon-glib");
+
+    /* Core test case */
+    TCase * tc_core = tcase_create("Core");
+    tcase_set_timeout(tc_core, 10);
+    tcase_add_test (tc_core, test_init);
+    tcase_add_test (tc_core, test_query_methods);
+    tcase_add_test (tc_core, test_query_mechanisms);
+    tcase_add_test (tc_core, test_get_existing_identity);
+    tcase_add_test (tc_core, test_get_nonexisting_identity);
+
+    tcase_add_test (tc_core, test_auth_session_query_mechanisms);
+    tcase_add_test (tc_core, test_auth_session_query_mechanisms_nonexisting);
+    tcase_add_test (tc_core, test_auth_session_process);
+
+    suite_add_tcase (s, tc_core);
+
+    return s;
+}
+
+int main(void)
+{
+    int number_failed;
+    Suite * s = signon_suite();
+    SRunner * sr = srunner_create(s);
+
+    srunner_set_xml(sr, "/tmp/result.xml");
+    srunner_run_all(sr, CK_NORMAL);
+    number_failed = srunner_ntests_failed(sr);
+    srunner_free (sr);
+
+    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+/* vim: set ai et tw=75 ts=4 sw=4: */
+
diff --git a/tests/signon-glib-test.sh.in b/tests/signon-glib-test.sh.in
new file mode 100644 (file)
index 0000000..f9ce997
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+prefix=@prefix@
+datarootdir=@datarootdir@
+datadir=@datadir@
+
+signon-glib-testsuite
diff --git a/tests/tests.xml b/tests/tests.xml
new file mode 100644 (file)
index 0000000..9674dc4
--- /dev/null
@@ -0,0 +1,11 @@
+ <testdefinition version="0.1">
+     <suite name="libsignon-glib0-tests" domain="Accounts and SSO">
+         <set description="libsignon-glib0-tests:signon-glib-tests" name="/usr/bin/signon-glib-test.sh">
+              <case description="libsignon-glib-tests:signon-glib-test.sh" name="signon-glib-test.sh" type="Functional" level="Feature"> 
+                 <step>/usr/bin/signon-glib-test.sh</step>
+              </case>
+              <environments><scratchbox>true</scratchbox>
+              <hardware>true</hardware></environments>
+         </set>
+     </suite>
+</testdefinition>