ubuntuone-credentials-14.04+14.04.20140415/0000755000000000000000000000000012323300441014260 5ustar ubuntuone-credentials-14.04+14.04.20140415/COPYING0000644000000000000000000010451312323300075015322 0ustar GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, 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 them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ubuntuone-credentials-14.04+14.04.20140415/data/0000755000000000000000000000000012323300441015171 5ustar ubuntuone-credentials-14.04+14.04.20140415/data/ubuntuone.provider0000644000000000000000000000063612323300075021001 0ustar Ubuntu One ubuntuone ubuntuone ubuntuone-credentials true ubuntuone-credentials-14.04+14.04.20140415/data/ubuntuone.service-type0000644000000000000000000000036412323300075021564 0ustar Ubuntu One Integrate with Ubuntu One ubuntuone ubuntuone-credentials ubuntuone-credentials-14.04+14.04.20140415/data/ubuntuone.service0000644000000000000000000000027112323300075020602 0ustar ubuntuone Ubuntu One ubuntuone ubuntuone ubuntuone-credentials-14.04+14.04.20140415/data/CMakeLists.txt0000644000000000000000000000052712323300075017740 0ustar file (GLOB PROVIDER_FILES *.provider) file (GLOB SERVICE_FILES *.service) file (GLOB SERVICE_TYPE_FILES *.service-type) install (FILES ${PROVIDER_FILES} DESTINATION share/accounts/providers/) install (FILES ${SERVICE_FILES} DESTINATION share/accounts/services/) install (FILES ${SERVICE_TYPE_FILES} DESTINATION share/accounts/service_types/) ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/0000755000000000000000000000000012323300441017655 5ustar ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/token.cpp0000644000000000000000000001246612323300075021515 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include #include "token.h" #define TOKEN_NAME_KEY "name" #define TOKEN_TOKEN_KEY "token" #define TOKEN_TOKEN_SEC_KEY "token_secret" #define TOKEN_CONSUMER_KEY "consumer_key" #define TOKEN_CONSUMER_SEC_KEY "consumer_secret" namespace UbuntuOne { Token::Token(QString token_key, QString token_secret, QString consumer_key, QString consumer_secret) { _tokenHash[TOKEN_NAME_KEY] = buildTokenName(); _tokenHash[TOKEN_TOKEN_KEY] = token_key; _tokenHash[TOKEN_TOKEN_SEC_KEY] = token_secret; _tokenHash[TOKEN_CONSUMER_KEY] = consumer_key; _tokenHash[TOKEN_CONSUMER_SEC_KEY] = consumer_secret; } /** * \fn QString Token::toQuery() * * Turn a Token into a query string. **/ QString Token::toQuery() { QStringList secret; secret.prepend(QStringLiteral(TOKEN_NAME_KEY) + "=" + QUrl::toPercentEncoding(_tokenHash[TOKEN_NAME_KEY].replace(" ", "+"), "+", "@")); secret.prepend(QStringLiteral(TOKEN_TOKEN_KEY) + "=" + _tokenHash[TOKEN_TOKEN_KEY]); secret.prepend(QStringLiteral(TOKEN_TOKEN_SEC_KEY) + "=" + _tokenHash[TOKEN_TOKEN_SEC_KEY]); secret.prepend(QStringLiteral(TOKEN_CONSUMER_KEY) + "=" + _tokenHash[TOKEN_CONSUMER_KEY]); secret.prepend(QStringLiteral(TOKEN_CONSUMER_SEC_KEY) + "=" + _tokenHash[TOKEN_CONSUMER_SEC_KEY]); secret.sort(); return secret.join("&"); } /** * \fn bool Token::isValid() * * Check that the token is valid. **/ bool Token::isValid() const { return (_tokenHash.contains(TOKEN_NAME_KEY) && _tokenHash.contains(TOKEN_TOKEN_KEY) && _tokenHash.contains(TOKEN_TOKEN_SEC_KEY) && _tokenHash.contains(TOKEN_CONSUMER_KEY) && _tokenHash.contains(TOKEN_CONSUMER_SEC_KEY)); } /** * \fn QString Token::signUrl(const QString url, const QString method, * bool asQuery = false) * * Sign a URL with the token. */ QString Token::signUrl(const QString url, const QString method, bool asQuery) const { static const QString hdrPrefix("OAuth "); QString result; int argc = 0; char **argv = NULL; char *req_hdr = NULL; argc = oauth_split_url_parameters(url.toUtf8().data(), &argv); // Fixup the URL as liboauth is escaping '+' to ' ' in it, incorrectly. for (int a = 0; argv[0][a] != 0; a++) argv[0][a] = argv[0][a] == ' ' ? '+' : argv[0][a]; oauth_sign_array2_process(&argc, &argv, NULL, OA_HMAC, method.toUtf8().data(), _tokenHash[TOKEN_CONSUMER_KEY].toUtf8().data(), _tokenHash[TOKEN_CONSUMER_SEC_KEY].toUtf8().data(), _tokenHash[TOKEN_TOKEN_KEY].toUtf8().data(), _tokenHash[TOKEN_TOKEN_SEC_KEY].toUtf8().data()); if (asQuery) result = oauth_serialize_url_parameters(argc, argv); else{ req_hdr = oauth_serialize_url_sep(argc, 1, argv, (char *)", ", 6); result = hdrPrefix + QString(req_hdr); } oauth_free_array(&argc, &argv); free(req_hdr); return result; } /** * \fn Token Token::fromQuery(const QString query) * * Turn a query string for a token, into a Token object. **/ Token *Token::fromQuery(const QString query) { Token *token = new Token(); QStringList params = query.split("&"); for (int i = 0; i < params.size(); ++i) { QStringList pair = params.at(i).split("="); if (pair.at(0) == TOKEN_NAME_KEY) { // TODO: Need to figure out how to actually use the // QUrl::fromPercentEncoding at this point in the code. QString value = pair.at(1); token->_tokenHash[pair.at(0)] = QString(value.replace("+", " ").replace("%40", "@")); } else token->_tokenHash[pair.at(0)] = pair.at(1); } return token; } /** * \fn QString Token::buildTokenName() * * Compute the token name for the token, from the hostname. **/ QString Token::buildTokenName() { QString computer_name = QHostInfo::localHostName(); computer_name.replace(TOKEN_SEP, TOKEN_SEP_REPLACEMENT); return QStringLiteral(TOKEN_ID) + QStringLiteral(TOKEN_SEP) + computer_name; } } // namespace UbuntuOne ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/identityprovider.h0000644000000000000000000000345012323300075023437 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _IDENTITYPROVIDER_H_ #define _IDENTITYPROVIDER_H_ #include "network.h" #include "requests.h" #include "responses.h" #include namespace UbuntuOne { class IdentityProvider : public QObject { Q_OBJECT public: explicit IdentityProvider(QObject *parent = 0); void GetOAuthToken(const OAuthTokenRequest& token); void GetPasswordToken(const PasswordTokenRequest& token); void CreateAccount(const AccountRequest& account); signals: void OAuthTokenGranted(const OAuthTokenResponse& token); void PasswordTokenGranted(const PasswordTokenResponse& token); void AccountGranted(const AccountResponse& account); void ErrorOccurred(const ErrorResponse& error); void TwoFactorAuthRequired(); public slots: void OnOAuthTokenGranted(const OAuthTokenResponse& token); void OnPasswordTokenGranted(const PasswordTokenResponse& token); void OnAccountGranted(const AccountResponse& account); void OnErrorOccurred(const ErrorResponse& error); private slots: private: Network* network; }; } /* end UbuntuOne namespace */ #endif // _IDENTITYPROVIDER_H_ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/keyring.cpp0000644000000000000000000001652212323300104022033 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include #include "keyring.h" using namespace Accounts; using namespace SignOn; namespace UbuntuOne { Keyring::Keyring(QObject *parent) : QObject(parent), _manager() { } void Keyring::handleError(const SignOn::Error &error) { qCritical() << "Error:" << error.message(); emit keyringError(error.message()); } void Keyring::handleSessionData(const SignOn::SessionData &data) { QString secret = data.Secret(); if (secret.length() == 0) { QString msg("Could not read credentials secret value."); qCritical() << msg; emit keyringError(msg); return; } Token *token = Token::fromQuery(secret); if (token->isValid()) { emit tokenFound(*token); } else { QString message("Failed to convert result to Token object."); qCritical() << message; emit keyringError(message); } delete token; } void Keyring::findToken() { QString _acctName("ubuntuone"); AccountIdList _ids = _manager.accountList(_acctName); Identity *identity; Account *account; if (_ids.length() > 0) { if (_ids.length() > 1) { qDebug() << "findToken(): Found '" << _ids.length() << "' accounts. Using first."; } account = _manager.account(_ids[0]); qDebug() << "findToken(): Using Ubuntu One account '" << _ids[0] << "'."; identity = Identity::existingIdentity(account->credentialsId()); if (identity == NULL) { qCritical() << "findToken(): disabled account " << _acctName << _ids[0]; emit tokenNotFound(); return; } AuthSession *session = identity->createSession(QStringLiteral("password")); if (session != NULL) { connect(session, SIGNAL(response(const SignOn::SessionData&)), this, SLOT(handleSessionData(const SignOn::SessionData&))); connect(session, SIGNAL(error(const SignOn::Error&)), this, SLOT(handleError(const SignOn::Error&))); session->process(SessionData(), QStringLiteral("password")); return; } qCritical() << "Unable to create AuthSession."; } qDebug() << "findToken(): No accounts found matching " << _acctName; emit tokenNotFound(); } void Keyring::handleCredentialsStored(const quint32 id) { QString _acctName("ubuntuone"); AccountIdList _ids = _manager.accountList(_acctName); Account *account; if (_ids.length() > 0) { if (_ids.length() > 1) { qDebug() << "handleCredentialsStored(): Found '" << _ids.length() << "' accounts. Using first."; } account = _manager.account(_ids[0]); qDebug() << "handleCredentialsStored(): Using Ubuntu One account '" << _ids[0] << "'."; account->selectService(); account->setCredentialsId(id); ServiceList services = account->services(_acctName); if (services.length() > 0) { account->selectService(services[0]); } else { QString errMsg("Unable to enable 'ubuntuone' service."); emit keyringError(errMsg); } account->setEnabled(true); account->sync(); emit tokenStored(); return; } emit keyringError(QStringLiteral("Could not sync credentials ID.")); } void Keyring::storeToken(Token token) { QString _acctName("ubuntuone"); AccountIdList _ids = _manager.accountList(_acctName); Identity *identity = NULL; Account *account = NULL; if (_ids.length() > 0) { if (_ids.length() > 1) { qDebug() << "storeToken(): Found '" << _ids.length() << "' accounts. Using first."; } account = _manager.account(_ids[0]); qDebug() << "storeToken(): Using Ubuntu One account '" << _ids[0] << "'."; } else { qDebug() << "in storeToken(): no accounts found in accountList, creating new"; account = _manager.createAccount(_acctName); ServiceList services = account->services(_acctName); if (services.length() > 0) { account->selectService(services[0]); } else { QString errMsg("Unable to enable 'ubuntuone' service."); emit keyringError(errMsg); } account->setEnabled(true); account->sync(); } if(account->credentialsId() == 0){ qDebug() << "storeToken() : creating new Identity for account " << account->id() ; identity = Identity::newIdentity(); }else{ qDebug() << "storeToken(): identity found."; identity = Identity::existingIdentity(account->credentialsId()); } Q_ASSERT(identity != NULL); connect(identity, SIGNAL(error(const SignOn::Error&)), this, SLOT(handleError(const SignOn::Error&))); connect(identity, SIGNAL(credentialsStored(const quint32)), this, SLOT(handleCredentialsStored(const quint32))); IdentityInfo info = IdentityInfo(); info.setSecret(token.toQuery(), true); identity->storeCredentials(info); } void Keyring::handleAccountRemoved() { emit tokenDeleted(); } void Keyring::deleteToken() { QString _acctName("ubuntuone"); AccountIdList _ids = _manager.accountList(_acctName); if (_ids.length() > 0) { if (_ids.length() > 1) { qDebug() << "deleteToken(): Found '" << _ids.length() << "' accounts. Using first."; } Account *account = _manager.account(_ids[0]); qDebug() << "deleteToken(): Using Ubuntu One account '" << _ids[0] << "'."; Identity *identity = Identity::existingIdentity(account->credentialsId()); connect(account, SIGNAL(removed()), this, SLOT(handleAccountRemoved())); connect(identity, SIGNAL(error(const SignOn::Error&)), this, SLOT(handleError(const SignOn::Error&))); identity->remove(); account->remove(); account->sync(); return; } emit tokenNotFound(); } } // namespace UbuntuOne ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/requests.cpp0000644000000000000000000001021512323300075022236 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include "requests.h" #include #include namespace UbuntuOne { RequestInterface::RequestInterface(const QUrl& url) : _url(url) { } OAuthTokenRequest::OAuthTokenRequest() : RequestInterface(OAUTH_API), _email(""), _password(""), _name(""), _otp("") { } OAuthTokenRequest::OAuthTokenRequest(QString email, QString password, QString name, QString otp) : RequestInterface(OAUTH_API), _email(email), _password(password), _name(name), _otp(otp) { } OAuthTokenRequest::OAuthTokenRequest(QString base_url, QString email, QString password, QString name, QString otp) : RequestInterface(base_url + OAUTH_PATH), _email(email), _password(password), _name(name), _otp(otp) { } QByteArray OAuthTokenRequest::serialize() const { QJsonObject serializer; serializer.insert("email", email()); serializer.insert("password", password()); serializer.insert("token_name", name()); if (!otp().isEmpty()) serializer.insert("otp", otp()); QJsonDocument doc(serializer); return doc.toJson(); } AccountRequest::AccountRequest() : RequestInterface(ACCOUNTS_API), _email(""), _password(""), _name(""), _captchaId(""), _captchaSolution(""), _createCaptcha(true) { } AccountRequest::AccountRequest(QString email, QString password, QString name, QString captchaId, QString captchaSolution, bool createCaptcha) : RequestInterface(ACCOUNTS_API), _email(email), _password(password), _name(name), _captchaId(captchaId), _captchaSolution(captchaSolution), _createCaptcha(createCaptcha) { } AccountRequest::AccountRequest(QString base_url, QString email, QString password, QString name, QString captchaId, QString captchaSolution, bool createCaptcha) : RequestInterface(base_url + ACCOUNTS_PATH), _email(email), _password(password), _name(name), _captchaId(captchaId), _captchaSolution(captchaSolution), _createCaptcha(createCaptcha) { } AccountRequest::AccountRequest(QString base_url, QString email, QString password, QString name) : RequestInterface(base_url + ACCOUNTS_PATH), _email(email), _password(password), _name(name), _captchaId(QString()), _captchaSolution(QString()), _createCaptcha(false) { } QByteArray AccountRequest::serialize() const { QJsonObject data; data.insert("email", email()); data.insert("password", password()); data.insert("displayname", name()); data.insert("captcha_id", captchaId()); data.insert("captcha_solution", captchaSolution()); data.insert("create_captcha", createCaptcha()); QJsonDocument doc(data); return doc.toJson(); } PasswordTokenRequest::PasswordTokenRequest() : RequestInterface(PASSWORD_API), _email("") { } PasswordTokenRequest::PasswordTokenRequest(QString email) : RequestInterface(PASSWORD_API), _email(email) { } PasswordTokenRequest::PasswordTokenRequest(QString base_url, QString email) : RequestInterface(base_url + PASSWORD_PATH), _email(email) { } QByteArray PasswordTokenRequest::serialize() const { QJsonObject data; data.insert("email", email()); QJsonDocument doc(data); return doc.toJson(); } } /* end UbuntuOne namespace */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/examples/0000755000000000000000000000000012323300441021473 5ustar ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/examples/signing-main.cpp0000644000000000000000000000723012323300075024564 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * You must obey the GNU General Public License in all respects * for all of the code used other than OpenSSL. If you modify * file(s) with this exception, you may extend this exception to your * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source * files in the program, then also delete it here. */ #include #include #include #include #include #include "ssoservice.h" #include "token.h" #include "signing.h" namespace UbuntuOne { SigningExample::SigningExample(QObject *parent) : QObject(parent) { QObject::connect(&service, SIGNAL(credentialsFound(const Token&)), this, SLOT(handleCredentialsFound(Token))); QObject::connect(&service, SIGNAL(credentialsNotFound()), this, SLOT(handleCredentialsNotFound())); QObject::connect(&nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleNetworkFinished(QNetworkReply*))); } SigningExample::~SigningExample(){ } void SigningExample::doExample() { service.getCredentials(); } void SigningExample::handleCredentialsFound(Token token) { qDebug() << "Credentials found, signing url."; QString url = "https://one.ubuntu.com/api/account/"; QString authHeader = token.signUrl(url, QStringLiteral("GET")); qDebug() << "URL Signed, authHeader is:" << authHeader; QNetworkRequest req; req.setRawHeader(QStringLiteral("Authorization").toUtf8(), authHeader.toUtf8()); req.setUrl(url); nam.get(req); } void SigningExample::handleCredentialsNotFound() { qDebug() << "No credentials were found."; } void SigningExample::handleNetworkFinished(QNetworkReply *reply) { QVariant statusAttr = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); if(!statusAttr.isValid()) { qDebug() << "Invalid HTTP response."; return; } int status = statusAttr.toInt(); qDebug() << "HTTP Status " << status; if (status != 200){ qDebug() << reply->rawHeaderPairs(); } qDebug() << reply->readAll(); emit finished(); } } // namespace UbuntuOne int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); UbuntuOne::SigningExample *example = new UbuntuOne::SigningExample(&a); QObject::connect(example, SIGNAL(finished()), &a, SLOT(quit())); QTimer::singleShot(0, example, SLOT(doExample())); return a.exec(); } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/examples/README0000644000000000000000000000222712323300075022361 0ustar libubuntuoneauth/examples This directory contains example code for accessing a user's ubuntuone credentials and signing URLs using them in Qt/C++ code. The basic flow is to use an SSOService object to get the credentials, by calling getCredentials. It will respond with either credentialsNotFound or credentialsFound. The credentialsFound signal has a Token object that has a signURL method that takes a URL and HTTP scheme, and returns a properly signed OAuth header string. This string can then be used with the usual Qt network stack. The file signing-main.cpp has a minimal Qt application that attempts to get credentials from the online accounts DB and use them to sign a request for account info from the one.ubuntu.com account API. Run it with U1_DEBUG=1 in the environment to see the output. If you have valid credentials, it will print a bunch of progress info followed by a JSON dict with some account info. If you don't have valid credentials, it will simply mention that. To get valid credentials for testing, use the Online Accounts panel in System Settings to create an account. You will need to have the plug-in installed, to be able to add an account. ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/examples/signing.h0000644000000000000000000000405612323300075023312 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * You must obey the GNU General Public License in all respects * for all of the code used other than OpenSSL. If you modify * file(s) with this exception, you may extend this exception to your * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source * files in the program, then also delete it here. */ #ifndef _SIGNING_H_ #define _SIGNING_H_ #include #include #include #include #include "ssoservice.h" #include "token.h" #include "requests.h" #include "errormessages.h" namespace UbuntuOne { class SigningExample : public QObject { Q_OBJECT public: explicit SigningExample(QObject *parent = 0); ~SigningExample(); public slots: void doExample(); signals: void finished(); private slots: void handleCredentialsFound(Token token); void handleCredentialsNotFound(); void handleNetworkFinished(QNetworkReply *reply); private: SSOService service; QNetworkAccessManager nam; }; } #endif /* _SIGNING_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/examples/CMakeLists.txt0000644000000000000000000000162312323300075024240 0ustar SET (EXAMPLES_TARGET ubuntuoneauth-examples) SET (SIGNING_EXE "signing-example") # Qt5 bits SET (CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) FILE (GLOB SIGNING_SOURCES signing*.cpp) FILE (GLOB SIGNING_HEADERS signing*.h) add_executable (${SIGNING_EXE} ${SIGNING_SOURCES} ${SIGNING_HEADERS}) qt5_use_modules (${SIGNING_EXE} DBus Network) target_link_libraries (${SIGNING_EXE} -Wl,-rpath,${CMAKE_BINARY_DIR}/libubuntuoneauth -L${CMAKE_BINARY_DIR}/libubuntuoneauth ${AUTH_LIB_NAME}) add_custom_target(examples-valgrind COMMAND "valgrind --tool=memcheck ${CMAKE_CURRENT_BINARY_DIR}/${SIGNING_EXE}" DEPENDS ${SIGNING_EXE} ) add_custom_target(examples-valgrind-leaks COMMAND "valgrind --tool=memcheck --track-origins=yes --num-callers=40 --leak-resolution=high --leak-check=full ${CMAKE_CURRENT_BINARY_DIR}/${SIGNING_EXE}" DEPENDS ${SIGNING_EXE} ) ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/ubuntuoneauth.pc.in0000644000000000000000000000051312323300075023516 0ustar prefix=@PREFIX@ exec_prefix=${prefix} libdir=${exec_prefix}/@LIBDIR@ includedir=${prefix}/include Name: @LIB_NAME@ Description: Client library for Ubuntu One authentication. Version: @VERSION@ Libs: -L${libdir} -l@LIB_NAME@ Requires: Qt5Core Qt5DBus Qt5Xml Qt5Network libsignon-qt5 accounts-qt5 Cflags: -I${includedir}/@LIB_NAME@ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/token.h0000644000000000000000000000265512323300075021161 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _U1_TOKEN_H_ #define _U1_TOKEN_H_ #include #include namespace UbuntuOne { #define TOKEN_ID "Ubuntu One" #define TOKEN_SEP " @ " #define TOKEN_SEP_REPLACEMENT " AT " class Token { public: Token() {}; Token(QString token_key, QString token_secret, QString consumer_key, QString consumer_secret); QString toQuery(); bool isValid() const; QString signUrl(const QString url, const QString method, bool asQuery = false) const; static Token *fromQuery(const QString query); static QString buildTokenName(); private: QHash _tokenHash; }; } /* namespace UbuntuOne */ #endif /* _U1_TOKEN_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/libubuntuoneauth.symbols0000644000000000000000000000013012323300075024661 0ustar { global: extern "C++" { *UbuntuOne::*; }; qt_*; local: *; }; ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/ssoservice.cpp0000644000000000000000000001510512323300075022553 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include "logging.h" #include "ssoservice.h" #include "requests.h" #include "errormessages.h" namespace UbuntuOne { static Token _pendingPing; SSOService::SSOService(QObject *parent) : QObject(parent) { // Set up logging AuthLogger::setupLogging(); #if ENABLE_DEBUG AuthLogger::setLogLevel(QtDebugMsg); #else if (qgetenv("U1_DEBUG") != "") AuthLogger::setLogLevel(QtDebugMsg); #endif // create the keyring that will be used to store and retrieve the different tokens _keyring = new Keyring(this); _nam = new QNetworkAccessManager(this); connect(_keyring, SIGNAL(tokenFound(const Token&)), this, SLOT(handleCredentialsFound(const Token&))); connect(_keyring, SIGNAL(tokenNotFound()), this, SLOT(handleCredentialsNotFound())); connect(_keyring, SIGNAL(tokenStored()), this, SLOT(handleTokenStored())); connect(_keyring, SIGNAL(tokenDeleted()), this, SLOT(handleTokenDeleted())); connect(_nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(accountPinged(QNetworkReply*))); connect(&(_provider), SIGNAL(OAuthTokenGranted(const OAuthTokenResponse&)), this, SLOT(tokenReceived(const OAuthTokenResponse&))); connect(&(_provider), SIGNAL(AccountGranted(const AccountResponse&)), this, SLOT(accountRegistered(const AccountResponse&))); connect(&(_provider), SIGNAL(TwoFactorAuthRequired()), this, SLOT(handleTwoFactorAuthRequired())); connect(&(_provider), SIGNAL(ErrorOccurred(const ErrorResponse&)), this, SLOT(errorOccurred(const ErrorResponse&))); } void SSOService::getCredentials() { _keyring->findToken(); } void SSOService::handleCredentialsNotFound() { emit credentialsNotFound(); } void SSOService::handleCredentialsFound(const Token& token) { emit credentialsFound(token); } void SSOService::handleTokenStored() { emit credentialsStored(); _pendingPing = Token(); } void SSOService::registerUser(QString email, QString password, QString display_name) { AccountRequest request(getAuthBaseUrl(), email, password, display_name); _tempPassword = password; _tempEmail = email; _provider.CreateAccount(request); } void SSOService::accountRegistered(const AccountResponse& account) { login(_tempEmail, _tempPassword); _tempPassword = ""; } void SSOService::login(QString email, QString password, QString twoFactorCode) { OAuthTokenRequest request(getAuthBaseUrl(), email, password, Token::buildTokenName(), twoFactorCode); _tempEmail = email; _provider.GetOAuthToken(request); } void SSOService::handleTwoFactorAuthRequired() { emit twoFactorAuthRequired(); } static QString _getPlatformDataParams() { struct utsname _platData; uname(&_platData); QUrlQuery *params = new QUrlQuery(); params->addQueryItem("platform", _platData.sysname); params->addQueryItem("platform_version", _platData.release); params->addQueryItem("platform_arch", _platData.machine); params->addQueryItem("client_version", PROJECT_VERSION); QString result = params->toString(); return result; } QString SSOService::getAuthBaseUrl() { QString baseUrl = qgetenv("SSO_AUTH_BASE_URL"); if (baseUrl.isEmpty()) baseUrl = QStringLiteral("https://login.ubuntu.com"); return baseUrl; } QString SSOService::getUOneBaseUrl() { QString baseUrl = qgetenv("SSO_UONE_BASE_URL"); if (baseUrl.isEmpty()) baseUrl = QStringLiteral("https://one.ubuntu.com"); return baseUrl; } void SSOService::tokenReceived(const OAuthTokenResponse& token) { Token realToken = Token(token.token_key(), token.token_secret(), token.consumer_key(), token.consumer_secret()); QString urlToSign = getUOneBaseUrl() + "/oauth/sso-finished-so-get-tokens/" + _tempEmail + "?" + _getPlatformDataParams(); QString authHeader = realToken.signUrl(urlToSign, QStringLiteral("GET")); QNetworkRequest *_request = new QNetworkRequest(); _request->setRawHeader(QStringLiteral("Authorization").toUtf8(), authHeader.toUtf8()); _request->setUrl(urlToSign); _nam->get(*_request); _tempEmail = ""; _pendingPing = realToken; } void SSOService::accountPinged(QNetworkReply* reply) { QVariant statusAttr = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); int httpStatus = statusAttr.toInt(); if (reply->error() != QNetworkReply::NoError) { QVariant phraseAttr = reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute); QString reason = phraseAttr.toString(); qCritical() << "Ping to Ubuntu One failed:" << httpStatus << reason << reply->error(); ErrorResponse error(httpStatus, reason, "", ""); emit requestFailed(error); } else _keyring->storeToken(_pendingPing); reply->deleteLater(); } void SSOService::invalidateCredentials() { _keyring->deleteToken(); } void SSOService::errorOccurred(const ErrorResponse& error) { _tempPassword = ""; emit requestFailed(error); } } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/logging.h0000644000000000000000000000340212323300075021456 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _U1_AUTH_LOGGING_H_ #define _U1_AUTH_LOGGING_H_ #include #include #include #include #include namespace UbuntuOne { class AuthLogger : public QObject { Q_OBJECT public: QtMsgType _logLevel = QtWarningMsg; explicit AuthLogger(QObject *parent = 0); Q_DECL_DEPRECATED AuthLogger(const QString filename); void logMessage(QtMsgType type, const QMessageLogContext &context, const QString &message); static void setupLogging(); static void stopLogging(); Q_DECL_DEPRECATED static void setupLogging(const QString filename); static bool setLogLevel(QtMsgType level); static const QString getMessageTypeString(QtMsgType type); Q_DECL_DEPRECATED static QString getLogDirectory(); private: bool _initialized = false; QTextStream _logStream; const QString _datetimeFormat = "yyyy-MM-dd hh:mm:ss,zzz"; }; } /* namespace UbuntuOne */ #endif /* _U1_AUTH_LOGGING_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/ssoservice.h0000644000000000000000000000463512323300075022226 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef SSOSERVICE_H #define SSOSERVICE_H #include #include #include #include #include "keyring.h" #include "token.h" #include "identityprovider.h" #include "responses.h" namespace UbuntuOne { class SSOService : public QObject { Q_OBJECT public: explicit SSOService(QObject *parent = 0); void invalidateCredentials(); void getCredentials(); void login(QString email, QString password, QString twoFactorCode = QString()); void registerUser(QString email, QString password, QString display_name); static QString getAuthBaseUrl(); static QString getUOneBaseUrl(); signals: void credentialsDeleted(); void credentialsStored(); void credentialsFound(const Token& token); void credentialsNotFound(); void requestFailed(const ErrorResponse& error); void twoFactorAuthRequired(); private slots: void accountPinged(QNetworkReply*); void handleTokenStored(); void handleTokenDeleted() { emit credentialsDeleted(); }; void handleCredentialsFound(const Token& token); void handleCredentialsNotFound(); void tokenReceived(const OAuthTokenResponse& token); void accountRegistered(const AccountResponse& account); void errorOccurred(const ErrorResponse&); void handleTwoFactorAuthRequired(); private: Keyring *_keyring; QString _tempPassword; QString _tempEmail; IdentityProvider _provider; QNetworkAccessManager *_nam; }; } #endif // SSOSERVICE_H ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/network.cpp0000644000000000000000000001626112323300075022063 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include #include #include #include "errormessages.h" #include "network.h" #include "responses.h" #include "requests.h" namespace UbuntuOne { Network::Network(QObject *parent) : QObject(parent) { /* either shared pointer or delete this */ _nam = new QNetworkAccessManager(this); _request = new QNetworkRequest(); _request->setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QObject::connect(_nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(OnReply(QNetworkReply*))); } void Network::OnReply(QNetworkReply* reply) { QVariant statusAttr = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute); /* TODO: see if we really need to do this check, we could just operate on a bad value as being an error rather than the extra check? */ if (!statusAttr.isValid()) { QString errmsg = QString("Invalid status attribute in Network::OnReply"); // Use login failed code, which results in generic error message: emit ErrorOccurred(ErrorResponse(0, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } int httpStatus = statusAttr.toInt(); qDebug() << "Network::OnReply from " << reply->url() << " status: " << httpStatus; QByteArray payload = reply->readAll(); if (payload.isEmpty()) { QString errmsg = QString("Network::OnReply: empty payload, giving up."); emit ErrorOccurred(ErrorResponse(0, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } QJsonParseError jsonParseError; QJsonDocument document = QJsonDocument::fromJson(payload, &jsonParseError); if(jsonParseError.error != QJsonParseError::NoError){ QString errmsg = QString ("Network::OnReply: error parsing JSON reply: "); errmsg += jsonParseError.errorString(); emit ErrorOccurred(ErrorResponse(0, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } if (document.isEmpty() || document.isNull()) { QString errmsg = QString("Network::OnReply: received empty or Null document"); emit ErrorOccurred(ErrorResponse(0, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } if (!document.isObject()) { QString errmsg = QString("Network::OnReply: received JSON document that isn't an object."); emit ErrorOccurred(ErrorResponse(0, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } QJsonObject object = document.object(); /* TODO: map out urls to reply parsers */ if (httpStatus == 200 || httpStatus == 201) { if (reply->url().path() == OAUTH_PATH) ProcessOAuthTokenReply(object); else if (reply->url().path() == PASSWORD_PATH) ProcessPasswordTokenReply(object); else if (reply->url().path() == ACCOUNTS_PATH) ProcessAccountsReply(object); } else /* Statuses outside 200, 201 are fails */ { QVariant phraseAttr = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute); if (!phraseAttr.isValid()) { QString errmsg = QString("HTTP reason phrase is invalid"); emit ErrorOccurred(ErrorResponse(httpStatus, NO_HTTP_REASON, LOGIN_FAILED, errmsg)); return; } QString httpReason = phraseAttr.toString(); QString code = object.value("code").toString(); QString message = object.value("message").toString(); QJsonValue extra = object.value("extra"); /* TODO: fill in details for each type of status */ ErrorResponse error(httpStatus, httpReason, code, message); /* Some statuses provide extra information! */ switch (httpStatus) { case 401: if (extra.isObject()) { QJsonObject ob = extra.toObject(); QString url = ob.value("image_url").toString(); QString id = ob.value("captcha_id").toString(); error.imageUrl(url); error.captchaId(id); } break; case 403: if (extra.isObject()) { QJsonObject ob = extra.toObject(); QString msg = ob.value("captcha_message").toString(); error.captchaMessage(msg); } break; case 409: if (extra.isObject()) { QJsonObject ob = extra.toObject(); QString email = ob.value("email").toString(); error.email(email); } break; } emit ErrorOccurred(error); return; } } void Network::ProcessAccountsReply(const QJsonObject& object) { AccountResponse response; response.status(object.value("status").toString()); response.openid(object.value("openid").toString()); response.displayname(object.value("displayname").toString()); response.email(object.value("email").toString()); response.href(object.value("href").toString()); QJsonValue emails = object.value("emails"); QStringList list; if (emails.isArray()) { QJsonArray array = emails.toArray(); foreach(const QJsonValue& val, array) { if (val.isObject()) { /* TODO: this is dirty... */ list.append(val.toObject().value("href").toString()); } } } response.emails(list); emit AccountGranted(response); } void Network::ProcessPasswordTokenReply(const QJsonObject& object) { PasswordTokenResponse response; response.email(object.value("email").toString()); emit PasswordTokenGranted(response); } void Network::ProcessOAuthTokenReply(const QJsonObject& object) { /* TODO: may be able to speed this up by working with a map internal to the QJsonDocument, or something like that.*/ OAuthTokenResponse response; response.token_name(object.value("token_name").toString()); response.token_secret(object.value("token_secret").toString()); response.token_key(object.value("token_key").toString()); response.date_created(object.value("date_created").toString()); response.date_updated(object.value("date_updated").toString()); response.consumer_secret(object.value("consumer_secret").toString()); response.consumer_key(object.value("consumer_key").toString()); response.href(object.value("href").toString()); emit OAuthTokenGranted(response); } } /* end UbuntuOne namespace */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/logging.cpp0000644000000000000000000000707212323300075022020 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "logging.h" namespace UbuntuOne { static void *_logger = NULL; static void _realMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &message) { if (_logger == NULL) return; ((AuthLogger *)_logger)->logMessage(type, context, message); } AuthLogger::AuthLogger (QObject *parent) : QObject(parent) { qInstallMessageHandler(_realMessageHandler); _initialized = true; } AuthLogger::AuthLogger (const QString filename) { qInstallMessageHandler(_realMessageHandler); _initialized = true; } void AuthLogger::setupLogging() { if (_logger == NULL) _logger = new AuthLogger(); } void AuthLogger::setupLogging(const QString filename) { setupLogging(); } void AuthLogger::stopLogging() { if (_logger != NULL) { delete (AuthLogger *)_logger; _logger = NULL; } } bool AuthLogger::setLogLevel(QtMsgType level) { if (_logger != NULL) { ((AuthLogger *)_logger)->_logLevel = level; return true; } return false; } const QString AuthLogger::getMessageTypeString(QtMsgType type) { switch (type) { case QtDebugMsg: return QStringLiteral("DEBUG"); break; case QtWarningMsg: return QStringLiteral("WARNING"); break; case QtCriticalMsg: return QStringLiteral("CRITICAL"); break; case QtFatalMsg: return QStringLiteral("FATAL"); break; } return QStringLiteral("UNKNOWN"); } QString AuthLogger::getLogDirectory() { QString cachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation); QString logPath = cachePath + "/ubuntuone/log"; QDir cacheDir = QDir(logPath); if (!cacheDir.exists(logPath)) cacheDir.mkpath(logPath); return logPath; } void AuthLogger::logMessage(QtMsgType type, const QMessageLogContext &context, const QString &message) { if (type < _logLevel) return; QString logMessage; QTextStream _logMessage(&logMessage); _logMessage << QDateTime::currentDateTime().toString(_datetimeFormat).toUtf8().data() << " - " << getMessageTypeString(type).toUtf8().data() << " - " << message.toUtf8().data() << "\n"; QTextStream _stdErr(stderr, QIODevice::WriteOnly); _stdErr << logMessage; _stdErr.device()->close(); if (type == QtFatalMsg) abort(); } } // namespace UbuntuOne ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/0000755000000000000000000000000012323300441021017 5ustar ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/main.cpp0000644000000000000000000000426012323300075022454 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include "test_logging.h" #include "test_keyring.h" #include "test_token.h" #include "test_requests.h" #include "test_responses.h" int main() { QByteArray fake_home = QDir::currentPath().toUtf8() + "/_test_temp"; /* Need to alter some environment variables to avoid contamination. */ qputenv("HOME", fake_home); qputenv("XDG_CACHE_HOME", fake_home); qputenv("XDG_DATA_HOME", fake_home); /* Logging tests */ TestAuthLogger test_auth_logger; /* Keyring tests */ TestKeyring test_keyring; /* Token tests */ TestToken test_token; /* Request tests */ TestOAuthTokenRequests test_oauth_token_requests; TestPasswordTokenRequests test_password_token_requests; TestAccountRequests test_account_requests; /* Response tests */ TestErrorResponses test_error_responses; TestOAuthTokenResponses test_oauth_token_responses; TestPasswordTokenResponses test_password_token_responses; int result = 0; result += QTest::qExec(&test_auth_logger); result += QTest::qExec(&test_keyring); result += QTest::qExec(&test_token); result += QTest::qExec(&test_oauth_token_requests); result += QTest::qExec(&test_password_token_requests); result += QTest::qExec(&test_account_requests); result += QTest::qExec(&test_error_responses); result += QTest::qExec(&test_oauth_token_responses); result += QTest::qExec(&test_password_token_responses); return result; } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_requests.h0000644000000000000000000000303212323300075024103 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _TEST_REQUESTS_H_ #define _TEST_REQUESTS_H_ #include class TestOAuthTokenRequests : public QObject { Q_OBJECT public: TestOAuthTokenRequests(); private: QString test_email, test_password, test_name, test_otp; private slots: void testDefaults(); void testValues(); }; class TestAccountRequests : public QObject { Q_OBJECT public: TestAccountRequests(); private: QString test_email, test_password, test_name, test_captchaId, test_captchaSolution, test_createCaptcha; private slots: void testDefaults(); void testValues(); }; class TestPasswordTokenRequests : public QObject { Q_OBJECT public: TestPasswordTokenRequests(); private: QString test_email; private slots: void testDefaults(); void testValues(); }; #endif /* _TEST_REQUESTS_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_logging.cpp0000644000000000000000000000322212323300075024212 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "test_logging.h" using namespace UbuntuOne; TestAuthLogger::TestAuthLogger(QObject *parent) : QObject(parent) { } void TestAuthLogger::testMessageTypeString() { QCOMPARE(AuthLogger::getMessageTypeString(QtDebugMsg), QStringLiteral("DEBUG")); QCOMPARE(AuthLogger::getMessageTypeString(QtWarningMsg), QStringLiteral("WARNING")); QCOMPARE(AuthLogger::getMessageTypeString(QtCriticalMsg), QStringLiteral("CRITICAL")); QCOMPARE(AuthLogger::getMessageTypeString(QtFatalMsg), QStringLiteral("FATAL")); QCOMPARE(AuthLogger::getMessageTypeString(QtSystemMsg), QStringLiteral("CRITICAL")); } void TestAuthLogger::testLogLevel() { QCOMPARE(AuthLogger::setLogLevel(QtDebugMsg), false); AuthLogger::setupLogging(); QCOMPARE(AuthLogger::setLogLevel(QtDebugMsg), true); AuthLogger::stopLogging(); } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_keyring.h0000644000000000000000000000201412323300075023677 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _TEST_KEYRING_H_ #define _TEST_KEYRING_H_ #include class TestKeyring: public QObject { Q_OBJECT public: TestKeyring(); private: bool _foundToken; private slots: void testFindToken(); void testStoreToken(); void testDeleteToken(); }; #endif /* _TEST_KEYRING_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_keyring.cpp0000644000000000000000000000214112323300075024233 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "test_keyring.h" TestKeyring::TestKeyring() { } void TestKeyring::testFindToken() { // Need to figure out how to fake the keyring/dbus } void TestKeyring::testStoreToken() { // Need to figure out how to fake the keyring/dbus } void TestKeyring::testDeleteToken() { // Need to figure out how to fake the keyring/dbus } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_requests.cpp0000644000000000000000000000650612323300075024447 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include "test_requests.h" #include "requests.h" using namespace UbuntuOne; TestOAuthTokenRequests::TestOAuthTokenRequests() : test_email(QUuid::createUuid().toString()), test_password(QUuid::createUuid().toString()), test_name(QUuid::createUuid().toString()), test_otp(QUuid::createUuid().toString()) { } void TestOAuthTokenRequests::testDefaults() { OAuthTokenRequest request; QString empty(""); QCOMPARE(request.email(), empty); QCOMPARE(request.password(), empty); QCOMPARE(request.name(), empty); QCOMPARE(request.otp(), empty); } void TestOAuthTokenRequests::testValues() { OAuthTokenRequest request; request.email(test_email); request.password(test_password); request.name(test_name); request.otp(test_otp); QCOMPARE(request.email(), test_email); QCOMPARE(request.password(), test_password); QCOMPARE(request.name(), test_name); QCOMPARE(request.otp(), test_otp); } TestAccountRequests::TestAccountRequests() : test_email(QUuid::createUuid().toString()), test_password(QUuid::createUuid().toString()), test_name(QUuid::createUuid().toString()), test_captchaId(QUuid::createUuid().toString()), test_captchaSolution(QUuid::createUuid().toString()) { } void TestAccountRequests::testDefaults() { AccountRequest request; QString empty(""); QCOMPARE(request.email(), empty); QCOMPARE(request.password(), empty); QCOMPARE(request.name(), empty); QCOMPARE(request.captchaId(), empty); QCOMPARE(request.captchaSolution(), empty); QCOMPARE(request.createCaptcha(), true); } void TestAccountRequests::testValues() { AccountRequest request; bool create = false; request.email(test_email); request.password(test_password); request.name(test_name); request.captchaId(test_captchaId); request.captchaSolution(test_captchaSolution); request.createCaptcha(create); QCOMPARE(request.email(), test_email); QCOMPARE(request.password(), test_password); QCOMPARE(request.name(), test_name); QCOMPARE(request.captchaId(), test_captchaId); QCOMPARE(request.captchaSolution(), test_captchaSolution); QCOMPARE(request.createCaptcha(), create); } TestPasswordTokenRequests::TestPasswordTokenRequests() : test_email(QUuid::createUuid().toString()) { } void TestPasswordTokenRequests::testDefaults() { PasswordTokenRequest request; QString empty(""); QCOMPARE(request.email(), empty); } void TestPasswordTokenRequests::testValues() { PasswordTokenRequest request; request.email(test_email); QCOMPARE(request.email(), test_email); } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_token.h0000644000000000000000000000215612323300075023356 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _TEST_TOKEN_H_ #define _TEST_TOKEN_H_ #include class TestToken: public QObject { Q_OBJECT public: TestToken(); private: QString test_hostname; private slots: void testEmptyToken(); void testTokenArgs(); void testTokenCopy(); void testToQuery(); void testFromQuery(); void testTokenName(); }; #endif /* _TEST_TOKEN_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_token.cpp0000644000000000000000000000401512323300075023705 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include #include #include "test_token.h" using namespace UbuntuOne; TestToken::TestToken() : test_hostname(QHostInfo::localHostName()) { } void TestToken::testEmptyToken() { Token *token = new Token(); QVERIFY(!token->isValid()); delete token; } void TestToken::testTokenArgs() { Token *token = new Token("a", "b", "c", "d"); QVERIFY(token->isValid()); delete token; } void TestToken::testTokenCopy() { Token *old_token = new Token("a", "b", "c", "d"); Token new_token = Token(*old_token); QVERIFY(new_token.isValid()); delete old_token; } void TestToken::testToQuery() { Token *token = new Token("token", "t_secret", "consumer", "c_secret"); QString query = token->toQuery(); QString expected("consumer_key=consumer&consumer_secret=c_secret&name=Ubuntu+One+%40+" + test_hostname + "&token=token&token_secret=t_secret"); QCOMPARE(query, expected); delete token; } void TestToken::testFromQuery() { Token *token = Token::fromQuery("consumer_key=c&consumer_secret=c_s&name=Name+%40+hostname&token=t&token_secret=t_s"); QVERIFY(token->isValid()); delete token; } void TestToken::testTokenName() { QString expected = QStringLiteral(TOKEN_ID) + " @ " + test_hostname; QCOMPARE(Token::buildTokenName(), expected); } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_responses.h0000644000000000000000000000377012323300075024262 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _TEST_RESPONSES_H_ #define _TEST_RESPONSES_H_ #include class TestErrorResponses: public QObject { Q_OBJECT public: TestErrorResponses(); private: int test_httpStatus; QString test_httpReason, test_code, test_message, test_imageUrl, test_captchaId, test_captchaMessage, test_email; private slots: void testDefaults(); void testValues(); void testErrorMessage(); }; class TestOAuthTokenResponses : public QObject { Q_OBJECT public: TestOAuthTokenResponses(); private: QString test_token_name, test_token_secret, test_token_key, test_date_created, test_date_updated, test_consumer_secret, test_consumer_key, test_href; private slots: void testDefaults(); void testValues(); }; class TestPasswordTokenResponses : public QObject { Q_OBJECT public: TestPasswordTokenResponses(); private: QString test_email; private slots: void testDefaults(); void testValues(); }; class TestAccountResponses : public QObject { Q_OBJECT public: TestAccountResponses(); private: QString test_status, test_openid, test_displayname, test_href, test_email; QStringList test_emails; private slots: void testDefaults(); void testValues(); }; #endif /* _TEST_RESPONSES_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/CMakeLists.txt0000644000000000000000000000176412323300075023572 0ustar # The thing we're building in here SET (TESTS_TARGET test-ubuntuoneauth) # Qt5 bits SET (CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) # The sources for building the tests FILE (GLOB SOURCES *.cpp) add_executable (${TESTS_TARGET} ${SOURCES}) qt5_use_modules (${TESTS_TARGET} Test DBus Network) target_link_libraries (${TESTS_TARGET} -Wl,-rpath,${CMAKE_BINARY_DIR}/libubuntuoneauth -L${CMAKE_BINARY_DIR}/libubuntuoneauth ${AUTH_LIB_NAME}) add_custom_target(ubuntuoneauth-tests COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${TESTS_TARGET} DEPENDS ${TESTS_TARGET} ) add_custom_target(ubuntuoneauth-tests-valgrind COMMAND valgrind --tool=memcheck ${CMAKE_CURRENT_BINARY_DIR}/${TESTS_TARGET} DEPENDS ${TESTS_TARGET} ) add_custom_target(ubuntuoneauth-tests-valgrind-leaks COMMAND valgrind --tool=memcheck --track-origins=yes --num-callers=40 --leak-resolution=high --leak-check=full ${CMAKE_CURRENT_BINARY_DIR}/${TESTS_TARGET} DEPENDS ${TESTS_TARGET} ) ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_logging.h0000644000000000000000000000200512323300075023655 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _TEST_AUTH_LOGGING_H_ #define _TEST_AUTH_LOGGING_H_ #include class TestAuthLogger: public QObject { Q_OBJECT public: explicit TestAuthLogger(QObject *parent = 0); private slots: void testMessageTypeString(); void testLogLevel(); }; #endif /* _TEST_AUTH_LOGGING_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/tests/test_responses.cpp0000644000000000000000000001405012323300075024606 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include "test_responses.h" #include "responses.h" #include "errormessages.h" using namespace UbuntuOne; TestErrorResponses::TestErrorResponses() : test_httpStatus(123), test_httpReason(QUuid::createUuid().toString()), test_code(QUuid::createUuid().toString()), test_message(QUuid::createUuid().toString()), test_imageUrl(QUuid::createUuid().toString()), test_captchaId(QUuid::createUuid().toString()), test_captchaMessage(QUuid::createUuid().toString()), test_email(QUuid::createUuid().toString()) { } void TestErrorResponses::testDefaults() { ErrorResponse response; QString empty(""); QCOMPARE(response.httpStatus(), -1); QCOMPARE(response.httpReason(), empty); QCOMPARE(response.code(), -1); QCOMPARE(response.message(), empty); QCOMPARE(response.imageUrl(), empty); QCOMPARE(response.captchaId(), empty); QCOMPARE(response.captchaMessage(), empty); QCOMPARE(response.email(), empty); } void TestErrorResponses::testValues() { ErrorResponse response; response.httpStatus(test_httpStatus); response.httpReason(test_httpReason); response.code(test_code); response.message(test_message); response.imageUrl(test_imageUrl); response.captchaId(test_captchaId); response.captchaMessage(test_captchaMessage); response.email(test_email); QCOMPARE(response.httpStatus(), test_httpStatus); QCOMPARE(response.httpReason(), test_httpReason); QCOMPARE(response.code(), -1); QCOMPARE(response.message(), test_message); QCOMPARE(response.imageUrl(), test_imageUrl); QCOMPARE(response.captchaId(), test_captchaId); QCOMPARE(response.captchaMessage(), test_captchaMessage); QCOMPARE(response.email(), test_email); } void TestErrorResponses::testErrorMessage() { ErrorResponse response; response.code(CAPTCHA_REQUIRED); QCOMPARE(response.code(), int(ErrorCodes::CODE_CAPTCHA_REQUIRED)); } TestOAuthTokenResponses::TestOAuthTokenResponses() : test_token_name(QUuid::createUuid().toString()), test_token_secret(QUuid::createUuid().toString()), test_token_key(QUuid::createUuid().toString()), test_date_created(QUuid::createUuid().toString()), test_date_updated(QUuid::createUuid().toString()), test_consumer_secret(QUuid::createUuid().toString()), test_consumer_key(QUuid::createUuid().toString()), test_href(QUuid::createUuid().toString()) { } void TestOAuthTokenResponses::testDefaults() { OAuthTokenResponse response; QString empty(""); QCOMPARE(response.token_name(), empty); QCOMPARE(response.token_secret(), empty); QCOMPARE(response.token_key(), empty); QCOMPARE(response.date_created(), empty); QCOMPARE(response.date_updated(), empty); QCOMPARE(response.consumer_secret(), empty); QCOMPARE(response.consumer_key(), empty); QCOMPARE(response.href(), empty); } void TestOAuthTokenResponses::testValues() { OAuthTokenResponse response; response.token_name(test_token_name); response.token_secret(test_token_secret); response.token_key(test_token_key); response.date_created(test_date_created); response.date_updated(test_date_updated); response.consumer_secret(test_consumer_secret); response.consumer_key(test_consumer_key); response.href(test_href); QCOMPARE(response.token_name(), test_token_name); QCOMPARE(response.token_secret(), test_token_secret); QCOMPARE(response.token_key(), test_token_key); QCOMPARE(response.date_created(), test_date_created); QCOMPARE(response.date_updated(), test_date_updated); QCOMPARE(response.consumer_secret(), test_consumer_secret); QCOMPARE(response.consumer_key(), test_consumer_key); QCOMPARE(response.href(), test_href); } TestPasswordTokenResponses::TestPasswordTokenResponses() : test_email(QUuid::createUuid().toString()) { } void TestPasswordTokenResponses::testDefaults() { PasswordTokenResponse response; QString empty(""); QCOMPARE(response.email(), empty); } void TestPasswordTokenResponses::testValues() { PasswordTokenResponse response; response.email(test_email); QCOMPARE(response.email(), test_email); } TestAccountResponses::TestAccountResponses() : test_status(QUuid::createUuid().toString()), test_openid(QUuid::createUuid().toString()), test_displayname(QUuid::createUuid().toString()), test_href(QUuid::createUuid().toString()), test_email(QUuid::createUuid().toString()) { } void TestAccountResponses::testDefaults() { AccountResponse response; QString empty(""); QCOMPARE(response.status(), empty); QCOMPARE(response.openid(), empty); QCOMPARE(response.displayname(), empty); QCOMPARE(response.href(), empty); QCOMPARE(response.email(), empty); /*QCOMPARE(response.emails(), empty);*/ } void TestAccountResponses::testValues() { AccountResponse response; response.status(test_status); response.openid(test_openid); response.displayname(test_displayname); response.href(test_href); response.email(test_email); /*response.emails(test_emails);*/ QCOMPARE(response.status(), test_status); QCOMPARE(response.openid(), test_openid); QCOMPARE(response.displayname(), test_displayname); QCOMPARE(response.href(), test_href); QCOMPARE(response.email(), test_email); /*QCOMPARE(response.emails(), test_emails);*/ } ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/responses.h0000644000000000000000000001024612323300075022055 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _RESPONSES_H_ #define _RESPONSES_H_ #include #include #include #include namespace UbuntuOne { class ErrorResponse { public: ErrorResponse(); ErrorResponse(const int& httpStatus, const QString& httpReason, const QString& code, const QString& message); int httpStatus() const { return _httpStatus; } QString httpReason() const { return _httpReason; } int code() const { return _code; } QString message() const { return _message; } QString imageUrl() const { return _imageUrl; } QString captchaId() const { return _captchaId; } QString captchaMessage() const { return _captchaMessage; } QString email() const { return _email; } void httpStatus(int val) { _httpStatus = val; } void httpReason(QString val) { _httpReason = val; } void code(QString val); void message(QString val) { _message = val; } void imageUrl(QString val) { _imageUrl = val; } void captchaId(QString val) { _captchaId = val; } void captchaMessage(QString val) { _captchaMessage = val; } void email(QString val) { _email = val; } private: int _httpStatus; QString _httpReason, _message, _imageUrl, _captchaId, _captchaMessage, _email; int _code; // Map to associate the strings with the enum values std::map _mapErrorEnum; void initializeMap(); }; class OAuthTokenResponse { public: OAuthTokenResponse(); QString token_name() const { return _token_name; } QString token_secret() const { return _token_secret; } QString token_key() const { return _token_key; } QString date_created() const { return _date_created; } QString date_updated() const { return _date_updated; } QString consumer_secret() const { return _consumer_secret; } QString consumer_key() const { return _consumer_key; } QString href() const { return _href; } void token_name(QString val) { _token_name = val; } void token_secret(QString val) { _token_secret = val; } void token_key(QString val) { _token_key = val; } void date_created(QString val) { _date_created = val; } void date_updated(QString val) { _date_updated = val; } void consumer_secret(QString val) { _consumer_secret = val; } void consumer_key(QString val) { _consumer_key = val; } void href(QString val) { _href = val; } private: QString _token_name, _token_secret, _token_key, _date_created, _date_updated, _consumer_secret, _consumer_key, _href; }; class PasswordTokenResponse { public: PasswordTokenResponse(); QString email() const { return _email; } void email(QString val) { _email = val; } private: QString _email; }; class AccountResponse { public: AccountResponse(); QString status() const { return _status; } QString openid() const { return _openid; } QString displayname() const { return _displayname; } QString href() const { return _href; } QString email() const { return _email; } QStringList emails() const { return _emails; } void status(QString val) { _status = val; } void openid(QString val) { _openid = val; } void displayname(QString val) { _displayname = val; } void href(QString val) { _href = val; } void email(QString val) { _email = val; } void emails(QStringList val) { _emails = val; } private: QString _status, _openid, _displayname, _href, _email; QStringList _emails; }; } /* end UbuntuOne namespace */ #endif /* _RESPONSES_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/responses.cpp0000644000000000000000000000523212323300075022407 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include "responses.h" #include #include #include "errormessages.h" namespace UbuntuOne { ErrorResponse::ErrorResponse() : _httpStatus(-1), _httpReason(""), _message(""), _imageUrl(""), _captchaId(""), _captchaMessage(""), _email("") { initializeMap(); _code = -1; } ErrorResponse::ErrorResponse(const int& httpStatus, const QString& httpReason, const QString& code, const QString& message) : _httpStatus(httpStatus), _httpReason(httpReason), _message(message), _imageUrl(""), _captchaId(""), _captchaMessage(""), _email("") { initializeMap(); this->code(code); } void ErrorResponse::initializeMap() { _mapErrorEnum[LOGIN_FAILED] = CODE_LOGIN_FAILED; _mapErrorEnum[CAPTCHA_REQUIRED] = CODE_CAPTCHA_REQUIRED; _mapErrorEnum[INVALID_CREDENTIALS] = CODE_INVALID_CREDENTIALS; _mapErrorEnum[TWOFACTOR_REQUIRED] = CODE_TWOFACTOR_REQUIRED; _mapErrorEnum[ACCOUNT_SUSPENDED] = CODE_ACCOUNT_SUSPENDED; _mapErrorEnum[ACCOUNT_DEACTIVATED] = CODE_ACCOUNT_DEACTIVATED; _mapErrorEnum[EMAIL_INVALIDATED] = CODE_EMAIL_INVALIDATED; _mapErrorEnum[CAN_NOT_RESET_PASSWORD] = CODE_CAN_NOT_RESET_PASSWORD; _mapErrorEnum[ALREADY_REGISTERED] = CODE_ALREADY_REGISTERED; } void ErrorResponse::code(QString val) { std::string code = val.toStdString(); std::map::iterator it; it = _mapErrorEnum.find(code); if(it != _mapErrorEnum.end()){ _code = _mapErrorEnum[code]; }else{ _code = -1; } } OAuthTokenResponse::OAuthTokenResponse() : _token_name(""), _token_secret(""), _token_key(""), _date_created(""), _date_updated(""), _consumer_secret(""), _consumer_key(""), _href("") { } PasswordTokenResponse::PasswordTokenResponse() : _email("") { } AccountResponse::AccountResponse() : _status(""), _openid(""), _displayname(""), _href(""), _email(""), _emails("") { } } /* end UbuntuOne namespace */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/errormessages.h0000644000000000000000000000145712323300075022721 0ustar #ifndef ERROR_MESSAGES_H #define ERROR_MESSAGES_H #define NO_HTTP_REASON "No HTTP error reason" #define LOGIN_FAILED "LOGIN_FAILED" #define CAPTCHA_REQUIRED "CAPTCHA_REQUIRED" #define INVALID_CREDENTIALS "INVALID_CREDENTIALS" #define TWOFACTOR_REQUIRED "TWOFACTOR_REQUIRED" #define ACCOUNT_SUSPENDED "ACCOUNT_SUSPENDED" #define ACCOUNT_DEACTIVATED "ACCOUNT_DEACTIVATED" #define EMAIL_INVALIDATED "EMAIL_INVALIDATED" #define CAN_NOT_RESET_PASSWORD "CAN_NOT_RESET_PASSWORD" #define ALREADY_REGISTERED "ALREADY_REGISTERED" enum ErrorCodes { CODE_LOGIN_FAILED = 0, CODE_CAPTCHA_REQUIRED, CODE_INVALID_CREDENTIALS, CODE_TWOFACTOR_REQUIRED, CODE_ACCOUNT_SUSPENDED, CODE_ACCOUNT_DEACTIVATED, CODE_EMAIL_INVALIDATED, CODE_CAN_NOT_RESET_PASSWORD, CODE_ALREADY_REGISTERED }; #endif // ERROR_MESSAGES_H ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/keyring.h0000644000000000000000000000314412323300075021503 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _U1_KEYRING_H_ #define _U1_KEYRING_H_ #include #include #include #include "token.h" namespace UbuntuOne { class Keyring : public QObject { Q_OBJECT public: explicit Keyring(QObject *parent=NULL); void findToken(); void storeToken(Token token); void deleteToken(); Q_SIGNALS: void tokenFound(const Token& token); void tokenNotFound(); void tokenStored(); void tokenDeleted(); void keyringError(QString message); private Q_SLOTS: void handleError(const SignOn::Error &error); void handleSessionData(const SignOn::SessionData &data); void handleCredentialsStored(const quint32 id); void handleAccountRemoved(); private: Accounts::Manager _manager; }; } /* namespace UbuntuOne */ #endif /* _U1_KEYRING_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/CMakeLists.txt0000644000000000000000000000366612323300075022433 0ustar # Qt5 bits SET (CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) # Allow the developer to select if Dynamic or Static libraries are built OPTION (BUILD_STATIC_LIBS "Build Static Libraries" OFF) # Set the LIB_TYPE variable to STATIC SET (LIB_TYPE SHARED) IF (BUILD_STATIC_LIBS) # User wants to build Dynamic Libraries, so change the LIB_TYPE 'STATIC' SET (LIB_TYPE STATIC) ENDIF (BUILD_STATIC_LIBS) # The sources for building the library FILE (GLOB SOURCES *.cpp) # HEADERS only includes the public headers for installation. FILE (GLOB HEADERS *.h) pkg_check_modules(OAUTH REQUIRED oauth) add_definitions(${OAUTH_CFLAGS} ${OAUTH_CFLAGS_OTHER}) # Need the project version here add_definitions("-DPROJECT_VERSION=\"${PROJECT_VERSION}\"") add_library (${AUTH_LIB_NAME} ${LIB_TYPE} ${SOURCES}) qt5_use_modules (${AUTH_LIB_NAME} Core DBus Xml Network) target_link_libraries (${AUTH_LIB_NAME} ${LIBSIGNON_LDFLAGS} ${OAUTH_LDFLAGS} -Wl,--version-script -Wl,${CMAKE_CURRENT_SOURCE_DIR}/libubuntuoneauth.symbols ) SET_TARGET_PROPERTIES(${AUTH_LIB_NAME} PROPERTIES VERSION ${AUTH_LIB_VERSION} SOVERSION ${AUTH_LIB_SOVERSION} ) INSTALL ( TARGETS ${AUTH_LIB_NAME} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} ) INSTALL ( FILES ${HEADERS} DESTINATION include/${AUTH_LIB_NAME} ) SET (AUTH_LIB_PKGCONFIG_IN ${AUTH_LIB_UNVERSIONED}.pc.in) SET (AUTH_LIB_PKGCONFIG ${AUTH_LIB_NAME}.pc) add_custom_target(${AUTH_LIB_PKGCONFIG} ALL sed -e 's|\@PREFIX\@|${CMAKE_INSTALL_PREFIX}|g' -e 's|\@LIBDIR\@|${LIB_INSTALL_DIR}|g' -e 's|\@VERSION\@|${PROJECT_VERSION}|g' -e 's|\@LIB_NAME\@|${AUTH_LIB_NAME}|g' < ${CMAKE_CURRENT_SOURCE_DIR}/${AUTH_LIB_PKGCONFIG_IN} > ${AUTH_LIB_PKGCONFIG} SOURCES ${AUTH_LIB_PKGCONFIG_IN} ) INSTALL ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${AUTH_LIB_PKGCONFIG} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) add_subdirectory(tests) add_subdirectory(examples)ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/identityprovider.cpp0000644000000000000000000000561312323300075023775 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include "identityprovider.h" #include "responses.h" #include "errormessages.h" namespace UbuntuOne { IdentityProvider::IdentityProvider(QObject *parent) : QObject(parent) { /* TODO: either shared pointer or delete this */ network = new Network(this); QObject::connect(network, SIGNAL(OAuthTokenGranted(const OAuthTokenResponse&)), this, SLOT(OnOAuthTokenGranted(const OAuthTokenResponse&))); QObject::connect(network, SIGNAL(PasswordTokenGranted(const PasswordTokenResponse&)), this, SLOT(OnPasswordTokenGranted(const PasswordTokenResponse&))); QObject::connect(network, SIGNAL(AccountGranted(const AccountResponse&)), this, SLOT(OnAccountGranted(const AccountResponse&))); QObject::connect(network, SIGNAL(ErrorOccurred(const ErrorResponse&)), this, SLOT(OnErrorOccurred(const ErrorResponse&))); } void IdentityProvider::GetOAuthToken(const OAuthTokenRequest& token) { network->Post(token); } void IdentityProvider::GetPasswordToken(const PasswordTokenRequest& token) { network->Post(token); } void IdentityProvider::CreateAccount(const AccountRequest& account) { network->Post(account); } /* Token API slots */ void IdentityProvider::OnOAuthTokenGranted(const OAuthTokenResponse& token) { qWarning() << "OAuth token received for " << token.token_name(); emit OAuthTokenGranted(token); } void IdentityProvider::OnPasswordTokenGranted(const PasswordTokenResponse& token) { qWarning() << "Password token received for " << token.email(); emit PasswordTokenGranted(token); } void IdentityProvider::OnAccountGranted(const AccountResponse& account) { qWarning() << "Account created for " << account.email(); emit AccountGranted(account); } void IdentityProvider::OnErrorOccurred(const ErrorResponse& error) { if (error.code() == CODE_TWOFACTOR_REQUIRED){ emit TwoFactorAuthRequired(); }else{ qCritical("Error occurred creating token: %d (%s)", error.code(), error.message().toUtf8().data()); emit ErrorOccurred(error); } } } /* end UbuntuOne namespace */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/requests.h0000644000000000000000000000765212323300075021716 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _REQUESTS_H_ #define _REQUESTS_H_ #include #include namespace UbuntuOne { static QString API_VERSION = "/api/v2"; static QString API_BASE = "https://login.ubuntu.com/"; static QString OAUTH_PATH = API_VERSION + "/tokens/oauth"; static QString OAUTH_API = API_BASE + OAUTH_PATH; static QString PASSWORD_PATH = API_VERSION + "/tokens/password"; static QString PASSWORD_API = API_BASE + PASSWORD_PATH; static QString ACCOUNTS_PATH = API_VERSION + "/accounts"; static QString ACCOUNTS_API = API_BASE + ACCOUNTS_PATH; class RequestInterface { public: RequestInterface(const QUrl& url); virtual QByteArray serialize() const = 0; QUrl url() const { return _url; } protected: QUrl _url; }; class OAuthTokenRequest : public RequestInterface { public: OAuthTokenRequest(); OAuthTokenRequest(QString email, QString password, QString token, QString otp); OAuthTokenRequest(QString base_url, QString email, QString password, QString token, QString otp); QByteArray serialize() const; QString email() const { return _email; } QString password() const { return _password; } QString name() const { return _name; } QString otp() const { return _otp; } void email(QString& val) { _email = val; } void password(QString& val) { _password = val; } void name(QString& val) { _name = val; } void otp(QString& val) { _otp = val; } private: QString _email, _password, _name, _otp; }; class AccountRequest : public RequestInterface { public: AccountRequest(); AccountRequest(QString email, QString password, QString name, QString captchaId, QString captchaSolution, bool createCaptcha = true); AccountRequest(QString base_url, QString email, QString password, QString name, QString captchaId, QString captchaSolution, bool createCaptcha); AccountRequest(QString base_url, QString email, QString password, QString name); QByteArray serialize() const; QString email() const { return _email; } QString password() const { return _password; } QString name() const { return _name; } QString captchaId() const { return _captchaId; } QString captchaSolution() const { return _captchaSolution; } bool createCaptcha() const { return _createCaptcha; } void email(QString& val) { _email = val; } void password(QString& val) { _password = val; } void name(QString& val) { _name = val; } void captchaId(QString& val) { _captchaId = val; } void captchaSolution(QString& val) { _captchaSolution = val; } void createCaptcha(bool& val) { _createCaptcha = val; } private: QString _email, _password, _name, _captchaId, _captchaSolution; bool _createCaptcha; }; class PasswordTokenRequest : public RequestInterface { public: PasswordTokenRequest(); PasswordTokenRequest(QString email); PasswordTokenRequest(QString base_url, QString email); QByteArray serialize() const; QString email() const { return _email; } void email(QString& val) { _email = val; } private: QString _email; }; } /* end UbuntuOne namespace */ #endif /* _REQUESTS_H_ */ ubuntuone-credentials-14.04+14.04.20140415/libubuntuoneauth/network.h0000644000000000000000000000351212323300075021523 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _NETWORK_H_ #define _NETWORK_H_ #include "responses.h" #include #include #include #include namespace UbuntuOne { class Network : public QObject { Q_OBJECT public: explicit Network(QObject *parent = 0); template void Post(const T& request) { _request->setUrl(request.url()); _nam->post(*_request, request.serialize()); } signals: void OAuthTokenGranted(const OAuthTokenResponse& token); void PasswordTokenGranted(const PasswordTokenResponse& token); void AccountGranted(const AccountResponse& account); void ErrorOccurred(const ErrorResponse& error); public slots: private slots: void OnReply(QNetworkReply*); private: void ProcessOAuthTokenReply(const QJsonObject& object); void ProcessPasswordTokenReply(const QJsonObject& object); void ProcessAccountsReply(const QJsonObject& object); QNetworkAccessManager* _nam; QNetworkRequest* _request; static const QString _tokensApi, _accountsApi; }; } /* end UbuntuOne namespace */ #endif /* _NETWORK_H_ */ ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/0000755000000000000000000000000012323300441021002 5ustar ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/qmldir.template0000644000000000000000000000012612323300075024031 0ustar module @QML_MODULE_NAME@ plugin @QML_PLUGIN_NAME@ typeinfo @QML_MODULE_NAME@.qmltypes ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/ubuntuone_credentials_service.h0000644000000000000000000000314212323300075027277 0ustar #ifndef UBUNTUONE_CREDENTIALS_SERVICE_H #define UBUNTUONE_CREDENTIALS_SERVICE_H #include #include "ssoservice.h" using namespace UbuntuOne; enum CredentialsServiceState{ IDLE = 0, CHECK, LOGIN, REGISTER, SIGN, DELETE }; class UbuntuOneCredentialsService : public QQuickItem { Q_OBJECT Q_DISABLE_COPY(UbuntuOneCredentialsService) public: UbuntuOneCredentialsService(QQuickItem *parent = 0); ~UbuntuOneCredentialsService(); Q_INVOKABLE void checkCredentials(); Q_INVOKABLE void invalidateCredentials(); Q_INVOKABLE void login(QString email, QString password, QString twoFactorCode = QString()); Q_INVOKABLE void registerUser(QString email, QString password, QString name); Q_INVOKABLE void signUrl(QString url, QString method, bool asQuery = false); signals: void credentialsFound(); void credentialsNotFound(); void credentialsDeleted(); void loginOrRegisterSuccess(); void loginOrRegisterError(QString errorMessage); void twoFactorAuthRequired(); void urlSigned(QString signedUrl); void urlSigningError(QString errorMessage); private slots: void handleCredentialsFound(const Token&); void handleCredentialsNotFound(); void handleCredentialsStored(); void handleCredentialsDeleted(); void handleTwoFactorAuthRequired(); void handleError(const ErrorResponse&); private: SSOService _service; CredentialsServiceState _state; QString _sign_url; QString _sign_method; bool _sign_asQuery; }; QML_DECLARE_TYPE(UbuntuOneCredentialsService) #endif // UBUNTUONE_CREDENTIALS_SERVICE_H ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/examples/0000755000000000000000000000000012323300441022620 5ustar ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/examples/embeddingMain.qml0000644000000000000000000000444212323300075026065 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 import UbuntuOne 1.0 Rectangle { id: exampleMain width: units.gu(100) height: units.gu(120) color: UbuntuColors.coolGrey Column { spacing: units.gu(2) anchors.fill: parent Label { id: infoLabel text: "Press this button to check for credentials in local keyring:" color: "white" } Button { id: btnCancel text: "Check existing creds" color: "#1c091a" onClicked: { u1credservice.checkCredentials(); } } Label { id: revokeLabel text: "Press this button to delete the credentials in local keyring:" color: "white" } Button { id: btnRevoke text: "Invalidate existing creds" color: "#1c091a" onClicked: { u1credservice.invalidateCredentials(); } } } // Column /* Here is the component that exposes the credentials API. You can use it to test if there is a local credential already, and sign a url with it, if it does exist.*/ UbuntuOneCredentialsService { id: u1credservice onCredentialsFound: { infoLabel.text = "Credentials Found. signing a url."; signUrl("http://server", "GET"); } onUrlSigned: { infoLabel.text = "signed url is "+ signedUrl; } onUrlSigningError: { infoLabel.text = "signing error:" + errorMessage; } onCredentialsNotFound: { /* We could just report a generic error here, but to show what happens if you don't bother checking before you sign a URL, we sign a URL here, expecting it to fail. We'll then get onUrlSigningError(), with an error message saying something like "attempt to sign with no credentials in keyring". Note that "Keyring" is vestigial, we are not using the system keyring. */ signUrl("http://server", "GET"); } onCredentialsDeleted: { revokeLabel.text = "Deleted Credentials successfully"; } } } // UbuntuShape ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/ubuntuone_credentials_plugin.h0000644000000000000000000000054312323300075027137 0ustar #ifndef UBUNTUONECREDENTIALS_PLUGIN_H #define UBUNTUONECREDENTIALS_PLUGIN_H #include class UbuntuOneCredentialsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; #endif // UBUNTUONECREDENTIALS_PLUGIN_H ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/ubuntuone_credentials_plugin.cpp0000644000000000000000000000041312323300075027466 0ustar #include "ubuntuone_credentials_plugin.h" #include "ubuntuone_credentials_service.h" #include void UbuntuOneCredentialsPlugin::registerTypes(const char *uri) { qmlRegisterType(uri, 1, 0, "UbuntuOneCredentialsService"); } ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/README0000644000000000000000000000171512323300075021671 0ustar Ubuntu One Credentials QML Plugin This plugin provides the UbuntuOne QML Component, which exposes the CredentialsService plugin, allowing you to display login/register UI and check for credentials and sign URLs. HACKING An example for embedding the UI provided by the plugin is in examples/embedding.qml The CMake setup only builds the complete QML component at install, and the qmltypes file required by qtcreator is also only built at install, so to test without installing to a system location, you will need to do something like the following: mkdir -p build cd build cmake -D .. -DCMAKE_INSTALL_PREFIX:PATH=/tmp/installtemp .. make all install Then, when running, point LD_LIBRARY_PATH to the install lib dir so that libubuntuonecredentials is discoverable. Here's an example of running qmlscene to try the example code: LD_LIBRARY_PATH=/tmp/installtemp/lib/ qmlscene -I /tmp/installtemp/lib/qt5/qml/ qml-credentials-service/examples/embeddingMain.qml ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/CMakeLists.txt0000644000000000000000000000207612323300075023552 0ustar # Qt5 bits set (CMAKE_INCLUDE_CURRENT_DIR ON) set (CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) file (GLOB CPP_SOURCES *.cpp) configure_file (qmldir.template qmldir) add_library (${QML_PLUGIN_NAME} MODULE ${CPP_SOURCES}) qt5_use_modules (${QML_PLUGIN_NAME} Core Widgets Quick Qml ) target_link_libraries (${QML_PLUGIN_NAME} -Wl,-rpath,${CMAKE_BINARY_DIR}/libubuntuoneauth -L${CMAKE_BINARY_DIR}/libubuntuoneauth ${AUTH_LIB_NAME} ) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir DESTINATION ${QML_MODULE_INSTALL_DIR}/${QML_MODULE_NAME} ) install (TARGETS ${QML_PLUGIN_NAME} LIBRARY DESTINATION ${QML_MODULE_INSTALL_DIR}/${QML_MODULE_NAME} NAMELINK_SKIP ) install (CODE "execute_process(COMMAND qmlplugindump ${QML_MODULE_NAME} ${QML_PLUGIN_API_VERSION} ${CMAKE_INSTALL_PREFIX}/${QML_MODULE_INSTALL_DIR} OUTPUT_FILE ${CMAKE_INSTALL_PREFIX}/${QML_MODULE_INSTALL_DIR}/${QML_MODULE_NAME}/${QML_MODULE_NAME}.qmltypes)") add_custom_command(TARGET ${QML_PLUGIN_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR} ${QML_MODULE_NAME})ubuntuone-credentials-14.04+14.04.20140415/qml-credentials-service/ubuntuone_credentials_service.cpp0000644000000000000000000001170312323300075027634 0ustar #include "ubuntuone_credentials_service.h" #include "errormessages.h" #include UbuntuOneCredentialsService::UbuntuOneCredentialsService(QQuickItem *parent): QQuickItem(parent) { _state = IDLE; QObject::connect(&_service, SIGNAL(credentialsFound(Token)), this, SLOT(handleCredentialsFound(Token))); QObject::connect(&_service, SIGNAL(credentialsNotFound()), this, SLOT(handleCredentialsNotFound())); QObject::connect(&_service, SIGNAL(credentialsStored()), this, SLOT(handleCredentialsStored())); QObject::connect(&_service, SIGNAL(credentialsDeleted()), this, SLOT(handleCredentialsDeleted())); QObject::connect(&_service, SIGNAL(twoFactorAuthRequired()), this, SLOT(handleTwoFactorAuthRequired())); QObject::connect(&_service, SIGNAL(requestFailed(ErrorResponse)), this, SLOT(handleError(ErrorResponse))); } UbuntuOneCredentialsService::~UbuntuOneCredentialsService() { } // public API (Q_INVOKABLE) void UbuntuOneCredentialsService::checkCredentials() { Q_ASSERT(_state == IDLE); _state = CHECK; _service.getCredentials(); } void UbuntuOneCredentialsService::invalidateCredentials() { Q_ASSERT(_state == IDLE); _state = DELETE; _service.invalidateCredentials(); } void UbuntuOneCredentialsService::login(QString email, QString password, QString twoFactorCode) { Q_ASSERT(_state == IDLE); _state = LOGIN; _service.login(email, password, twoFactorCode); } void UbuntuOneCredentialsService::registerUser(QString email, QString password, QString name) { Q_ASSERT(_state == IDLE); _state = REGISTER; _service.registerUser(email, password, name); } // calling signUrl with no credentials stored will emit an error void UbuntuOneCredentialsService::signUrl(const QString url, const QString method, bool asQuery) { Q_ASSERT(_state == IDLE); _state = SIGN; _sign_url = url; _sign_method = method; _sign_asQuery = asQuery; _service.getCredentials(); } // signal handlers // credentials found is only sent by _service.getCredentials(), not login or register void UbuntuOneCredentialsService::handleCredentialsFound(const Token& token) { QString signedUrl; qDebug() << "in UbuntuOneCredentialsService::handleCredentialsFound"; // set state before emitting any signals, as signals happen 'after' transition CredentialsServiceState calledState = _state; _state = IDLE; switch(calledState){ case CHECK: emit credentialsFound(); break; case SIGN: signedUrl = token.signUrl(_sign_url, _sign_method, _sign_asQuery); emit urlSigned(signedUrl); break; default: qDebug() << "UbuntuOneCredentialsService did not expect credentialsFound in state " << calledState; } } void UbuntuOneCredentialsService::handleCredentialsNotFound() { qDebug() << "in UbuntuOneCredentialsService::handleCredentialsNotFound"; // set state before emitting any signals, as signals happen 'after' transition CredentialsServiceState calledState = _state; _state = IDLE; switch(calledState){ case CHECK: emit credentialsNotFound(); break; case SIGN: emit urlSigningError(QString("Attempt to sign without credentials in keyring")); break; default: qDebug() << "UbuntuOneCredentialsService did not expect credentialsNotFound in state " << calledState; } } // Credentials stored is signaled when the u1 ping is done after login/register void UbuntuOneCredentialsService::handleCredentialsStored() { qDebug() << "in UbuntuOneCredentialsService::handleCredentialsStored"; // set state before emitting any signals, as signals happen 'after' transition CredentialsServiceState calledState = _state; _state = IDLE; if (calledState == LOGIN || calledState == REGISTER){ emit loginOrRegisterSuccess(); }else{ qDebug() << "UbuntuOneCredentialsService did not expect credentialsStored in state " << calledState; } } void UbuntuOneCredentialsService::handleCredentialsDeleted() { qDebug() << "in UbuntuOneCredentialsService::handleCredentialsDeleted"; // set state before emitting any signals, as signals happen 'after' transition CredentialsServiceState calledState = _state; _state = IDLE; if (calledState == DELETE){ emit credentialsDeleted(); }else{ qDebug() << "UbuntuOneCredentialsService did not expect credentialsDeleted in state " << calledState; } } void UbuntuOneCredentialsService::handleTwoFactorAuthRequired(){ _state = IDLE; emit twoFactorAuthRequired(); } void UbuntuOneCredentialsService::handleError(const ErrorResponse& error) { _state = IDLE; if (error.httpStatus() == 0 || error.httpReason() == NO_HTTP_REASON) { emit loginOrRegisterError("Network error - please retry."); } else { emit loginOrRegisterError(error.message()); } } ubuntuone-credentials-14.04+14.04.20140415/LICENSE0000644000000000000000000000261612323300075015275 0ustar # This is the Ubuntu One authentication library package. # # Copyright (C) 2013 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranties of # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program. If not, see . # # In addition, as a special exception, the copyright holders give # permission to link the code of portions of this program with the # OpenSSL library under certain conditions as described in each # individual source file, and distribute linked combinations # including the two. # You must obey the GNU General Public License in all respects # for all of the code used other than OpenSSL. If you modify # file(s) with this exception, you may extend this exception to your # version of the file(s), but you are not obligated to do so. If you # do not wish to do so, delete this exception statement from your # version. If you delete this exception statement from all source # files in the program, then also delete it here. ubuntuone-credentials-14.04+14.04.20140415/LICENSE.OpenSSL0000644000000000000000000001547312323300075016564 0ustar Certain source files in this program permit linking with the OpenSSL library (http://www.openssl.org), which otherwise wouldn't be allowed under the (A)GPL. For purposes of identifying OpenSSL, most source files giving this permission limit it to versions of OpenSSL having a license identical to that listed in this file (LICENSE.OpenSSL). It is not necessary for the copyright years to match between this file and the OpenSSL version in question. However, note that because this file is an extension of the license statements of these source files, this file may not be changed except with permission from all copyright holders of source files in this program which reference this file. LICENSE ISSUES ============== The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the OpenSSL License and the original SSLeay license apply to the toolkit. See below for the actual license texts. Actually both licenses are BSD-style Open Source licenses. In case of any license issues related to OpenSSL please contact openssl-core@openssl.org. OpenSSL License --------------- /* ==================================================================== * Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * openssl-core@openssl.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.openssl.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ Original SSLeay License ----------------------- /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ ubuntuone-credentials-14.04+14.04.20140415/signon-plugin/0000755000000000000000000000000012323300441017051 5ustar ubuntuone-credentials-14.04+14.04.20140415/signon-plugin/ubuntuone-plugin.cpp0000644000000000000000000000420212323300075023076 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #include #include "ubuntuone-plugin.h" namespace UbuntuOne { SignOnPlugin::SignOnPlugin(QObject *parent) : AuthPluginInterface(parent) { } SignOnPlugin::~SignOnPlugin() { } QString SignOnPlugin::type() const { return QLatin1String("ubuntuone"); } QStringList SignOnPlugin::mechanisms() const { QStringList res = QStringList(QLatin1String("ubuntuone")); return res; } void SignOnPlugin::cancel() { } void SignOnPlugin::process(const SignOn::SessionData &inData, const QString &mechanism) { Q_UNUSED(mechanism); PluginData response; m_data = inData.data(); if (!inData.Secret().isEmpty()) { response.setConsumer(m_data.Consumer()); response.setConsumerSecret(m_data.ConsumerSecret()); response.setToken(m_data.Token()); response.setTokenSecret(m_data.TokenSecret()); response.setName(Token::buildTokenName()); emit result(response); return; } SignOn::UiSessionData data; data.setRealm(inData.Realm()); data.setShowRealm(!data.Realm().isEmpty()); emit userActionRequired(data); } void SignOnPlugin::userActionFinished(const SignOn::UiSessionData &data) { } SIGNON_DECL_AUTH_PLUGIN(SignOnPlugin) } // namespace UbuntuOne ubuntuone-credentials-14.04+14.04.20140415/signon-plugin/ubuntuonedata.h0000644000000000000000000000253012323300075022103 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _UBUNTUONE_DATA_H_ #define _UBUNTUONE_DATA_H_ #include namespace UbuntuOne { class PluginData : public SignOn::SessionData { public: // The name of the token SIGNON_SESSION_DECLARE_PROPERTY(QString, Name); // The consumer key and secret for signing SIGNON_SESSION_DECLARE_PROPERTY(QString, Consumer); SIGNON_SESSION_DECLARE_PROPERTY(QString, ConsumerSecret); // The access token and secret for signing SIGNON_SESSION_DECLARE_PROPERTY(QString, Token); SIGNON_SESSION_DECLARE_PROPERTY(QString, TokenSecret); }; } // namespace UbuntuOne #endif ubuntuone-credentials-14.04+14.04.20140415/signon-plugin/CMakeLists.txt0000644000000000000000000000210112323300075021606 0ustar # Qt5 bits SET (CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) # The sources for building the library FILE (GLOB SOURCES *.cpp) # HEADERS only includes the public headers for installation. FILE (GLOB HEADERS *.h) find_package (PkgConfig REQUIRED) pkg_check_modules(SIGNON REQUIRED signon-plugins) add_definitions(${SIGNON_CFLAGS} ${SIGNON_CFLAGS_OTHER}) # Workaround for cmake not adding these to automoc properly SET (CMAKE_AUTOMOC_MOC_OPTIONS "${SIGNON_CFLAGS} ${CMAKE_AUTOMOC_MOC_OPTIONS}") # Need the project version here add_definitions("-DPROJECT_VERSION=\"${PROJECT_VERSION}\"") add_library (${SIGNON_PLUGIN_NAME} MODULE ${SOURCES}) qt5_use_modules (${SIGNON_PLUGIN_NAME} Core Xml Network) target_link_libraries (${SIGNON_PLUGIN_NAME} -Wl,-rpath,${CMAKE_BINARY_DIR}/libubuntuoneauth -L${CMAKE_BINARY_DIR}/libubuntuoneauth ${AUTH_LIB_NAME} ${SIGNON_PLUGIN_LDFLAGS} ) SET (SIGNON_PLUGIN_INSTALL_DIR lib/signon) INSTALL ( TARGETS ${SIGNON_PLUGIN_NAME} LIBRARY DESTINATION ${SIGNON_PLUGIN_INSTALL_DIR} ) #add_subdirectory(tests) ubuntuone-credentials-14.04+14.04.20140415/signon-plugin/ubuntuone-plugin.h0000644000000000000000000000301512323300075022544 0ustar /* * Copyright 2013 Canonical Ltd. * * This library is free software; you can redistribute it and/or * modify it under the terms of version 3 of the GNU Lesser General Public * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU 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. */ #ifndef _UBUNTUONE_PLUGIN_H_ #define _UBUNTUONE_PLUGIN_H_ #include #include #include #include #include #include "ubuntuonedata.h" namespace UbuntuOne { class SignOnPlugin : public AuthPluginInterface { Q_OBJECT Q_INTERFACES(AuthPluginInterface) public: SignOnPlugin(QObject *parent = 0); virtual ~SignOnPlugin(); public Q_SLOTS: QString type() const; QStringList mechanisms() const; void cancel(); void process(const SignOn::SessionData &inData, const QString &mechanism = 0); void userActionFinished(const SignOn::UiSessionData &data); private: PluginData m_data; }; } // namespace UbuntuOne #endif ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/0000755000000000000000000000000012323300441021211 5ustar ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/Main.qml0000644000000000000000000000606012323300075022615 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.OnlineAccounts 0.1 Flickable { id: rootFlickable property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0 contentHeight: editPageLoader.item.height + keyboardSize property url newAccountUrl: "NewAccount.qml" property url existingAccountUrl: "ExistingAccount.qml" property Component newAccountComponent: null property Component existingAccountComponent: null signal finished Loader { id: editPageLoader anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top source: sourceComponent === null ? (account.accountId != 0 ? existingAccountUrl : newAccountUrl) : "" sourceComponent: account.accountId != 0 ? existingAccountComponent : newAccountComponent onLoaded: { /* NOTE: dirty hack to work around our grandparent Page (from AccountCreationPage.qml in ubuntu-system-settings-online-accounts) not being able to find our Flickable, and not having an id set for us to set flickable directly. This will not be necessary once Bug #1221845 is fixed. */ rootFlickable.parent.parent.flickable = rootFlickable; } Connections { target: rootFlickable.parent.parent.tools.back; onTriggered: { if(editPageLoader.source == newAccountUrl) { console.debug("back button clicked while creating account, removing incomplete account."); account.remove(Account.RemoveCredentials); editPageLoader.item.resetUI(); } } } Connections { target: account onSynced: { console.debug("Account id " + account.accountId + " synced. account.displayName: " + account.displayName) } } Connections { target: editPageLoader.item onFinished: rootFlickable.finished() } } Rectangle { id: loadingOverlay objectName: "loadingOverlay" opacity: 0.7 color: "white" visible: false anchors.fill: parent ActivityIndicator { id: activity anchors.centerIn: parent running: parent.visible } } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/RegisterForm.qml0000644000000000000000000000651012323300075024341 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 Column { id: registerFormColumn spacing: units.gu(2) /* export two aliases for KeyNavigation access*/ property alias nameTextField: nameTextField property alias confirmPasswordTextField: confirmPasswordTextField property alias password: passwordTextField.text property alias display_name: nameTextField.text Label { id: subtitle text: "Please tell us your name and choose a password." } TextField { id: nameTextField objectName: "nameTextField" placeholderText: "Your name" width: main.width - (2 * main.anchors.margins) KeyNavigation.tab: passwordTextField KeyNavigation.backtab: emailTextField /* from main */ } TextField { id: passwordTextField objectName: "passwordTextField" placeholderText: "Password with at least 8 characters" echoMode: TextInput.Password width: main.width - (2 * main.anchors.margins) KeyNavigation.tab: confirmPasswordTextField KeyNavigation.backtab: nameTextField inputMethodHints: Qt.ImhSensitiveData } TextField { id: confirmPasswordTextField objectName: "confirmPasswordTextField" placeholderText: "Re-type password" echoMode: TextInput.Password width: main.width - (2 * main.anchors.margins) KeyNavigation.tab: emailTextField /* from main */ KeyNavigation.backtab: passwordTextField inputMethodHints: Qt.ImhSensitiveData } Row { spacing: units.gu(2) CheckBox { id: termsAndConditionsCheckBox objectName: "termsAndConditionsCheckBox" checked: false } Label { anchors.verticalCenter: termsAndConditionsCheckBox.verticalCenter text: "I agree to the Ubuntu One Terms and Conditions" onLinkActivated: { Qt.openUrlExternally(link); } } } ButtonRow { objectName: "buttonRow-RegisterForm" anchors.left: parent.left anchors.right: parent.right } function resetUI() { termsAndConditionsCheckBox.checked = false; nameTextField.text = ""; passwordTextField.text = ""; confirmPasswordTextField.text = ""; } function validateInput() { var nameOK = (nameTextField.text != ""); nameTextField.errorHighlight = !nameOK; if (!nameOK) { main.showError("Please enter a name."); return false; } var passwordLongEnough = passwordTextField.length > 7; passwordTextField.errorHighlight = !passwordLongEnough; if (!passwordLongEnough) { main.showError("Your password must be at least 8 characters long."); return false; } var passwordsMatch = (passwordTextField.text == confirmPasswordTextField.text); confirmPasswordTextField.errorHighlight = !passwordsMatch; if (!passwordsMatch) { main.showError("The passwords do not match."); return false; } if (!termsAndConditionsCheckBox.checked) { main.showError("Please accept the terms and conditions by checking the box."); return false; } return true; } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/ExistingAccount.qml0000644000000000000000000000533412323300075025043 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.Components.ListItems 0.1 as ListItem import Ubuntu.Components.Popups 0.1 import Ubuntu.OnlineAccounts 0.1 import Ubuntu.OnlineAccounts.Plugin 1.0 Column { id: root property variant __account: account signal finished anchors.left: parent.left anchors.right: parent.right ListItem.SingleValue { objectName: "emailListItem" text: "Email" value: account.displayName } ServiceSwitches { account: __account enabled: __account.enabled opacity: enabled ? 1 : 0.5 } ListItem.SingleControl { control: Button { objectName: "removeAccountButton" text: "Remove account…" width: parent.width - units.gu(4) onClicked: PopupUtils.open(removalConfirmationComponent); } showDivider: false } Component { id: removalConfirmationComponent Dialog { id: dialog property bool confirmed: false title: "Remove Credentials" text: "Removing the Ubuntu One credentials will prevent any applications on this device from accessing your account. You can authorize the device again by providing your username and password." Button { text: "Remove" objectName: "confirmRemoveAccountButton" onClicked: { PopupUtils.close(dialog); console.debug("Removing account ID: " + account.accountId); account.removed.connect(root.finished); account.remove(Account.RemoveCredentials); console.debug("removed account ID: " + account.accountId); } } Button { text: "Cancel" objectName: "cancelRemoveAccountButton" onClicked: { console.log("User cancelled account removal"); PopupUtils.close(dialog); } } } // Dialog } //Component } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/LoginForm.qml0000644000000000000000000000636212323300075023632 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 Column { id: loginFormColumn spacing: units.gu(2) /* export two aliases for KeyNavigation access*/ property alias passwordTextField: passwordTextField property alias twoFactorTextField: twoFactorTextField property alias password: passwordTextField.text property alias twoFactorVisible: twoFactorUI.visible property alias twoFactorCode: twoFactorTextField.text Label { text: "I am a returning user and my password is:" } TextField { id: passwordTextField objectName: "loginFormPasswordTextField" placeholderText: "Your password" echoMode: TextInput.Password width: main.width - (2 * main.anchors.margins) Keys.onReturnPressed: main.processForm(); KeyNavigation.tab: twoFactorUI.visible ? twoFactorTextField : emailTextField /* from main */ KeyNavigation.backtab: emailTextField /* from main */ inputMethodHints: Qt.ImhSensitiveData } Label { text: 'Forgotten your password?' textFormat: Text.RichText onLinkActivated: { Qt.openUrlExternally(link); } } ButtonRow { objectName: "buttonRow-LoginForm-noTwoFactor" anchors.left: parent.left anchors.right: parent.right visible: !twoFactorUI.visible } Column { id: twoFactorUI spacing: units.gu(2) width: parent.width visible: false Label { text: "Type your verification code:" } TextField { id: twoFactorTextField objectName: "twoFactorTextField" placeholderText: "2-factor device code" echoMode: TextInput.Password width: main.width - (2 * main.anchors.margins) Keys.onReturnPressed: { main.processForm(); } KeyNavigation.tab: emailTextField KeyNavigation.backtab: passwordTextField } Label { text: 'Authentication Device Help' textFormat: Text.RichText onLinkActivated: { Qt.openUrlExternally(link); } } ButtonRow { anchors.left: parent.left anchors.right: parent.right } } function resetUI() { twoFactorUI.visible = false; twoFactorTextField.text = ""; passwordTextField.text = ""; } function validateInput() { var passwordLongEnough = passwordTextField.text.length > 7; passwordTextField.errorHighlight = !passwordLongEnough; if (!passwordLongEnough) { main.showError("Password must be at least 8 characters long."); } if (!twoFactorUI.visible) { return passwordLongEnough; } var twoFactorLongEnough = twoFactorTextField.text.length > 0; twoFactorTextField.errorHighlight = !twoFactorLongEnough; if(!twoFactorLongEnough){ main.showError("Please enter your two-factor device code."); } return passwordLongEnough && twoFactorLongEnough; } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/0000755000000000000000000000000012323300441022353 5ustar ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/0000755000000000000000000000000012323300441024373 5ustar ././@LongLink0000644000000000000000000000015300000000000011602 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000755000000000000000000000000012323300441027660 5ustar ././@LongLink0000644000000000000000000000017500000000000011606 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/TestWrapperNew.qmlubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000377512323300075027701 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.OnlineAccounts 0.1 import UbuntuOne 1.0 MainView { objectName: "mainView" applicationName: "Ubuntu One UOA Provider Plugin Tester" width: units.gu(100) height: units.gu(100) PageStack { id: pageStack Component.onCompleted: { push(dummyPage); push(testingPage); } } Page { id: dummyPage objectName: "dummyPage" title: i18n.tr("Root page") visible: false /* property var success: false */ Rectangle { anchors.fill: parent color: "green" } } Page { title: "testing" id: testingPage objectName: "testingPage" visible: false Rectangle { id: fakeAccount objectName: "FakeNewUOAAccount" property var accountId: 0 signal synced property string displayName: "" function sync() { /* synced() signal is connected to finished on success, so we need to just forward it here */ synced(); } function updateDisplayName() { } function updateEnabled() { } /* fake to avoid creating a UOA account */ property var objectHandle: Qt.createQmlObject('import QtQuick 2.0; Rectangle {}', testingPage, "dynamically-created-fakerect"); } Loader { id: loader property var account: fakeAccount anchors.fill: parent source: "../../../Main.qml" Connections { target: loader.item onFinished: { /* dummyPage.success = true; */ pageStack.pop(); } } } } }././@LongLink0000644000000000000000000000017600000000000011607 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/test_new_account.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000002006712323300075027672 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2013-2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import os from autopilot.matchers import Eventually from testtools.matchers import Equals, Not from ubuntuuitoolkit import emulators as toolkit_emulators from ubuntuone_credentials import ( emulators, TestCaseWithQMLWrapper ) class NewUbuntuOneOnlineAccountTestCase(TestCaseWithQMLWrapper): test_qml_wrapper_file_name = 'TestWrapperNew.qml' def setUp(self): super(NewUbuntuOneOnlineAccountTestCase, self).setUp() self.new_account = self.main_view.select_single(emulators.NewAccount) def test_loading_overlay_starts_invisible(self): overlay = self.main_view.select_single(objectName='loadingOverlay') self.assertThat(overlay.visible, Eventually(Equals(False))) def test_email_field_visible_focused(self): email_text_field = self.main_view.select_single( objectName='emailTextField') self.assertThat(email_text_field.visible, Eventually(Equals(True))) self.assertThat(email_text_field.focus, Eventually(Equals(True))) def test_login_initial_state(self): password_text_field = self.main_view.select_single( objectName='loginFormPasswordTextField') self.assertThat(password_text_field.visible, Eventually(Equals(True))) two_factor_text_field = self.main_view.select_single( objectName='twoFactorTextField') self.assertThat( two_factor_text_field.visible, Eventually(Equals(False))) def test_switch_to_new_user(self): new_user_switch = self.main_view.select_single( toolkit_emulators.CheckBox, objectName='newUserToggleSwitch') new_user_switch.check() password_text_field = self.main_view.select_single( objectName='loginFormPasswordTextField') self.assertThat(password_text_field.visible, Eventually(Equals(False))) name_text_field = self.main_view.select_single( objectName='nameTextField') self.assertThat(name_text_field.visible, Eventually(Equals(True))) def test_error_label_starts_invisible(self): self.assertThat( self.new_account.is_error_label_visible(), Eventually(Equals(False))) class SimpleLogInTestCase(TestCaseWithQMLWrapper): test_qml_wrapper_file_name = 'TestWrapperNew.qml' scenarios = [ ('success', dict(email='ok@te.st', password='password', success=True)), ('failure', dict(email='not-ok@te.st', password='password', success=False))] def setUp(self): # Start the fake server before launching the application. if (os.environ.get('SSO_AUTH_BASE_URL') == 'fake' and os.environ.get('SSO_UONE_BASE_URL') == 'fake'): self.use_fake_servers() super(SimpleLogInTestCase, self).setUp() def test_simple_login(self): """Test that success pops the NewAccount main page, and failure shows the error label. """ new_account = self.main_view.select_single(emulators.NewAccount) new_account.log_in(email=self.email, password=self.password) dummyPage = self.main_view.select_single(objectName="dummyPage") self.assertThat(dummyPage.visible, Eventually(Equals(self.success))) self.assertThat(new_account.is_error_label_visible(), Eventually(Equals(not self.success))) class TwoFactorLogInTestCase(TestCaseWithQMLWrapper): test_qml_wrapper_file_name = 'TestWrapperNew.qml' scenarios = [ ('success', dict(email='2fa@te.st', password='password', twoFactorCode='123456', success=True)), ('failure', dict(email='2fa@te.st', password='password', twoFactorCode='bad', success=False)) ] def setUp(self): # Start the fake server before launching the application. if (os.environ.get('SSO_AUTH_BASE_URL') == 'fake' and os.environ.get('SSO_UONE_BASE_URL') == 'fake'): self.use_fake_servers() super(TwoFactorLogInTestCase, self).setUp() def test_twofactor_login(self): "Test that success pops the NewAccount main page." # Layout change workaround: Here we have to save the initial # globalRect of the twoFactorTextField because we know it will # move, but not necessarily before we are notified that the # visible flag is set - so we need to be able to wait for it # to move so that the call to enter_twofactor_code() below # clicks on the right text field. If we don't do this, # depending on the timing of those update signals, # enter_twofactor_code() may end up writing the code into the # password field, which is always at the location that the # hidden two-factor field starts out at. tfn = 'twoFactorTextField' two_factor_field = self.main_view.select_single(emulators.TextField, objectName=tfn) saved_rect = two_factor_field.globalRect new_account = self.main_view.select_single(emulators.NewAccount) new_account.log_in(email=self.email, password=self.password) # Here we wait for both visible and focus, to ensure that the # field is ready for input, then we also wait for the rect to # change, so we know that autopilot will have the right # coordinates to click on it. self.assertThat(two_factor_field.visible, Eventually(Equals(True))) self.assertThat(two_factor_field.focus, Eventually(Equals(True))) self.assertThat(two_factor_field.globalRect, Eventually(Not(Equals(saved_rect)))) new_account.enter_twofactor_code(self.twoFactorCode) dummyPage = self.main_view.select_single(objectName="dummyPage") self.assertThat(dummyPage.visible, Eventually(Equals(self.success))) self.assertThat(new_account.is_error_label_visible(), Eventually(Equals(not self.success))) VALID_NEW_ACCOUNT = dict(email='new@te.st', name='test name', password='password', password_confirmation='password', agree_to_terms=True, success=True) class RegisterNewU1AccountTestCase(TestCaseWithQMLWrapper): test_qml_wrapper_file_name = 'TestWrapperNew.qml' scenarios = [ ('success', VALID_NEW_ACCOUNT), ('bad request', dict(VALID_NEW_ACCOUNT, email='bad-new@te.st', success=False)) ] def setUp(self): # Start the fake server before launching the application. if (os.environ.get('SSO_AUTH_BASE_URL') == 'fake' and os.environ.get('SSO_UONE_BASE_URL') == 'fake'): self.use_fake_servers() super(RegisterNewU1AccountTestCase, self).setUp() def test_register_new_account(self): "Test that registering a new account pops the main page." new_account = self.main_view.select_single(emulators.NewAccount) new_account.register_new_account(self.email, self.name, self.password, self.password_confirmation, self.agree_to_terms) dummyPage = self.main_view.select_single(objectName="dummyPage") self.assertThat(dummyPage.visible, Eventually(Equals(self.success))) self.assertThat(new_account.is_error_label_visible(), Eventually(Equals(not self.success))) ././@LongLink0000644000000000000000000000016700000000000011607 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/emulators.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000001013512323300075027665 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2013 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . from autopilot import input from ubuntuuitoolkit import emulators as toolkit_emulators class NewAccount(toolkit_emulators.UbuntuUIToolkitEmulatorBase): """New Account Autopilot emulator.""" def is_error_label_visible(self): error_label = self.select_single(objectName='errorLabel') return error_label.visible def log_in(self, email, password): self._fill_log_in(email, password) self._click_continue() def enter_twofactor_code(self, twoFactorCode): two_factor_text_field = self.select_single( TextField, objectName='twoFactorTextField') two_factor_text_field.write(twoFactorCode) self._click_continue() def _fill_log_in(self, email, password): self._enter_email(email) self._enter_login_password(password) def _enter_email(self, email): email_text_field = self.select_single( TextField, objectName='emailTextField') email_text_field.write(email) def _enter_login_password(self, password): password_text_field = self.select_single( TextField, objectName='loginFormPasswordTextField') password_text_field.write(password) def _click_continue(self): continue_button = self.select_single( objectName='continueButton', visible=True) self.pointing_device.click_object(continue_button) def register_new_account(self, email, name, password, password_confirmation, agree_to_terms): self._switch_to_new_account() self._enter_email(email) self._enter_name(name) self._enter_password_new_user(password) self._enter_password_confirmation(password_confirmation) self._agree_to_terms(agree_to_terms) self._click_continue() def _switch_to_new_account(self): new_user_switch = self.select_single( toolkit_emulators.CheckBox, objectName='newUserToggleSwitch') new_user_switch.check() def _enter_name(self, name): name_text_field = self.select_single( TextField, objectName='nameTextField') name_text_field.write(name) def _enter_password_new_user(self, password): password_text_field = self.select_single( TextField, objectName='passwordTextField') password_text_field.write(password) def _enter_password_confirmation(self, password_confirmation): confirm_password_text_field = self.select_single( TextField, objectName='confirmPasswordTextField') confirm_password_text_field.write(password_confirmation) def _agree_to_terms(self, agree): terms_and_conditions_check_box = self.select_single( toolkit_emulators.CheckBox, objectName='termsAndConditionsCheckBox') if agree: terms_and_conditions_check_box.check() else: terms_and_conditions_check_box.uncheck() class TextField(toolkit_emulators.UbuntuUIToolkitEmulatorBase): """TextField Autopilot emulator.""" # TODO change this to use the text field emulator, once it lands on # ubuntu-ui-toolkit. --elopio - 2013-10-08 def __init__(self, *args): super(TextField, self).__init__(*args) self.keyboard = input.Keyboard.create() def write(self, text): """Write into the text field. :parameter text: The text to write. """ self.pointing_device.click_object(self) self.keyboard.type(text) ././@LongLink0000644000000000000000000000017300000000000011604 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/fixture_setup.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000332312323300075027666 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Set up and clean up fixtures for the U1 Online Accounts acceptance tests.""" import logging import threading import fixtures from ubuntuone_credentials import fake_servers logger = logging.getLogger(__name__) class FakeSSOAndU1ServersRunning(fixtures.Fixture): def setUp(self): super(FakeSSOAndU1ServersRunning, self).setUp() self._start_fake_server() def _start_fake_server(self): logger.info('Starting fake SSO and U1 servers.') server_address = ('', 0) fake_server = fake_servers.FakeSSOAndU1Server(server_address) server_thread = threading.Thread(target=fake_server.serve_forever) server_thread.start() logger.info('Serving at port {}.'.format(fake_server.server_port)) self.addCleanup(self._stop_fake_server, server_thread, fake_server) self.url = 'http://localhost:{}'.format(fake_server.server_port) def _stop_fake_server(self, thread, server): logger.info('Stopping fake SSO and U1 servers.') server.shutdown() thread.join() ././@LongLink0000644000000000000000000000017200000000000011603 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/fake_servers.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000001424712323300075027675 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2013-2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import BaseHTTPServer import json import logging import urlparse logger = logging.getLogger(__name__) class FakeSSOAndU1Server(BaseHTTPServer.HTTPServer, object): def __init__(self, server_address): super(FakeSSOAndU1Server, self).__init__( server_address, FakeSSOAndU1RequestHandler) class FakeSSOAndU1RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): SSO_API_PATH = '/api/v2' INVALID_DATA_RESPONSE = { 'message': 'Invalid request data', 'code': 'INVALID_DATA', 'extra': { 'password': ['A real password-specific message would go here.'], 'email': ['A real email-specific message would go here.'] } } LOGIN_OK_RESPONSE = { 'href': 'https://login.ubuntu.com/api/v2/tokens/oauth/the-key', 'token_key': 'token-key', 'token_secret': 'token-secret', 'token_name': 'token-name', 'consumer_key': 'consumer-key', 'consumer_secret': 'consumer-secret', 'date_created': '2013-01-11 12:43:23', 'date_updated': '2013-01-11 12:43:23' } TWOFACTOR_REQUIRED_RESPONSE = { 'code': 'TWOFACTOR_REQUIRED', 'message': 'This account requires 2-factor authentication.', 'extra': {} } TWOFACTOR_ERR_RESPONSE = { 'message': 'The provided 2-factor key is not recognised.', 'code': 'TWOFACTOR_FAILURE', 'extra': {} } LOGIN_ERR_RESPONSE = { 'code': 'INVALID_CREDENTIALS', 'message': "Your email/password isn't correct.", 'extra': {} } REGISTER_CREATED_RESPONSE = { 'status': 'Active', 'openid': 'fFcTeSt', 'verified': False, 'emails': [ { 'href': '/api/v2/emails/new@te.st', 'verified': False } ], 'tokens': [], 'href': '/api/v2/accounts/fFcTeSt', 'displayname': 'Test', 'email': 'new@te.st' } def do_GET(self): """Handle GET as if we were the one.ubuntu.com server.""" parsed_path = urlparse.urlparse(self.path) query_dict = urlparse.parse_qs(parsed_path.query) if parsed_path.path.startswith('/oauth/sso-finished-so-get-tokens/'): self._handle_get_tokens(query_dict) else: self.send_error(404) # real server currently returns 500! def _handle_get_tokens(self, query_dict): for k in ['platform', 'platform_version', 'platform_arch']: if k not in query_dict: logger.debug( '****** MISSING %s IN %s. Bailing.', k, query_dict) self.send_error(401) break else: self.send_response(200) self.end_headers() self.wfile.write("ok 0/0") # fake format of server's real response def do_POST(self): """Handle POST as if we are the login.ubuntu.com server.""" length = int(self.headers['Content-Length']) post_data = self.rfile.read(length) if post_data == '': logger.debug('NOTE: empty post data, just dropping the request.') else: self._handle_post(post_data) def _handle_post(self, post_data): try: body_dict = json.loads(post_data) except ValueError: logger.debug('Error loading json from post data: "%s"', post_data) self.send_error(500) else: self._handle_post_with_json_data(body_dict) def _handle_post_with_json_data(self, body_dict): if self.path == self.SSO_API_PATH + '/tokens/oauth': self._handle_login(body_dict) elif self.path == self.SSO_API_PATH + '/accounts': self._handle_register(body_dict) else: logger.debug('unknown -- self.path is %s', self.path) self.send_error(404, 'unknown') def send_json_reply(self, code, reply_json): self.send_response(code) self.send_header('Content-Type', 'application/json') self.end_headers() self.wfile.write(reply_json) def _handle_login(self, body_dict): if ('email' not in body_dict or 'password' not in body_dict or 'token_name' not in body_dict): self.send_json_reply(400, json.dumps(self.INVALID_DATA_RESPONSE)) else: self._handle_login_with_valid_data(body_dict) def _handle_login_with_valid_data(self, body_dict): email = body_dict['email'] if email in ['ok@te.st', 'new@te.st']: self.send_json_reply(201, json.dumps(self.LOGIN_OK_RESPONSE)) elif email == '2fa@te.st': self._handle_2fa_login(body_dict) else: self.send_json_reply(401, json.dumps(self.LOGIN_ERR_RESPONSE)) def _handle_2fa_login(self, body_dict): if 'otp' not in body_dict: self.send_json_reply( 401, json.dumps(self.TWOFACTOR_REQUIRED_RESPONSE)) elif len(body_dict['otp']) != 6: self.send_json_reply(403, json.dumps(self.TWOFACTOR_ERR_RESPONSE)) else: self.send_json_reply(201, json.dumps(self.LOGIN_OK_RESPONSE)) def _handle_register(self, body_dict): if ('email' not in body_dict or 'password' not in body_dict or 'displayname' not in body_dict or body_dict['email'] == 'bad-new@te.st'): self.send_json_reply(400, json.dumps(self.INVALID_DATA_RESPONSE)) else: self.send_json_reply( 201, json.dumps(self.REGISTER_CREATED_RESPONSE)) ././@LongLink0000644000000000000000000000020300000000000011576 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/test_existing_account.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000403312323300075027665 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2013-2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import os from autopilot.matchers import Eventually from testtools.matchers import Equals import ubuntuone_credentials class ExistingUOAAccountTestCase(ubuntuone_credentials.TestCaseWithQMLWrapper): test_qml_wrapper_file_name = 'TestWrapperExisting.qml' def setUp(self): # Start the fake server before launching the application. if (os.environ.get('SSO_AUTH_BASE_URL') == 'fake' and os.environ.get('SSO_UONE_BASE_URL') == 'fake'): self.use_fake_servers() super(ExistingUOAAccountTestCase, self).setUp() def test_show_remove_account_dialog(self): remove_account_button = self.main_view.select_single( objectName='removeAccountButton') self.pointing_device.click_object(remove_account_button) confirm_button = self.main_view.select_single( objectName='confirmRemoveAccountButton') self.assertThat( confirm_button.visible, Eventually(Equals(True))) cancel_button = self.main_view.select_single( objectName='cancelRemoveAccountButton') self.pointing_device.click_object(cancel_button) def test_shows_expected_email(self): email_list_item = self.main_view.select_single( objectName='emailListItem') self.assertThat( email_list_item.value, Eventually(Equals("my@email.com"))) ././@LongLink0000644000000000000000000000016600000000000011606 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/__init__.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000760612323300075027676 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2013-2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . """UbuntuOne Credentials Online-Accounts provider plugin autopilot tests.""" import os import subprocess import tempfile import fixtures from autopilot import input from autopilot.matchers import Eventually from testtools.matchers import Equals from ubuntuuitoolkit import ( base, emulators as toolkit_emulators, tests as toolkit_tests ) from ubuntuone_credentials import fixture_setup def _get_module_include_path(): return _get_path_to_source_root() def _get_path_to_source_root(): return os.path.abspath( os.path.join( os.path.dirname(__file__), '..', '..', '..')) class TestCaseWithQMLWrapper(base.UbuntuUIToolkitAppTestCase): _DESKTOP_FILE_CONTENTS = ("""[Desktop Entry] Type=Application Exec=Not important Path=Not important Name=Test app Icon=Not important """) test_qml_wrapper_file_name = None def setUp(self): super(TestCaseWithQMLWrapper, self).setUp() self.pointing_device = input.Pointer(self.input_device_class.create()) self.use_qml2_import_path_for_fake_wrapper() self.launch_application() def use_fake_servers(self): fake_sso_and_u1_server = fixture_setup.FakeSSOAndU1ServersRunning() self.useFixture(fake_sso_and_u1_server) self.useFixture(fixtures.EnvironmentVariable( 'SSO_AUTH_BASE_URL', newvalue=fake_sso_and_u1_server.url)) self.useFixture(fixtures.EnvironmentVariable( 'SSO_UONE_BASE_URL', newvalue=fake_sso_and_u1_server.url)) def use_qml2_import_path_for_fake_wrapper(self): arch = subprocess.check_output( ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"]).strip() system_settings_path = ( '/usr/lib/{}/ubuntu-system-settings/private'.format(arch)) qml_credentials_path = os.path.join( _get_path_to_source_root(), 'qml-credentials-service') self.useFixture(fixtures.EnvironmentVariable( 'QML2_IMPORT_PATH', newvalue=':'.join([system_settings_path, qml_credentials_path]))) def launch_application(self): qml_file_path = os.path.join( os.path.dirname(__file__), self.test_qml_wrapper_file_name) desktop_file_path = self._write_test_desktop_file() self.addCleanup(os.remove, desktop_file_path) self.app = self.launch_test_application( base.get_qmlscene_launch_command(), '-I' + _get_module_include_path(), qml_file_path, '--desktop_file_hint={0}'.format(desktop_file_path), emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase, app_type='qt') self.assertThat( self.main_view.visible, Eventually(Equals(True))) def _write_test_desktop_file(self): desktop_file_dir = toolkit_tests.get_local_desktop_file_directory() if not os.path.exists(desktop_file_dir): os.makedirs(desktop_file_dir) desktop_file = tempfile.NamedTemporaryFile( suffix='.desktop', dir=desktop_file_dir, delete=False) desktop_file.write(self._DESKTOP_FILE_CONTENTS) desktop_file.close() return desktop_file.name @property def main_view(self): return self.app.select_single(toolkit_emulators.MainView) ././@LongLink0000644000000000000000000000020200000000000011575 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/TestWrapperExisting.qmlubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000144012323300075027664 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.OnlineAccounts 0.1 import UbuntuOne 1.0 MainView { objectName: "mainView" applicationName: "Ubuntu One UOA Provider Plugin Tester" width: units.gu(100) height: units.gu(100) Page { title: "testing" objectName: "testingPage" Rectangle { id: fakeAccount objectName: "FakeExistingUOAAccount" property var accountId: 47 signal synced property string displayName: "my@email.com" function remove(){ } } Loader { id: loader property var account: fakeAccount anchors.fill: parent source: "../../../Main.qml" } } }././@LongLink0000644000000000000000000000020000000000000011573 Lustar rootrootubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_credentials/test_fixture_setup.pyubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/autopilot/ubuntuone_creden0000644000000000000000000000411012323300075027661 0ustar # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # # Copyright (C) 2014 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import httplib import urlparse import testtools from ubuntuone_credentials import fixture_setup class FakeSSOAndU1ServerRunningTestCase(testtools.TestCase): def setUp(self): super(FakeSSOAndU1ServerRunningTestCase, self).setUp() fake_search_server = fixture_setup.FakeSSOAndU1ServersRunning() self.addCleanup(self.assert_server_not_running) self.useFixture(fake_search_server) self.netloc = urlparse.urlparse(fake_search_server.url).netloc def assert_server_not_running(self): connection = httplib.HTTPConnection(self.netloc) self.assertRaises(Exception, self.do_get_request, connection) def do_get_request(self, connection): connection.request('GET', '/oauth/sso-finished-so-get-tokens/') def do_post_request(self, connection): connection.request('POST', '/api/v2/tokens/oauth', 'dummy body') def test_fake_sso_and_u1_server_must_accept_get_request(self): connection = httplib.HTTPConnection(self.netloc) self.addCleanup(connection.close) self.do_get_request(connection) self.assertEqual(connection.getresponse().status, 401) def test_fake_sso_and_u1_server_must_accept_post_request(self): connection = httplib.HTTPConnection(self.netloc) self.addCleanup(connection.close) self.do_post_request(connection) self.assertEqual(connection.getresponse().status, 500) ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/unit/0000755000000000000000000000000012323300441023332 5ustar ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/unit/utils.js0000644000000000000000000000213112323300075025030 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ .pragma library // Find an object with the given name in the children tree of "obj" function findChild(obj,objectName) { var childs = new Array(0); childs.push(obj) while (childs.length > 0) { if (childs[0].objectName == objectName) { return childs[0] } for (var i in childs[0].children) { childs.push(childs[0].children[i]) } childs.splice(0, 1); } return undefined; } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/unit/tst_newaccount.qml0000644000000000000000000001605612323300075027120 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import Ubuntu.Test 0.1 import Ubuntu.Components 0.1 import "utils.js" as Utils import "../../" Item { // The objects NewAccount { id: newAccount anchors.fill: parent } Rectangle { /* fake to isolate NewAccount from Main */ id: loadingOverlay } TestCase { name: "NewAccountTests" id: testCase property var loginForm property var registerForm property var errorLabel property var emailTextField function init() { newAccount.resetUI(); } function initTestCase() { loginForm = Utils.findChild(newAccount, "loginForm") registerForm = Utils.findChild(newAccount, "registerForm") errorLabel = Utils.findChild(newAccount, "errorLabel") emailTextField = Utils.findChild(newAccount, "emailTextField") } function test_resetUI() { compare(newAccount.currentVisible, loginForm); compare(loginForm.visible, true); compare(errorLabel.visible, false); compare(emailTextField.text, ""); compare(newAccount.state, "login"); var loginForm_pwd = Utils.findChild(loginForm, "loginFormPasswordTextField"); compare(loginForm_pwd.text, ""); compare(loginForm.twoFactorVisible, false); } function test_toggleNewUser() { compare(loginForm.visible, true); compare(registerForm.visible, false); compare(newAccount.state, "login"); newAccount.toggleNewUser(); compare(loginForm.visible, false); compare(registerForm.visible, true); compare(newAccount.state, "register"); } function test_showTwoFactorUI() { compare(loginForm.twoFactorVisible, false); compare(newAccount.state, "login"); newAccount.showTwoFactorUI(); compare(newAccount.state, "twofactor"); compare(loginForm.twoFactorVisible, true); } function test_loginValidateInput_data() { var invalidEmail = "invalid email"; var validEmail = "valid@email.com"; var validPassword = "123456789"; var validTwoFactorCode = "123456"; return [ { shouldShowError: true, tag: "empty input no 2fa", showTwoFactor: false, email: "", password: "", twoFactorCode: ""}, { shouldShowError: true, tag: "empty input, with 2fa visible", showTwoFactor: true, email: "", password: "", twoFactorCode: ""}, { shouldShowError: true, tag: "invalid email", showTwoFactor: false, email: invalidEmail, password: validPassword, twoFactorCode: ""}, { shouldShowError: true, tag: "invalid email with 2fa", showTwoFactor: true, email: invalidEmail, password: validPassword, twoFactorCode: validTwoFactorCode}, { shouldShowError: true, tag: "short pwd", showTwoFactor: false, email: validEmail, password: "123", twoFactorCode: ""}, { shouldShowError: true, tag: "short pwd with 2fa", showTwoFactor: true, email: validEmail, password: "123", twoFactorCode: validTwoFactorCode}, { shouldShowError: false, tag: "OK no 2fa", showTwoFactor: false, email: validEmail, password: validPassword, twoFactorCode: ""}, { shouldShowError: false, tag: "OK with 2fa", showTwoFactor: true, email: validEmail, password: validPassword, twoFactorCode: validTwoFactorCode}, ] } function test_loginValidateInput(data) { newAccount.resetUI(); emailTextField.text = data.email; var passwordTextField = Utils.findChild(loginForm, "loginFormPasswordTextField"); passwordTextField.text = data.password; if(data.showTwoFactor) { newAccount.showTwoFactorUI(); var twoFactorTextField = Utils.findChild(loginForm, "twoFactorTextField"); twoFactorTextField.text = data.twoFactorCode; } newAccount.validateInput(); compare(errorLabel.visible, data.shouldShowError); } function test_registerValidateInput_data() { var invalidEmail = "invalid email"; var validEmail = "valid@email.com"; var invalidName = ""; var validName = "Vlad Name"; var validPassword = "123456789"; return [ { shouldShowError: true, tag: "invalid email", email: "invalid", name: validName, password: validPassword, confirmPassword: validPassword, termsChecked: true}, { shouldShowError: true, tag: "empty name", email: validEmail, name: "", password: validPassword, confirmPassword: validPassword, termsChecked: true}, { shouldShowError: true, tag: "short pwd", email: validEmail, name: validName, password: "123", confirmPassword: "123", termsChecked: true}, { shouldShowError: true, tag: "pwd mismatch", email: validEmail, name: validName, password: validPassword, confirmPassword: "123456789-mismatch", termsChecked: true}, { shouldShowError: true, tag: "termsnotchecked", email: validEmail, name: validName, password: validPassword, confirmPassword: "123456789-mismatch", termsChecked: false}, { shouldShowError: false, tag: "everything OK", email: validEmail, name: validName, password: validPassword, confirmPassword: validPassword, termsChecked: true}, ] } function test_registerValidateInput(data) { newAccount.resetUI(); newAccount.toggleNewUser(); emailTextField.text = data.email; var nameTextField = Utils.findChild(registerForm, "nameTextField"); nameTextField.text = data.name; var passwordTextField = Utils.findChild(registerForm, "passwordTextField"); passwordTextField.text = data.password; var registerForm_confirm_pwd = Utils.findChild(registerForm, "confirmPasswordTextField"); registerForm_confirm_pwd.text = data.confirmPassword; var termsCheckbox = Utils.findChild(registerForm, "termsAndConditionsCheckBox"); termsCheckbox.checked = data.termsChecked; newAccount.validateInput() compare(errorLabel.visible, data.shouldShowError); } } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/tests/CMakeLists.txt0000644000000000000000000000212212323300075025113 0ustar SET (TESTS_TARGET test-online-accounts-provider) set (AUTOPILOT_PACKAGE ubuntuone_credentials) add_custom_target(online-accounts-provider-autopilot-tests COMMAND autopilot run ${AUTOPILOT_PACKAGE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/autopilot DEPENDS ${QML_PLUGIN_NAME} ) add_custom_target(online-accounts-provider-autopilot-tests-local COMMAND SSO_AUTH_BASE_URL=fake SSO_UONE_BASE_URL=fake autopilot run ${AUTOPILOT_PACKAGE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/autopilot DEPENDS ${QML_PLUGIN_NAME} ) add_custom_target(online-accounts-provider-qmlunit-tests COMMAND qmltestrunner -input ${CMAKE_CURRENT_SOURCE_DIR}/unit ) set (Python_ADDITIONAL_VERSIONS 2.7) find_package (PythonInterp) set (AUTOPILOT_DIR autopilot/ubuntuone_credentials) execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print sysconfig.get_python_lib()" COMMAND sed -r -e "s|^/usr/(local/)?||g" OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) install ( DIRECTORY ${AUTOPILOT_DIR} DESTINATION ${PYTHON_PACKAGE_DIR} ) ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/NewAccount.qml0000644000000000000000000002041712323300075024001 0ustar /* * Copyright (C) 2013 Canonical Ltd. * * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import UbuntuOne 1.0 import Ubuntu.OnlineAccounts 0.1 Column { id: main property variant __account: account state: "login" // or "register" or "twofactor" property var currentVisible: loginForm property var formValid: false signal finished anchors.margins: units.gu(1) spacing: units.gu(2) Component.onCompleted: { enableAccount(); __account.sync() resetUI(); } Label { id: title text: "One account to log in to everything on Ubuntu" color: UbuntuColors.coolGrey anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins } Label { id: errorLabel objectName: "errorLabel" text: "" font.bold: true color: "red" visible: false anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins } Label { text: "Please type your email:" anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins } TextField { id: emailTextField objectName: "emailTextField" placeholderText: "Your email" width: main.width - (2 * main.anchors.margins) anchors.left: parent.left anchors.margins: parent.anchors.margins validator: RegExpValidator { regExp: /.+@.+/ } focus: true KeyNavigation.tab: loginForm.visible ? loginForm.passwordTextField : registerForm.nameTextField KeyNavigation.backtab: loginForm.visible ? ( loginForm.twoFactorVisible ? loginForm.twoFactorTextField : loginForm.passwordTextField) : registerForm.confirmPasswordTextField inputMethodHints: Qt.ImhEmailCharactersOnly } Row { spacing: units.gu(2) anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins Switch { id: newUserToggleSwitch objectName: "newUserToggleSwitch" checked: false onCheckedChanged: { toggleNewUser(); } } Label { anchors.verticalCenter: newUserToggleSwitch.verticalCenter text: "I am a new Ubuntu One user" } } // Row LoginForm { id: loginForm objectName: "loginForm" visible: true anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins } RegisterForm { id: registerForm objectName: "registerForm" visible: false anchors.left: parent.left anchors.right: parent.right anchors.margins: parent.anchors.margins } // ------------------------------------------------- UbuntuOneCredentialsService { id: u1credservice onLoginOrRegisterSuccess: { handleSuccess(); } onTwoFactorAuthRequired: { showTwoFactorUI(); } onLoginOrRegisterError: { if (errorMessage == "Invalid request data") { errorMessage = "Please enter a valid email address."; } showError(errorMessage); } } function resetUI() { errorLabel.visible = false; errorLabel.text = ""; emailTextField.text = ""; loginForm.resetUI() registerForm.resetUI(); newUserToggleSwitch.checked = false; state = "login"; switchTo(loginForm); formValid = false; emailTextField.forceActiveFocus(); } function showError(message) { errorLabel.text = message; errorLabel.visible = true; loadingOverlay.visible = false; } function switchTo(newVisible) { currentVisible.visible = false; newVisible.visible = true; currentVisible = newVisible; } function toggleNewUser() { if(state == "login" || state == "twofactor") { switchTo(registerForm) state = "register"; registerForm.nameTextField.focus = true; } else if(state == "register") { switchTo(loginForm) state = "login"; loginForm.passwordTextField.focus = true; } else { console.debug("unexpected state" + state + "in toggleNewUser"); } } function userCancelled() { console.debug("Removing account ID: " + account.accountId); account.removed.connect(finished); account.remove(Account.RemoveCredentials); resetUI(); } /* processForm uses a timer to delay calling u1credservice, which can take a while, to ensure that the loadingOverlay is shown immediately. */ function processForm() { Qt.inputMethod.hide(); loadingOverlay.visible = true; formSubmitTimer.running = true; } Timer { id: formSubmitTimer; interval: 0; onTriggered: submitFormFromTimer(); } function submitFormFromTimer() { validateInput(); if (!formValid) { loadingOverlay.visible = false; return; } if(state == "login") { var password = loginForm.password; u1credservice.login(emailTextField.text, password); } else if(state == "register") { var password = registerForm.password; var display_name = registerForm.display_name; u1credservice.registerUser(emailTextField.text, password, display_name); } else if(state == "twofactor") { u1credservice.login(emailTextField.text, loginForm.password, loginForm.twoFactorCode); } } function handleSuccess() { loadingOverlay.visible = false; errorLabel.visible = false; account.updateDisplayName(emailTextField.text); account.updateEnabled(true); account.synced.connect(main.finished); account.sync(); resetUI(); } function showTwoFactorUI() { loadingOverlay.visible = false; if(state != "login") { console.log("Error: did not expect two factor request from register"); showError("An internal error occurred. Please try again later."); return; } errorLabel.visible = false; state = "twofactor"; loginForm.twoFactorVisible = true; loginForm.twoFactorTextField.focus = true; formValid = false; } function validateInput() { formValid = emailTextField.acceptableInput; if(!formValid) { showError("Please enter a valid email address."); return; } if(state == "login" || state == "twofactor") { formValid &= loginForm.validateInput(); } else { formValid &= registerForm.validateInput(); } if(formValid) { errorLabel.visible = false; } } Component { id: accountServiceComponent AccountService { autoSync: false } } AccountServiceModel { id: accountServices includeDisabled: true account: __account.objectHandle } function enableAccount() { for (var i = 0; i < accountServices.count; i++) { var accountServiceHandle = accountServices.get(i, "accountService") var accountService = accountServiceComponent.createObject(null, { "objectHandle": accountServiceHandle }) accountService.updateServiceEnabled(true) accountService.destroy(1000) } } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/ButtonRow.qml0000644000000000000000000000123412323300075023672 0ustar import QtQuick 2.0 import Ubuntu.Components 0.1 Row { id: buttons height: units.gu(5) spacing: units.gu(1) Button { id: btnCancel objectName: "cancelButton" text: "Cancel" color: "#1c091a" height: parent.height width: (parent.width / 2) - 0.5 * parent.spacing onClicked: { userCancelled(); } } Button { id: btnContinue objectName: "continueButton" text: "Continue" color: "#cc3300" height: parent.height width: (parent.width / 2) - 0.5 * parent.spacing onClicked: { processForm(); } } } ubuntuone-credentials-14.04+14.04.20140415/online-accounts-provider/CMakeLists.txt0000644000000000000000000000042012323300075023750 0ustar file (GLOB QML_PLUGIN_FILES *.qml) # The path (including plug-in name) where the QML files are installed set (QML_PLUGIN_INSTALL_DIR share/accounts/qml-plugins/ubuntuone/) install (FILES ${QML_PLUGIN_FILES} DESTINATION ${QML_PLUGIN_INSTALL_DIR}) add_subdirectory(tests)ubuntuone-credentials-14.04+14.04.20140415/CMakeLists.txt0000644000000000000000000000466212323300075017033 0ustar cmake_minimum_required (VERSION 2.8.9) # This is the name and release version of the project PROJECT (ubuntuone-credentials) SET (PROJECT_VERSION 14.04) # Some variables for the library builds SET (AUTH_LIB_VERSION 0.1.0) SET (AUTH_LIB_SOVERSION 0) SET (AUTH_LIB_API_VERSION 2.0) SET (AUTH_LIB_UNVERSIONED ubuntuoneauth) SET (AUTH_LIB_NAME ${AUTH_LIB_UNVERSIONED}-${AUTH_LIB_API_VERSION}) # these names are used in qml-credentials-service/qmldir.template SET (QML_MODULE_NAME UbuntuOne) SET (QML_PLUGIN_API_VERSION 1.0) SET (QML_PLUGIN_NAME UbuntuOneCredentialsPlugin-${QML_PLUGIN_API_VERSION}) # For the signon plug-in module SET (SIGNON_PLUGIN_NAME ubuntuoneplugin) # Need to get libsignon/accounts here, as they get exposed in headers find_package (PkgConfig REQUIRED) pkg_check_modules(LIBSIGNON REQUIRED libsignon-qt5 accounts-qt5) add_definitions(${LIBSIGNON_CFLAGS} ${LIBSIGNON_CFLAGS_OTHER}) # Some default CFLAGS SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -Wall -Werror -fPIC") SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -O2 -g -Wall -Werror -fPIC") # Allow specifying the libdir to use for the C library SET (LIB_SUFFIX "" CACHE STRING "Define suffix of library directory name.") SET (LIB_INSTALL_DIR "lib${LIB_SUFFIX}") set (QML_MODULE_INSTALL_DIR ${LIB_INSTALL_DIR}/qt5/qml ) include_directories(${CMAKE_SOURCE_DIR}/libubuntuoneauth) # A rule and variables for creating a tarball distribution SET (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) SET (ARCHIVE_FILE ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2) SET (ARCHIVE_ARGS --exclude-vcs --exclude-backups --exclude-from=${CMAKE_SOURCE_DIR}/.bzrignore --transform=\"s,^,${ARCHIVE_NAME}/,\") add_custom_target(dist COMMAND tar -cvjf ${ARCHIVE_FILE} ${ARCHIVE_ARGS} * WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_subdirectory(data) add_subdirectory(libubuntuoneauth) add_subdirectory(signon-plugin) add_subdirectory(qml-credentials-service) add_subdirectory(online-accounts-provider) # We need to add these here which simply depend on other test rules, as # CMake doesn't allow defining a "check" rule in multiple places. # We use $namespace-tests[-valgrind[-leaks]] for the test names in subdirs, # and depend on them here, so that 'make check' will run them all. add_custom_target(check DEPENDS ubuntuoneauth-tests ) add_custom_target(check-valgrind DEPENDS ubuntuoneauth-tests-valgrind ) add_custom_target(check-valgrind-leaks DEPENDS ubuntuoneauth-tests-valgrind-leaks ) ubuntuone-credentials-14.04+14.04.20140415/debian/0000755000000000000000000000000012323300441015502 5ustar ubuntuone-credentials-14.04+14.04.20140415/debian/source/0000755000000000000000000000000012323300441017002 5ustar ubuntuone-credentials-14.04+14.04.20140415/debian/source/format0000644000000000000000000000001612323300075020215 0ustar 3.0 (native) ubuntuone-credentials-14.04+14.04.20140415/debian/libubuntuoneauth-2.0-dev.install0000644000000000000000000000015112323300075023540 0ustar usr/include/ubuntuoneauth-2.0 usr/lib/*/libubuntuoneauth-2.0.so usr/lib/*/pkgconfig/ubuntuoneauth-2.0.pc ubuntuone-credentials-14.04+14.04.20140415/debian/tests/0000755000000000000000000000000012323300441016644 5ustar ubuntuone-credentials-14.04+14.04.20140415/debian/tests/run-tests0000755000000000000000000000061012323300075020536 0ustar #!/bin/sh set -ex # Do nothing here. We don't need to run the tests multiple times, and they # are already being run during the build phase of the autopkgtest, as we # require a built tree to run them, and the tests are run as part of the # normal package build process. We do want to test that things install, though # and at least one test is actually required, for autopkgtest to work. ubuntuone-credentials-14.04+14.04.20140415/debian/tests/control0000644000000000000000000000031712323300075020253 0ustar Tests: run-tests Restrictions: rw-build-tree build-needed allow-stderr Depends: @, cmake, liboauth-dev, libsecret-1-dev, qtbase5-dev, qtdeclarative5-dev, qtdeclarative5-ubuntu-ui-toolkit-plugin, xvfb ubuntuone-credentials-14.04+14.04.20140415/debian/signon-plugin-ubuntuone.install0000644000000000000000000000002412323300075023704 0ustar usr/lib/signon/*.so ubuntuone-credentials-14.04+14.04.20140415/debian/copyright0000644000000000000000000000460312323300075017443 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Files: * Copyright: 2013 Canonical Ltd. License: LGPL-3 This program 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; version 3. . This program 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . The full text of the LGPL v3 is distributed in /usr/share/common-licenses/LGPL-3 on Debian systems. Files: online-accounts-provider/* Copyright: 2013 Canonical Ltd. License: GPL-3 with OpenSSL Exception This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . . On Debian systems, the complete text of the GNU General Public License version 3, can be found in `/usr/share/common-licenses/GPL-3'. . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. ubuntuone-credentials-14.04+14.04.20140415/debian/libubuntuoneauth-2.0-0.install0000644000000000000000000000004512323300075023123 0ustar usr/lib/*/libubuntuoneauth-2.0.so.0* ubuntuone-credentials-14.04+14.04.20140415/debian/libubuntuoneauth-2.0-0.symbols0000644000000000000000000003206612323300112023145 0ustar libubuntuoneauth-2.0.so.0 libubuntuoneauth-2.0-0 #MINVER# (c++)"UbuntuOne::AuthLogger::logMessage(QtMsgType, QMessageLogContext const&, QString const&)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::qt_metacall(QMetaObject::Call, int, void**)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::qt_metacast(char const*)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::setLogLevel(QtMsgType)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::stopLogging()@Base" 13.08 (c++)"UbuntuOne::AuthLogger::setupLogging(QString)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::getLogDirectory()@Base" 13.08 (c++)"UbuntuOne::AuthLogger::staticMetaObject@Base" 13.08 (c++)"UbuntuOne::AuthLogger::getMessageTypeString(QtMsgType)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::AuthLogger(QString)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::AuthLogger(QString)@Base" 13.08 (c++)"UbuntuOne::AuthLogger::~AuthLogger()@Base" 13.08 (c++)"UbuntuOne::AuthLogger::~AuthLogger()@Base" 13.08 (c++)"UbuntuOne::AuthLogger::~AuthLogger()@Base" 13.08 (c++)"UbuntuOne::SSOService::qt_metacall(QMetaObject::Call, int, void**)@Base" 13.08 (c++)"UbuntuOne::SSOService::qt_metacast(char const*)@Base" 13.08 (c++)"UbuntuOne::SSOService::registerUser(QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::SSOService::accountPinged(QNetworkReply*)@Base" 13.08 (c++)"UbuntuOne::SSOService::errorOccurred(UbuntuOne::ErrorResponse const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::requestFailed(UbuntuOne::ErrorResponse const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::tokenReceived(UbuntuOne::OAuthTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::getAuthBaseUrl()@Base" 13.08 (c++)"UbuntuOne::SSOService::getCredentials()@Base" 13.08 (c++)"UbuntuOne::SSOService::getUOneBaseUrl()@Base" 13.08 (c++)"UbuntuOne::SSOService::credentialsFound(UbuntuOne::Token const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::staticMetaObject@Base" 13.08 (c++)"UbuntuOne::SSOService::accountRegistered(UbuntuOne::AccountResponse const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::credentialsStored()@Base" 13.08 (c++)"UbuntuOne::SSOService::handleTokenStored()@Base" 13.08 (c++)"UbuntuOne::SSOService::credentialsDeleted()@Base" 13.08 (c++)"UbuntuOne::SSOService::credentialsNotFound()@Base" 13.08 (c++)"UbuntuOne::SSOService::invalidateCredentials()@Base" 13.08 (c++)"UbuntuOne::SSOService::twoFactorAuthRequired()@Base" 13.08 (c++)"UbuntuOne::SSOService::handleCredentialsFound(UbuntuOne::Token const&)@Base" 13.08 (c++)"UbuntuOne::SSOService::handleCredentialsNotFound()@Base" 13.08 (c++)"UbuntuOne::SSOService::handleTwoFactorAuthRequired()@Base" 13.08 (c++)"UbuntuOne::SSOService::login(QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::SSOService::SSOService(QObject*)@Base" 13.08 (c++)"UbuntuOne::SSOService::SSOService(QObject*)@Base" 13.08 (c++)"UbuntuOne::SSOService::~SSOService()@Base" 13.08 (c++)"UbuntuOne::SSOService::~SSOService()@Base" 13.08 (c++)"UbuntuOne::SSOService::~SSOService()@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::initializeMap()@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::code(QString)@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::ErrorResponse(int const&, QString const&, QString const&, QString const&)@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::ErrorResponse()@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::ErrorResponse(int const&, QString const&, QString const&, QString const&)@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::ErrorResponse()@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::~ErrorResponse()@Base" 13.08 (c++)"UbuntuOne::ErrorResponse::~ErrorResponse()@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest(QString, QString, QString, QString, QString, QString, bool)@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest(QString, QString, QString, QString, QString, bool)@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest()@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest(QString, QString, QString, QString, QString, QString, bool)@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest(QString, QString, QString, QString, QString, bool)@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest()@Base" 13.08 (c++)"UbuntuOne::AccountRequest::~AccountRequest()@Base" 13.08 (c++)"UbuntuOne::AccountRequest::~AccountRequest()@Base" 13.08 (c++)"UbuntuOne::AccountResponse::AccountResponse()@Base" 13.08 (c++)"UbuntuOne::AccountResponse::AccountResponse()@Base" 13.08 (c++)"UbuntuOne::AccountResponse::~AccountResponse()@Base" 13.08 (c++)"UbuntuOne::AccountResponse::~AccountResponse()@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::qt_metacall(QMetaObject::Call, int, void**)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::qt_metacast(char const*)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::CreateAccount(UbuntuOne::AccountRequest const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::ErrorOccurred(UbuntuOne::ErrorResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::GetOAuthToken(UbuntuOne::OAuthTokenRequest const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::AccountGranted(UbuntuOne::AccountResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::OnErrorOccurred(UbuntuOne::ErrorResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::GetPasswordToken(UbuntuOne::PasswordTokenRequest const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::OnAccountGranted(UbuntuOne::AccountResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::staticMetaObject@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::OAuthTokenGranted(UbuntuOne::OAuthTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::OnOAuthTokenGranted(UbuntuOne::OAuthTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::PasswordTokenGranted(UbuntuOne::PasswordTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::TwoFactorAuthRequired()@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::OnPasswordTokenGranted(UbuntuOne::PasswordTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::IdentityProvider(QObject*)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::IdentityProvider(QObject*)@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::~IdentityProvider()@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::~IdentityProvider()@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::~IdentityProvider()@Base" 13.08 (c++)"UbuntuOne::RequestInterface::RequestInterface(QUrl const&)@Base" 13.08 (c++)"UbuntuOne::RequestInterface::RequestInterface(QUrl const&)@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest(QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest(QString, QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest(QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest(QString, QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::OAuthTokenRequest()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::~OAuthTokenRequest()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::~OAuthTokenRequest()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenResponse::OAuthTokenResponse()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenResponse::OAuthTokenResponse()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenResponse::~OAuthTokenResponse()@Base" 13.08 (c++)"UbuntuOne::OAuthTokenResponse::~OAuthTokenResponse()@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest(QString)@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest(QString, QString)@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest()@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest(QString)@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest(QString, QString)@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::PasswordTokenRequest()@Base" 13.08 (c++)"UbuntuOne::PasswordTokenResponse::PasswordTokenResponse()@Base" 13.08 (c++)"UbuntuOne::PasswordTokenResponse::PasswordTokenResponse()@Base" 13.08 (c++)"UbuntuOne::Token::buildTokenName()@Base" 13.08 (c++)"UbuntuOne::Token::toQuery()@Base" 13.08 (c++)"UbuntuOne::Token::fromQuery(QString)@Base" 13.08 (c++)"UbuntuOne::Token::Token(QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::Token::Token(QString, QString, QString, QString)@Base" 13.08 (c++)"UbuntuOne::Token::~Token()@Base" 13.08 (c++)"UbuntuOne::Token::~Token()@Base" 13.08 (c++)"UbuntuOne::Keyring::storeToken(UbuntuOne::Token)@Base" 13.08 (c++)"UbuntuOne::Keyring::tokenFound(UbuntuOne::Token const&)@Base" 13.08 (c++)"UbuntuOne::Keyring::deleteToken()@Base" 13.08 (c++)"UbuntuOne::Keyring::handleError(SignOn::Error const&)@Base" 13.08 (c++)"UbuntuOne::Keyring::qt_metacall(QMetaObject::Call, int, void**)@Base" 13.08 (c++)"UbuntuOne::Keyring::qt_metacast(char const*)@Base" 13.08 (c++)"UbuntuOne::Keyring::tokenStored()@Base" 13.08 (c++)"UbuntuOne::Keyring::keyringError(QString)@Base" 13.08 (c++)"UbuntuOne::Keyring::tokenDeleted()@Base" 13.08 (c++)"UbuntuOne::Keyring::tokenNotFound()@Base" 13.08 (c++)"UbuntuOne::Keyring::staticMetaObject@Base" 13.08 (c++)"UbuntuOne::Keyring::handleSessionData(SignOn::SessionData const&)@Base" 13.08 (c++)"UbuntuOne::Keyring::handleAccountRemoved()@Base" 13.08 (c++)"UbuntuOne::Keyring::handleCredentialsStored(unsigned int)@Base" 13.08 (c++)"UbuntuOne::Keyring::findToken()@Base" 13.08 (c++)"UbuntuOne::Keyring::Keyring(QObject*)@Base" 13.08 (c++)"UbuntuOne::Keyring::Keyring(QObject*)@Base" 13.08 (c++)"UbuntuOne::Keyring::~Keyring()@Base" 13.08 (c++)"UbuntuOne::Keyring::~Keyring()@Base" 13.08 (c++)"UbuntuOne::Keyring::~Keyring()@Base" 13.08 (c++)"UbuntuOne::Network::qt_metacall(QMetaObject::Call, int, void**)@Base" 13.08 (c++)"UbuntuOne::Network::qt_metacast(char const*)@Base" 13.08 (c++)"UbuntuOne::Network::ErrorOccurred(UbuntuOne::ErrorResponse const&)@Base" 13.08 (c++)"UbuntuOne::Network::AccountGranted(UbuntuOne::AccountResponse const&)@Base" 13.08 (c++)"UbuntuOne::Network::staticMetaObject@Base" 13.08 (c++)"UbuntuOne::Network::OAuthTokenGranted(UbuntuOne::OAuthTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::Network::PasswordTokenGranted(UbuntuOne::PasswordTokenResponse const&)@Base" 13.08 (c++)"UbuntuOne::Network::ProcessAccountsReply(QJsonObject const&)@Base" 13.08 (c++)"UbuntuOne::Network::ProcessOAuthTokenReply(QJsonObject const&)@Base" 13.08 (c++)"UbuntuOne::Network::ProcessPasswordTokenReply(QJsonObject const&)@Base" 13.08 (c++)"UbuntuOne::Network::OnReply(QNetworkReply*)@Base" 13.08 (c++)"UbuntuOne::Network::Network(QObject*)@Base" 13.08 (c++)"UbuntuOne::Network::Network(QObject*)@Base" 13.08 (c++)"UbuntuOne::Network::~Network()@Base" 13.08 (c++)"UbuntuOne::Network::~Network()@Base" 13.08 (c++)"UbuntuOne::Network::~Network()@Base" 13.08 (c++)"UbuntuOne::AuthLogger::metaObject() const@Base" 13.08 (c++)"UbuntuOne::SSOService::metaObject() const@Base" 13.08 (c++)"UbuntuOne::AccountRequest::serialize() const@Base" 13.08 (c++)"UbuntuOne::IdentityProvider::metaObject() const@Base" 13.08 (c++)"UbuntuOne::OAuthTokenRequest::serialize() const@Base" 13.08 (c++)"UbuntuOne::PasswordTokenRequest::serialize() const@Base" 13.08 (c++)"UbuntuOne::Token::isValid() const@Base" 13.08 (c++)"UbuntuOne::Token::signUrl(QString, QString, bool) const@Base" 13.08 (c++)"UbuntuOne::Keyring::metaObject() const@Base" 13.08 (c++)"UbuntuOne::Network::metaObject() const@Base" 13.08 (c++)"typeinfo for UbuntuOne::AuthLogger@Base" 13.08 (c++)"typeinfo for UbuntuOne::SSOService@Base" 13.08 (c++)"typeinfo for UbuntuOne::AccountRequest@Base" 13.08 (c++)"typeinfo for UbuntuOne::IdentityProvider@Base" 13.08 (c++)"typeinfo for UbuntuOne::RequestInterface@Base" 13.08 (c++)"typeinfo for UbuntuOne::OAuthTokenRequest@Base" 13.08 (c++)"typeinfo for UbuntuOne::PasswordTokenRequest@Base" 13.08 (c++)"typeinfo for UbuntuOne::Keyring@Base" 13.08 (c++)"typeinfo for UbuntuOne::Network@Base" 13.08 (c++)"typeinfo name for UbuntuOne::AuthLogger@Base" 13.08 (c++)"typeinfo name for UbuntuOne::SSOService@Base" 13.08 (c++)"typeinfo name for UbuntuOne::AccountRequest@Base" 13.08 (c++)"typeinfo name for UbuntuOne::IdentityProvider@Base" 13.08 (c++)"typeinfo name for UbuntuOne::RequestInterface@Base" 13.08 (c++)"typeinfo name for UbuntuOne::OAuthTokenRequest@Base" 13.08 (c++)"typeinfo name for UbuntuOne::PasswordTokenRequest@Base" 13.08 (c++)"typeinfo name for UbuntuOne::Keyring@Base" 13.08 (c++)"typeinfo name for UbuntuOne::Network@Base" 13.08 (c++)"vtable for UbuntuOne::AuthLogger@Base" 13.08 (c++)"vtable for UbuntuOne::SSOService@Base" 13.08 (c++)"vtable for UbuntuOne::AccountRequest@Base" 13.08 (c++)"vtable for UbuntuOne::IdentityProvider@Base" 13.08 (c++)"vtable for UbuntuOne::RequestInterface@Base" 13.08 (c++)"vtable for UbuntuOne::OAuthTokenRequest@Base" 13.08 (c++)"vtable for UbuntuOne::PasswordTokenRequest@Base" 13.08 (c++)"vtable for UbuntuOne::Keyring@Base" 13.08 (c++)"vtable for UbuntuOne::Network@Base" 13.08 (c++)"UbuntuOne::AccountRequest::AccountRequest(QString, QString, QString, QString)@Base" 13.09 (c++)"UbuntuOne::AuthLogger::setupLogging()@Base" 14.04+14.04.20131127 (c++)"UbuntuOne::AuthLogger::AuthLogger(QObject*)@Base" 14.04+14.04.20131127 ubuntuone-credentials-14.04+14.04.20140415/debian/ubuntuone-credentials-autopilot.install0000644000000000000000000000006112323300075025427 0ustar usr/lib/python*/*-packages/ubuntuone_credentials ubuntuone-credentials-14.04+14.04.20140415/debian/compat0000644000000000000000000000000212323300075016703 0ustar 9 ubuntuone-credentials-14.04+14.04.20140415/debian/ubuntuone-credentials-common.install0000644000000000000000000000013212323300075024676 0ustar usr/share/accounts/providers usr/share/accounts/service_types usr/share/accounts/services ubuntuone-credentials-14.04+14.04.20140415/debian/qtdeclarative5-ubuntuone1.0.install0000644000000000000000000000003412323300075024250 0ustar usr/lib/*/qt5/qml/UbuntuOne ubuntuone-credentials-14.04+14.04.20140415/debian/changelog0000644000000000000000000002703412323300113017356 0ustar ubuntuone-credentials (14.04+14.04.20140415) trusty; urgency=low [ Alejandro J. Cura ] * Do not create the session when the account is disabled (LP: #1307608) -- Ubuntu daily release Tue, 15 Apr 2014 18:54:03 +0000 ubuntuone-credentials (14.04+14.04.20140306ubuntu2) trusty; urgency=medium * debian/control: alternatively depend on the OpenGLES version of qtdeclarative5-ubuntu-ui-toolkit-plugin -- Ricardo Salveti de Araujo Mon, 14 Apr 2014 17:40:47 -0300 ubuntuone-credentials (14.04+14.04.20140306ubuntu1) trusty; urgency=medium * Make ubuntuone-credentials-common Architecture: all and Multi-Arch: foreign. This allows cross-building of ubuntuone-credentials' reverse dependencies. -- Iain Lane Wed, 02 Apr 2014 11:52:43 +0100 ubuntuone-credentials (14.04+14.04.20140306) trusty; urgency=low [ Diego Sarmentero ] * adding files * ssolib files * adding license * SSO Lib working * new folder structure * updating .pro * Fixing some design issues. * Improve Error handling in the application as requested by design. * Support urls in the --picture argument, to handle download of the image from this application. * Fix UI flow requested by design for Returning Customers. [ Leo Arias ] * Cleaned the autopilot tests. * Refactor the fake servers to be a thread on the same process, started from a fixture on the test setup. * Added missing files from previous autopilot fixtures MP. . [ Ubuntu daily release ] * New rebuild forced [ CI bot ] * No change rebuild against Qt 5.2.1. [ Brian Curtin ] * Update the tests.pro file to work with changes to how the library is built. * Add more tests. [ Michael McCracken ] * Simplify header layout to avoid issues in packaging. (LP: #1190782). (LP: #1190782) * Improvements to available slots and signals on ssoservice object. * Fixes for registration * mark two methods of Token as const, and fix a leak from oauth library. * Add QML plugin that wraps login/register and signUrl functionality of libubuntuoneauth, and accompanying QML UI prototype * Add support for two-factor auth to the ssoservice and QML plugin (LP: #1197081). (LP: #1197081) * Add error signal for failure cases in Network class - covers connection failures. * Improve UI, better support embedding into external QML, and add embedding example code. * Fix credential deletion and expose it via QML plugin. * Validate input and show error messages for invalid email, short password, etc. * add cmake rule to generate qmltypes file for qtcreator integration. * Make background of embeddable component transparent, and use smaller font sizes to fit better on small screens. * Fix typo in signal connection for handleError. * set signon plugin name to 'ubuntuoneplugin' as required by the signond plugin loader. * Ensure initial value of _state variable is IDLE. * Add UOA provider plug-in to house login/register UI. Move that UI from credentials service plug-in. * Fix example code for QML plugin to no longer try to show the CredentialsUI that doesn't exist anymore, and improve its comments to better explain the remaining API. * Re-add a regexp validator to the email textfield. * Add minimal Qt/C++ example app and README describing how to use libubuntuoneauth to access creds and sign API requests. * Add cancel/continue buttons back. * Fix spacing and margins of login/register UI. Use default fontSizes pending design input. * Provide faster visual feedback of activity after clicking 'continue'. * Fix flickable scrolling. Fix sizing of nested Columns in LoginForm and RegisterForm, and use correct anchors. * Improve integration with Online Accounts System settings module. * Fix registration errors caused by scrambling parameters due to undefined behavior in C++. * Fix key focus handling. . * Do not leave an empty UOA account in the DB if the user clicks cancel. * Properly handle switching to the register screen after logging in partially with a 2fa account. * Add GUI-level autopilot functional test suite to online-accounts- provider. * Delete incomplete account when user uses back button to cancel account creation. (LP: #1234285). (LP: #1234285) * Provide general user-friendly error message for network errors. (LP: #1233951). (LP: #1233951) * Use email-specific keyboard layout and avoid storing passwords in predictive input dictionary (LP: #1235282). (LP: #1235282) * Hide keyboard when user submits form, making error message visible. (LP: #1231580). (LP: #1231580) * Give the two-factor text field focus when shown. * Fix behavior of back button on existing account detail page (LP: #1237006). (LP: #1237006) * Add initial suite of QML unit tests for online-accounts-provider. * Improve logged warnings about token creation errors and JSON parsing (LP: #1241250, LP: #1241259). (LP: #1241250, #1241259) * Add local mock test server and make autopilot tests hit the server. * Improve form validation for account registration. Warn about T&C checkbox only after all other fields are filled in. * Add autopilot tests of registering new u1 account. * Cleanup an apparent pythonism - avoid use of 'this->' to refer to an unshadowed member variable or function. * Remove more superfluous uses of this. [ Alberto Mardegan ] * Declare that no more than one U1 account should be created [ Rodney Dawes ] * Remove the app directory and files as we don't need them. Remove the generated Makefile as we shouldn't store it in VCS. Remove the useless main.cpp. Add COPYING and COPYING.LESSER for LGPL v3. Rename lib/core to lib/main to prevent make clean failure. * Update the license headers in source files to be correct LGPL. * Convert the build system to use a global qmake project. Add the rpath for the lib dir to the tests.pro, for running tests. * Switch to cmake. Enable -Werror and fix the few existing compiler warnings. Ignore all the new extra generated files. Rename the library and test program to be more accurate. * Merge in the ubuntuone-music-login app code. * Move lib to libubuntuoneauth and tests to libubuntuoneauth/tests. Create the libubuntuoneauthui and libubuntuoneauthui/tests directories for the UI library. * Add more tests. * Use the correct 'Ubuntu One' for the TOKEN_NAME constant. * Store the token information correctly in the keyring. Make token creation and keyring usage compatible with ubuntu-sso-client. * A new class for registering a log handler singleton. Use the new log handler for logging. * Clean up usage of debug/warning messages to avoid logging private data. * Refactor the keyring code and some usage of it, to be much simpler. * Add necessary support to sign the purchase URL before opening. Use the correct attribute name for the token, for ubuntu-sso-client compat. * Implement support for the ping URL on Ubuntu One to make account usable. * Bump trunk version for development. * Work around a bug in liboauth to escape '+' in url path properly. Fix qCritical() usage when account pinging fails. * Only export the UbuntuOne namespace symbols in the shared library. * Add ctors for network requests to use the SSO_AUTH_BASE_URL value. Change usage of SSO_*_BASE_URL values to not require ending /. Restructure API URL constants to separate path from base URL. * Always print critical/fatal messages to stderr. When debug is enabled, also print debug messages to stderr. * Add the beginnings of a signon plugin for u1. * Fix a missing prefix in the substvar in the qmldir that broke importing. * Switch from using using the keyring, to storing tokens in online- accounts. Add necessary data files for online-accounts storage. * Add UOA provider plug-in to house login/register UI. Move that UI from credentials service plug-in. * Fix a think-o in the qml-plugins install path. * Get rid of the UI library pieces that we never used, and don't need now. * Add a pkgconfig file for using libubuntuoneauth in other projects. * Pull in the packaging for moving to daily-release. Revert to a sensible version for use under daily-release. * Clean up packaging a little. * Remove the music-login app as we don't use it and aren't going to. * Deprecate the API for logging to a file in AuthLogger. Do not log to a file in the logging API. (LP: #1175289) * Package the autopilot tests. -- Ubuntu daily release Thu, 06 Mar 2014 08:04:13 +0000 ubuntuone-credentials (14.04+14.04.20131127) trusty; urgency=low * Automatic snapshot from revision 80 (bootstrap) -- Rodney Dawes Wed, 27 Nov 2013 13:14:17 -0500 ubuntuone-credentials (13.10-0ubuntu5) trusty; urgency=low * debian/libubuntuoneauth-2.0-dev.install: - Include the new pkg-config file. * debian/patches/03_lp1253116.patch: - Add a pkg-config file. (LP: #1253116) -- Rodney Dawes Mon, 25 Nov 2013 10:13:20 -0500 ubuntuone-credentials (13.10-0ubuntu4) trusty; urgency=low * debian/control: - Use the correct dependencies for libubuntuoneauth-2.0-dev. (LP: #1253192) -- Rodney Dawes Fri, 22 Nov 2013 10:44:26 -0500 ubuntuone-credentials (13.10-0ubuntu3) saucy-proposed; urgency=low * debian/patches/02_lp1234282.patch - Don't allow adding multiple U1 accounts (LP: #1234282) -- Ken VanDine Wed, 16 Oct 2013 10:36:15 -0400 ubuntuone-credentials (13.10-0ubuntu2) saucy; urgency=low * debian/patches/00_lp1237006.patch: - Fix behavior of back button on account details page. (LP: #1237006) * debian/patches/01_lp1234883.patch: - Give the two-factor text field focus when shown. (LP: #1234883) -- Rodney Dawes Fri, 11 Oct 2013 11:25:18 -0400 ubuntuone-credentials (13.10-0ubuntu1) saucy; urgency=low * New upstream release. - Close the osk when continue button clicked. (LP: #1231580) - Improve generic network error messages. (LP: #1233951) - Avoid partial account creation when toolbar back used. (LP: #1234285) - Use text entry hints for better osk integration. (LP: #1235282) * debian/rules: - Set DEB_HOST_MULTIARCH if unset, to avoid breaking autopkgtests. -- Rodney Dawes Fri, 04 Oct 2013 17:08:19 -0400 ubuntuone-credentials (13.09-0ubuntu1) saucy; urgency=low * New upstream release. * debian/libubuntuoneauth-2.0-0.symbols: - Update with new symbols. * debian/rules: - Remove the auto install override as it is no longer needed. * debian/watch: - Only use .bz2 as an extension in the regular expression. -- Rodney Dawes Mon, 16 Sep 2013 17:45:41 -0400 ubuntuone-credentials (13.08-0ubuntu3) saucy; urgency=low * debin/tests/run-tests: - Don't try to run the tests a second time. Tests are run by requiring a built tree for autopkgtest already, so rely on that. -- Rodney Dawes Mon, 16 Sep 2013 14:53:04 -0400 ubuntuone-credentials (13.08-0ubuntu2) saucy; urgency=low * debian/control: - Add signon-plugin-password as dependency of libubuntuoneauth-2.0-0. -- Rodney Dawes Wed, 11 Sep 2013 21:53:26 -0400 ubuntuone-credentials (13.08-0ubuntu1) saucy; urgency=low * Initial packaging for ubuntuone-credentials. (LP: #1199017) -- Rodney Dawes Thu, 29 Aug 2013 09:37:25 -0400 ubuntuone-credentials-14.04+14.04.20140415/debian/account-plugin-ubuntuone.install0000644000000000000000000000005112323300075024043 0ustar usr/share/accounts/qml-plugins/ubuntuone ubuntuone-credentials-14.04+14.04.20140415/debian/rules0000755000000000000000000000104712323300075016567 0ustar #!/usr/bin/make -f export DPKG_GENSYMBOLS_CHECK_LEVEL=4 DH_CMAKE_BUILD_DIR=obj-${DEB_BUILD_GNU_TYPE} DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_HOST_ARCH ?= $(shell dpk-architecture -qDEB_HOST_ARCH) %: dh $@ --buildsystem cmake --fail-missing override_dh_auto_configure: dh_auto_configure -- -DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH) override_dh_auto_test: if [ "x${DEB_HOST_ARCH}" = "xarmhf" -o "x$(DEB_HOST_ARCH)" = "armel" ]; then \ dh_auto_build -- ubuntuoneauth-tests; \ else \ dh_auto_build -- check; \ fi ubuntuone-credentials-14.04+14.04.20140415/debian/control0000644000000000000000000001133512323300075017113 0ustar Source: ubuntuone-credentials Section: libs Priority: optional Build-Depends: cmake, debhelper (>= 9), libaccounts-qt5-dev, liboauth-dev, libsignon-qt5-dev, qtbase5-dev, qtdeclarative5-dev, qtdeclarative5-ubuntu-ui-toolkit-plugin, python (>= 2.7), signon-plugins-dev, ubuntu-ui-toolkit-autopilot, xvfb, Maintainer: Ubuntu One Developers Standards-Version: 3.9.5 Vcs-Bzr: lp:ubuntuone-credentials Xs-Testsuite: autopkgtest Package: ubuntuone-credentials-common Architecture: all Multi-Arch: foreign Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: ubuntuone-client-data (>= 4.2.0), ${misc:Depends}, ${shlibs:Depends}, Description: Ubuntu One authentication library - common data A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes common data files for the Ubuntu One authentication library and utilities. Package: ubuntuone-credentials-autopilot Architecture: all Depends: libautopilot-qt (>= 1.4), python-autopilot, python-fixtures, python-testtools, qtdeclarative5-online-accounts-client0.1, qtdeclarative5-qtquick2-plugin, qtdeclarative5-test-plugin, qtdeclarative5-ubuntu-ui-toolkit-plugin | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles, qtdeclarative5-ubuntuone1.0, ubuntu-ui-toolkit-autopilot, ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}, Description: Ubuntu One authentication library - autopilot tests A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes the autopilot tests. Package: libubuntuoneauth-2.0-0 Architecture: any Multi-Arch: same Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: signon-plugin-password, ubuntuone-credentials-common (= ${source:Version}), ${misc:Depends}, ${shlibs:Depends}, Description: Ubuntu One authentication library A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes the main library. Package: libubuntuoneauth-2.0-dev Section: libdevel Architecture: any Multi-Arch: same Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: libaccounts-qt5-dev, liboauth-dev, libsignon-qt5-dev, libubuntuoneauth-2.0-0 (= ${binary:Version}), qtbase5-dev, ${misc:Depends}, Description: Ubuntu One authentication library - development files A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes the development files for the Ubuntu One authentication library. Package: qtdeclarative5-ubuntuone1.0 Architecture: any Multi-Arch: same Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: libubuntuoneauth-2.0-0 (= ${binary:Version}), qtdeclarative5-ubuntu-ui-toolkit-plugin, ${misc:Depends}, ${shlibs:Depends}, Breaks: qtdeclarative5-ubuntuone-credentials-plugin, Replaces: qtdeclarative5-ubuntuone-credentials-plugin, Description: Ubuntu One authentication library - Qt declarative plug-in A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes a Qt declarative plug-in for using the library. Package: signon-plugin-ubuntuone Architecture: any Multi-Arch: foreign Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: libubuntuoneauth-2.0-0 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends}, Description: Ubuntu One authentication library - signon plug-in A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes an authentication plug-in for the signon daemon. Package: account-plugin-ubuntuone Architecture: any Multi-Arch: foreign Pre-Depends: multiarch-support, ${misc:Pre-Depends}, Depends: libubuntuoneauth-2.0-0 (= ${binary:Version}), qtdeclarative5-ubuntuone1.0 (= ${binary:Version}), ubuntu-system-settings-online-accounts, ${misc:Depends}, ${shlibs:Depends}, Description: Ubuntu One authentication library - account settings plug-in A library for native applications to log into the Ubuntu One services, to synchronize data, purchase music and software, or access data stored remotely on the Ubuntu One servers. . This package includes the accounts plug-in for Ubuntu System Settings. ubuntuone-credentials-14.04+14.04.20140415/COPYING.LESSER0000644000000000000000000001674312323300075016325 0ustar GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. 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 that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.