diff --git a/LICENSE b/LICENSE
index 23cb790338e191e29205d6f4123882c0583ef8eb..9cecc1d4669ee8af2ca727a5d8cde10cd8b2d7cc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,281 +1,622 @@
                     GNU GENERAL PUBLIC LICENSE
-                       Version 2, June 1991
+                       Version 3, 29 June 2007
 
- Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
                             Preamble
 
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  You can apply it to
+  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
-this service 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.
+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 make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
+  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 give the recipients all the rights that
-you have.  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.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
+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.
 
-                    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+                       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.
 
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
+  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
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
+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 a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                            NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE 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.
+  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
 
@@ -287,15 +628,15 @@ 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
-convey the exclusion of warranty; and each file should have at least
+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.
 
-    {description}
-    Copyright (C) {year}  {fullname}
+    {one line to give the program's name and a brief idea of what it does.}
+    Copyright (C) {year}  {name of author}
 
-    This program is free software; you can redistribute it and/or modify
+    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 2 of the License, or
+    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,
@@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
     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, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 Also add information on how to contact you by electronic and paper mail.
 
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
 
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    {project}  Copyright (C) {year}  {fullname}
+    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, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  {signature of Ty Coon}, 1 April 1989
-  Ty Coon, President of Vice
-
-This 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.
+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
+<http://www.gnu.org/licenses/>.
+
+  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
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/OwnCloudPlugin.class.php b/OwnCloudPlugin.class.php
new file mode 100644
index 0000000000000000000000000000000000000000..33a82e577aabba394cad443a937579ac85c6fe7b
--- /dev/null
+++ b/OwnCloudPlugin.class.php
@@ -0,0 +1,146 @@
+<?php
+
+StudipAutoloader::addAutoloadPath(__DIR__ . '/vendor/oauth2-client/src');
+
+class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
+
+    public function getFileSelectNavigation()
+    {
+        $nav = new Navigation(_("OwnCloud"));
+        $nav->setImage(Icon::create("cloud2", "clickable"));
+        return $nav;
+    }
+
+    public function getFolder($folder_id = null)
+    {
+        $parts = parse_url(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT);
+        $url = $parts['scheme']
+                    .urlencode(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_USERNAME)
+                    .":"
+                    .urlencode(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_PASSWORD)
+                    ."@"
+                    .$parts['host']
+                    .($parts['port'] ? ":".$parts['port'] : "")
+                    .($parts['path'] ?: "");
+        if ($url[strlen($url) - 1] !== "/") {
+            $url .= "/";
+        }
+        if ($parts['query']) {
+            $url .= "?".$parts['query'];
+        }
+        $url = URLHelper::getURL($url, array(
+            'format' => "json",
+            'response_code' => "code",
+            'client_id' => "",
+            'redirect_uri' => ""
+        ), true);
+
+
+
+        $folder = new VirtualFolderType(array(
+            'id' => "OwnCloudTopFolder"
+        ), $this->getPluginId());
+
+        $subfolder = new VirtualFolderType(array(
+            'id' => "folder1",
+            'name' => "Neuer Ordner",
+            'parent_id' => "OwnCloudTopFolder"
+        ), $this->getPluginId());
+        $subfolder->createFile(array(
+            'id' => md5(uniqid()),
+            'name' => "Statistik.xls",
+            'size' => "2102552",
+            'mime_type' => "application/xls",
+            'description' => "",
+            'chdate' => 1471104608,
+            'url' => null
+            //$item['accessInfo']['epub']['downloadLink']
+            //$item['accessInfo']['webReaderLink']
+        ));
+        if ($folder_id === "folder1") {
+            return $subfolder;
+        }
+
+        $folder->createSubfolder($subfolder);
+
+        $folder->createFile(array(
+            'id' => md5(uniqid()),
+            'name' => "TestDatei 1.pdf",
+            'size' => "102552",
+            'mime_type' => "application/pdf",
+            'description' => "",
+            'chdate' => 1477904608,
+            'url' => null
+            //$item['accessInfo']['epub']['downloadLink']
+            //$item['accessInfo']['webReaderLink']
+        ));
+
+        $folder->createFile(array(
+            'id' => md5(uniqid()),
+            'name' => "TestDatei 2.html",
+            'description' => "Zweite Testdatei",
+            'mime_type' => "text/html",
+            'size' => "152552",
+            'url' => "http://tacspac.com",
+            'chdate' => 1477914608,
+            //$item['accessInfo']['epub']['downloadLink']
+            //$item['accessInfo']['webReaderLink']
+        ));
+
+        return $folder;
+    }
+
+    public function getPreparedFile($file_id)
+    {
+        //TODO
+
+        $url = "https://www.googleapis.com/books/v1/volumes/".$file_id."?key=".urlencode(self::$googlebooksapikey);
+        $info = file_get_contents($url);
+        $info = studip_utf8decode(json_decode($info, true));
+        $download = $info['accessInfo']['pdf']['downloadLink'] ?: $info['accessInfo']['epub']['downloadLink'];
+        $tmp_path = $GLOBALS['TMP_PATH']."/".md5(uniqid());
+        if (!$download) {
+            var_dump($info);
+        } else {
+            file_put_contents($tmp_path, file_get_contents($download));
+            $file = array(
+                'name' => $info['volumeInfo']['title'] . ($info['accessInfo']['pdf']['downloadLink'] ? ".pdf" : ".epub"),
+                'size' => filesize($tmp_path),
+                'type' => $info['accessInfo']['pdf']['downloadLink'] ? "application/pdf" : "application/epub+zip",
+                'tmp_path' => $tmp_path,
+                'description' => $info['volumeInfo']['publishedDate'].", ".implode(", ", (array) $info['volumeInfo']['authors'])
+            );
+            return $file;
+        }
+    }
+
+    public function filesystemConfigurationURL()
+    {
+        return PluginEngine::getURL($this, array(), "configure/myarea");
+    }
+
+    public function hasSearch() {
+        return false;
+    }
+
+    public function getSearchParameters()
+    {
+        // TODO: Implement getSearchParameters() method.
+    }
+
+    public function search($text, $parameters = array())
+    {
+        return null;
+    }
+
+    public function isSource()
+    {
+        return UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED;
+    }
+
+    public function isPersonalFileArea()
+    {
+        return UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED;
+    }
+
+}
\ No newline at end of file
diff --git a/controllers/configure.php b/controllers/configure.php
new file mode 100644
index 0000000000000000000000000000000000000000..4d85eb7d87741761a2d2609f72c5ca809098db15
--- /dev/null
+++ b/controllers/configure.php
@@ -0,0 +1,24 @@
+<?php
+
+class ConfigureController extends PluginController
+{
+    public function myarea_action()
+    {
+        if (Navigation::hasItem("/profile/files/OwnCloudPlugin")) {
+            Navigation::activateItem('/profile/files/OwnCloudPlugin');
+        } else {
+            Navigation::activateItem('/profile/files');
+        }
+        if (Request::isPost()) {
+            $config = UserConfig::get($GLOBALS['user']->id);
+            $data = Request::getArray("owncloud");
+            foreach ($data as $key => $value) {
+                $config->store("OWNCLOUD_".strtoupper($key), $value);
+            }
+            if (!$data['activated']) {
+                $config->store("OWNCLOUD_ACTIVATED", 0);
+            }
+            PageLayout::postMessage(MessageBox::success(_("Konfiguration gespeichert.")));
+        }
+    }
+}
\ No newline at end of file
diff --git a/controllers/oauth.php b/controllers/oauth.php
new file mode 100644
index 0000000000000000000000000000000000000000..b919aeca84d453445d64c604e5e3eaa5b5a57995
--- /dev/null
+++ b/controllers/oauth.php
@@ -0,0 +1,24 @@
+<?php
+
+class OauthController extends PluginController
+{
+    public function request_access_token_action()
+    {
+        URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
+        //Muss den Nutzer weiterleiten auf den Server, wo der Nutzer die App freischaltet
+        $url = Config::get()->OWNCLOUD_ENDPOINT ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT;
+        $url .= "/index.php/apps/oauth2/authorize?response_type=code&client_id=";
+        $url .= urlencode(Config::get()->OWNCLOUD_CLIENT_ID ?: UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID);
+        $url .= "&redirect_uri=".urlencode(PluginEngine::getURL($this->plugin, array(), "oauth/receive_access_token_action"));
+
+
+        header("Location: ".$url);
+        $this->render_nothing();
+    }
+
+    public function receive_access_token_action()
+    {
+        //Save the access token and refresh-token
+        Request::get("code");
+    }
+}
\ No newline at end of file
diff --git a/plugin.manifest b/plugin.manifest
new file mode 100644
index 0000000000000000000000000000000000000000..0f7f30673671c0f2a5e3a60b2e9e2ca101f7269c
--- /dev/null
+++ b/plugin.manifest
@@ -0,0 +1,4 @@
+pluginname=OwnCloudPlugin
+pluginclassname=OwnCloudPlugin
+version=1.0
+origin=data-quest
\ No newline at end of file
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..50fffa476150f8f23e89d8a93c0fc18464ef237d
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,21 @@
+OwnCloud-Plugin f�r Stud.IP
+===========================
+
+Mit diesem Plugin kann man ab der Stud.IP-Version 4.0 eine Owncloud (oder Nextcloud) als pers�nlichen Dateibereich einbinden und von und zu der Owncloud Dateien nach oder von Stud.IP kopieren.
+
+## Installation
+
+1. Das Plugin wird ganz normal in Stud.IP per Drag&Drop installiert. 
+2. Die OwnCloud braucht die [OAuth2-App](https://github.com/owncloud/oauth2/releases), die installiert und aktiviert werden muss. Wer nur Stud.IP gewohnt ist: OAuth2 hei�t im Owncloud-Kontext zwar "App", ist aber das gleiche wie bei Stud.IP ein Plugin. Die Dateien m�ssen in das Owncloud-Verzeichnis unter `./apps/oauth2` abgelegt werden.
+3. Die OAuth2 "App" muss als Admin im Webinterface von Owncloud aktiviert werden unter "Einstellungen" (oben rechts unter dem Nutzernamen) -> Apps -> "Deaktivierte Apps anzeigen" -> "aktivieren".
+4. Es muss in Owncloud ein Client angelegt werden. Unter Administration -> "Additional" einen neuen Client anlegen. Name ist dabei egal (vielleicht ja Stud.IP).
+5. Jetzt hat man einen OAuth2-Client erstellt und kopiert Client-ID und das Secret.
+
+Jetzt muss man sich �berlegen, wie das Owncloud-Plugin genutzt werden soll in Stud.IP. Gibt es eine zentrale OwnCloud f�r alle Stud.IP-Nutzer oder k�mmern sich die Nutzer selbst um eine eigene OwnCloud?
+
+Zentral: 
+
+1. Melde Dich im Stud.IP als Root an und gehe unter Admin -> System -> Konfiguration -> Owncloud.
+2. Trage die oben gewonnene Client-ID beim Parameter `OWNCLOUD_CLIENT_ID` ein.
+3. Trage das oben gewonnene Secret beim Parameter `OWNCLOUD_CLIENT_SECRET` ein.
+
diff --git a/vendor/oauth2-client/CHANGELOG.md b/vendor/oauth2-client/CHANGELOG.md
new file mode 100755
index 0000000000000000000000000000000000000000..7ed122e6d4cd1801d3a62a6d1cfb505b257ebbe0
--- /dev/null
+++ b/vendor/oauth2-client/CHANGELOG.md
@@ -0,0 +1,291 @@
+# OAuth 2.0 Client Changelog
+
+## 2.2.1
+
+_Released: 2017-04-25_
+
+* Fix potential type error when HTTP 500 errors are encountered
+* Allow broader range of `random_compat` versions
+
+## 2.2.0
+
+_Released: 2017-02-01_
+
+* Allow base URLs to contain query parameters
+* Protect against `+` being improperly encoded in URL parameters
+* Remove misleading `state` option from authorization parameters
+* Stop generating more random bytes than necessary
+
+## 2.1.0
+
+_Released: 2017-01-24_
+
+* Allow `expires_in` with a value of `0`
+
+## 2.0.0
+
+_Released: 2017-01-12_
+
+* Rename `getResponse()` to `getParsedResponse()`
+* Add `getResponse()` method that returns the unparsed PSR-7 `Response` instance
+* Removed `RandomFactory`, switched to native random functions
+
+## 1.4.1
+
+_Released: 2016-04-29_
+
+* Add `QueryBuilderTrait` to standardize query string generation.
+
+## 1.4.0
+
+_Released: 2016-04-19_
+
+* Add `AccessToken::getValues()` to access additional vendor data provided with tokens.
+
+## 1.3.0
+
+_Released: 2016-02-13_
+
+* Enable dynamic parameters being passed into the authorization URL.
+* Minor documentation updates.
+
+## 1.2.0
+
+_Released: 2016-01-23_
+
+* Add `resource_owner_id` to the JSON-serialized representation of the access token.
+* Minor documentation updates and improved test coverage.
+
+## 1.1.0
+
+_Released: 2015-11-13_
+
+* Add `ArrayAccessorTrait`, update `AbstractProvider` to utilize.
+* Use `expires` to serialize access tokens.
+* Documentation updates.
+
+## 1.0.2
+
+_Released: 2015-09-22_
+
+* Allow access tokens to be created from storage (see #431).
+* Minor fixes and documentation updates.
+
+## 1.0.1
+
+_Released: 2015-08-26_
+
+* Allow required parameters checked using the `RequiredParameterTrait` to be set as `false`, `null`, `"0"`, etc.
+
+## 1.0.0
+
+_Released: 2015-08-19_
+
+* We are running code-quality builds through Scrutinizer, and we are running unit test builds on the new Travis CI container-based infrastructure.
+* Cleaned up code, as recommended by Scrutinizer.
+* Documentation updates.
+
+## 1.0.0-beta2
+
+_Released: 2015-08-12_
+
+* BREAK: Add toArray() to ResourceOwnerInterface.
+* Always attempt to parse responses as JSON and fallback on failure.
+* Add dot notation support to access token resource owner ID.
+* Use the Bearer authorization header for the generic provider.
+* Documentation updates.
+
+## 1.0.0-beta1
+
+_Released: 2015-07-16_
+
+* API for 1.0 is now frozen!
+* BREAK: Convert all uses of "User" to "ResourceOwner" to more closely match the OAuth 2.0 specification.
+* BREAK: Rename `StandardProvider` to `GenericProvider`.
+* BREAK: Move access token creation to the `AbstractProvider`. It was previously handled in the `AbstractGrant`.
+* FIX: Add `Content-Type` header with value of `application/x-www-form-urlencoded` to the request header when retrieving access tokens. This adheres to the OAuth 2.0 specification and fixes issues where certain OAuth servers expect this header.
+* Enhanced `json_encode()` serialization of AccessToken; when using `json_encode()` on an AccessToken, it will return a JSON object with these properties: `access_token`, `refresh_token`, and `expires_in`.
+
+## 1.0.0-alpha2
+
+_Released: 2015-07-04_
+
+* BREAK: Renamed `AbstractProvider::ACCESS_TOKEN_METHOD_GET` to `AbstractProvider::METHOD_GET`.
+* BREAK: Renamed `AbstractProvider::ACCESS_TOKEN_METHOD_POST` to `AbstractProvider::METHOD_POST`.
+* BREAK: Renamed `AbstractProvider::prepareUserDetails()` to `AbstractProvider::createUser()`.
+* BREAK: Renamed `AbstractProvider::getUserDetails()` to `AbstractProvider::getUser()`.
+* BREAK: Removed `$token` parameter from `AbstractProvider::getDefaultHeaders()`.
+* BREAK: Modify `AbstractProvider::getBaseAccessTokenUrl()` to accept a required array of parameters, allowing providers the ability to vary the access token URL, based on the parameters.
+* Removed newline characters from MAC Authorization header.
+* Documentation updates, notably:
+  - Moved list of providers to `README.PROVIDERS.md`.
+  - Moved provider creation notes to `README.PROVIDER-GUIDE.md`.
+
+## 1.0.0-alpha1
+
+_Released: 2015-06-25_
+
+This release contains numerous BC breaks from the 0.x series. Please note these breaks and refer to the [upgrade guide](GUIDE-UPGRADING.md).
+
+* BREAK: Requires PHP 5.5.0 and greater.
+* BREAK: All providers have been moved to separate repositories, one for each provider.
+* BREAK: All `public` properties have been set as `protected` or `private` and getters/setters have been introduced for access to these properties.
+* BREAK: The `Provider\ProviderInterface` has been removed. Please extend from and override `Provider\AbstractProvider`.
+* BREAK: The `Entity\User` has been removed. Providers should implement the `Provider\UserInterface` and provide user functionality instead of expecting it in this base library.
+* BREAK: The `Grant\GrantInterface` has been removed. Providers needing to provide a new grant type should extend from and override `Grant\AbstractGrant`.
+* A generic `Provider\StandardProvider` has been introduced, which may be used as a client to integrate with most OAuth 2.0 compatible servers.
+* A `Grant\GrantFactory` has been introduced as a means to register and retrieve singleton grants from a registry.
+* Introduced traits for bearer and MAC authorization (`Tool\BearerAuthorizationTrait` and `Tool\MacAuthorizationTrait`), which providers may use to enable these header authorization types.
+
+## 0.12.1
+
+_Released: 2015-06-20_
+
+* FIX: Scope separators for LinkedIn and Instagram are now correctly a single space
+
+## 0.12.0
+
+_Released: 2015-06-15_
+
+* BREAK: LinkedIn Provider: Default scopes removed from LinkedIn Provider. See "[Managing LinkedIn Scopes](https://github.com/thephpleague/oauth2-client/blob/9cea9864c2e89bce1b922d1e37ba5378b3b0b264/README.md#managing-linkedin-scopes)" in the README for information on how to set scopes. See [#327](https://github.com/thephpleague/oauth2-client/pull/327) and [#307](https://github.com/thephpleague/oauth2-client/pull/307) for details on this change.
+* FIX: LinkedIn Provider: A scenario existed in which `publicProfileUrl` was not set, generating a PHP notice; this has been fixed.
+* FIX: Instagram Provider: Fixed scope separator.
+* Documentation updates and corrections.
+
+
+## 0.11.0
+
+_Released: 2015-04-25_
+
+* Identity Provider: Better handling of error responses
+* Documentation updates
+
+
+## 0.10.1
+
+_Released: 2015-04-02_
+
+* FIX: Invalid JSON triggering fatal error
+* FIX: Sending headers along with auth `getAccessToken()` requests
+* Now running Travis CI tests on PHP 7
+* Documentation updates
+
+
+## 0.10.0
+
+_Released: 2015-03-10_
+
+* Providers: Added `getHeaders()` to ProviderInterface and updated AbstractProvider to provide the method
+* Providers: Updated all bundled providers to support new `$authorizationHeader` property
+* Identity Provider: Update IDPException to account for empty strings
+* Identity Provider: Added `getResponseBody()` method to IDPException
+* Documentation updates, minor bug fixes, and coding standards fixes
+
+
+## 0.9.0
+
+_Released: 2015-02-24_
+
+* Add `AbstractProvider::prepareAccessTokenResult()` to provide additional token response preparation to providers
+* Remove custom provider code from AccessToken
+* Add links to README for Dropbox and Square providers
+
+
+## 0.8.1
+
+_Released: 2015-02-12_
+
+* Allow `approval_prompt` to be set by providers. This fixes an issue where some providers have problems if the `approval_prompt` is present in the query string.
+
+
+## 0.8.0
+
+_Released: 2015-02-10_
+
+* Facebook Provider: Upgrade to Graph API v2.2
+* Google Provider: Add `access_type` parameter for Google authorization URL
+* Get a more reliable response body on errors
+
+
+## 0.7.2
+
+_Released: 2015-02-03_
+
+* GitHub Provider: Fix regression
+* Documentation updates
+
+
+## 0.7.1
+
+_Released: 2015-01-06_
+
+* Google Provider: fixed issue where Google API was not returning the user ID
+
+
+## 0.7.0
+
+_Released: 2014-12-29_
+
+* Improvements to Provider\AbstractProvider (addition of `userUid()`, `userEmail()`, and `userScreenName()`)
+* GitHub Provider: Support for GitHub Enterprise
+* GitHub Provider: Methods to allow fetching user email addresses
+* Google Provider: Updated scopes and endpoints to remove deprecated values
+* Documentation updates, minor bug fixes, and coding standards fixes
+
+
+## 0.6.0
+
+_Released: 2014-12-03_
+
+* Added ability to specify a redirect handler for providers through use of a callback (see [Provider\AbstractProvider::setRedirectHandler()](https://github.com/thephpleague/oauth2-client/blob/55de45401eaa21f53c0b2414091da6f3b0f3fcb7/src/Provider/AbstractProvider.php#L314-L317))
+* Updated authorize and token URLs for the Microsoft provider; the old URLs had been phased out and were no longer working (see #146)
+* Increased test coverage
+* Documentation updates, minor bug fixes, and coding standards fixes
+
+
+## 0.5.0
+
+_Released: 2014-11-28_
+
+* Added `ClientCredentials` and `Password` grants
+* Added support for providers to set their own `uid` parameter key name
+* Added support for Google's `hd` (hosted domain) parameter
+* Added support for providing a custom `state` parameter to the authorization URL
+* LinkedIn `pictureUrl` is now an optional response element
+* Added Battle.net provider package link to README
+* Added Meetup provider package link to README
+* Added `.gitattributes` file
+* Increased test coverage
+* A number of documentation fixes, minor bug fixes, and coding standards fixes
+
+
+## 0.4.0
+
+_Released: 2014-10-28_
+
+* Added  `ProviderInterface` and removed `IdentityProvider`.
+* Expose generated state to allow for CSRF validation.
+* Renamed `League\OAuth2\Client\Provider\User` to `League\OAuth2\Client\Entity\User`.
+* Entity: User: added `gender` and `locale` properties
+* Updating logic for populating the token expiration time.
+
+
+## 0.3.0
+
+_Released: 2014-04-26_
+
+* This release made some huge leaps forward, including 100% unit-coverage and a bunch of new features.
+
+
+## 0.2.0
+
+_Released: 2013-05-28_
+
+* No release notes available.
+
+
+## 0.1.0
+
+_Released: 2013-05-25_
+
+* Initial release.
diff --git a/vendor/oauth2-client/CONTRIBUTING.md b/vendor/oauth2-client/CONTRIBUTING.md
new file mode 100755
index 0000000000000000000000000000000000000000..056e870057fdc720624ea925890eaa5056f5c81f
--- /dev/null
+++ b/vendor/oauth2-client/CONTRIBUTING.md
@@ -0,0 +1,39 @@
+# Contributing
+
+Contributions are **welcome** and will be fully **credited**.
+
+We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/oauth2-client).
+
+
+## Pull Requests
+
+- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
+
+- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
+
+- **Document any change in behaviour** - Make sure the README and any other relevant documentation are kept up-to-date.
+
+- **Consider our release cycle** - We try to follow SemVer. Randomly breaking public APIs is not an option.
+
+- **Create topic branches** - Don't ask us to pull from your master branch.
+
+- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
+
+- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
+
+- **Ensure tests pass!** - Please run the tests (see below) before submitting your pull request, and make sure they pass. We won't accept a patch until all tests pass.
+
+- **Ensure no coding standards violations** - Please run PHP Code Sniffer using the PSR-2 standard (see below) before submitting your pull request. A violation will cause the build to fail, so please make sure there are no violations. We can't accept a patch if the build fails.
+
+
+## Testing
+
+The following tests must pass for a build to be considered successful. If contributing, please ensure these pass before submitting a pull request.
+
+``` bash
+$ ./vendor/bin/parallel-lint src test
+$ ./vendor/bin/phpunit --coverage-text
+$ ./vendor/bin/phpcs src --standard=psr2 -sp
+```
+
+**Happy coding**!
diff --git a/vendor/oauth2-client/CREDITS.md b/vendor/oauth2-client/CREDITS.md
new file mode 100755
index 0000000000000000000000000000000000000000..628f49e6e587af96ff514728ececff7b55f7d5b5
--- /dev/null
+++ b/vendor/oauth2-client/CREDITS.md
@@ -0,0 +1,20 @@
+# OAuth 2.0 Client
+
+## Authors
+
+Also see <https://github.com/thephpleague/oauth2-client/contributors>.
+
+### Current Maintainer
+
+- [Ben Ramsey](https://github.com/ramsey)
+
+### Contributors
+
+- [Alex Bilbie](https://github.com/alexbilbie)
+- [Ben Corlett](https://github.com/bencorlett)
+- [Ben Ramsey](https://github.com/ramsey)
+- [James Mills](https://github.com/jamesmills)
+- [Phil Sturgeon](https://github.com/philsturgeon)
+- [Rudi Theunissen](https://github.com/rtheunissen)
+- [Tom Anderson](https://github.com/TomHAnderson)
+- [Woody Gilk](https://github.com/shadowhand)
diff --git a/vendor/oauth2-client/LICENSE b/vendor/oauth2-client/LICENSE
new file mode 100755
index 0000000000000000000000000000000000000000..704730e63aa7c23a195e7cc803430a4262f13017
--- /dev/null
+++ b/vendor/oauth2-client/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2015 Alex Bilbie <hello@alexbilbie.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/vendor/oauth2-client/README.PROVIDER-GUIDE.md b/vendor/oauth2-client/README.PROVIDER-GUIDE.md
new file mode 100755
index 0000000000000000000000000000000000000000..4999d7da142ae6eebd48057caf03bf8b3a32a7cc
--- /dev/null
+++ b/vendor/oauth2-client/README.PROVIDER-GUIDE.md
@@ -0,0 +1,96 @@
+# OAuth 2.0 Client
+
+## Provider Guide
+
+New providers may be created by copying the layout of an existing package. See
+the [list of providers](docs/providers/thirdparty.md) for good examples.
+
+When choosing a name for your package, please don’t use the `league` vendor
+prefix, as this implies that it is officially supported. You should use your own
+username as the vendor prefix, and prepend `oauth2-` to the package name to make
+it clear that your package works with OAuth2 Client. For example, if your GitHub
+username was "santa," and you were implementing the "giftpay" OAuth2 library, a
+good name for your composer package would be `santa/oauth2-giftpay`.
+
+### Implementing your own provider
+
+If you are working with an oauth2 service not supported out-of-the-box or by an
+existing package, it is quite simple to implement your own. Simply extend
+[`League\OAuth2\Client\Provider\AbstractProvider`](src/Provider/AbstractProvider.php)
+and implement the required abstract methods:
+
+```php
+abstract public function getBaseAuthorizationUrl();
+abstract public function getBaseAccessTokenUrl(array $params);
+abstract public function getResourceOwnerDetailsUrl(AccessToken $token);
+abstract protected function getDefaultScopes();
+abstract protected function checkResponse(ResponseInterface $response, $data);
+abstract protected function createResourceOwner(array $response, AccessToken $token);
+```
+
+Each of these abstract methods contain a docblock defining their expectations
+and typical behavior. Once you have extended this class, you can simply follow
+the [usage example in the README](README.md#usage) using your new `Provider`.
+
+If you wish to use the `Provider` to make authenticated requests to the
+service, you will also need to define how you provide the token to the
+service. If this is done via headers, you should override this method:
+
+```php
+protected function getAuthorizationHeaders($token = null);
+```
+
+This package comes with a trait for implementing `Bearer` authorization.
+To use this, you just need to include the trait in your `Provider` class:
+
+```php
+<?php
+class SomeProvider extends AbstractProvider
+{
+    use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
+
+    /** ... **/
+}
+```
+
+
+### Resource owner identifiers in access token responses
+
+In services where the resource owner is a person, the resource owner is sometimes
+referred to as an end-user.
+
+We have decided to abstract away as much of the resource owner details as possible,
+since these are not part of the OAuth 2.0 specification and are very specific to each
+service provider. This provides greater flexibility to each provider, allowing
+them to handle the implementation details for resource owners.
+
+The `AbstractProvider` does not specify an access token resource owner identifier. It is
+the responsibility of the provider class to set the `ACCESS_TOKEN_RESOURCE_OWNER_ID` constant
+to the string value of the key used in the access token response to identify the
+resource owner.
+
+```php
+/**
+ * @var string Key used in the access token response to identify the resource owner.
+ */
+const ACCESS_TOKEN_RESOURCE_OWNER_ID = null;
+```
+
+Once this is set on your provider, when calling `AbstractProvider::getAccessToken()`,
+the `AccessToken` returned will have its `$resourceOwnerId` property set, which you may
+retrieve by calling `AccessToken::getResourceOwnerId()`.
+
+The next step is to implement the `AbstractProvider::createResourceOwner()` method. This
+method accepts as parameters a response array and an `AccessToken`. You may use
+this information in order to request resource owner details from your service and
+construct and return an object that implements
+[`League\OAuth2\Client\Provider\ResourceOwnerInterface`](src/Provider/ResourceOwnerInterface.php).
+This object is returned when calling `AbstractProvider::getResourceOwner()`.
+
+### Make your gateway official
+
+If you want to transfer your provider to the `thephpleague` GitHub organization
+and add it to the list of officially supported providers, please open a pull
+request on the thephpleague/oauth2-client package. Before new providers will be
+accepted, they must have 100% unit test code coverage, and follow the
+conventions and code style used in other OAuth2 Client providers.
diff --git a/vendor/oauth2-client/README.md b/vendor/oauth2-client/README.md
new file mode 100755
index 0000000000000000000000000000000000000000..554844e68d9689559e652b08b7d7b7ca8c842291
--- /dev/null
+++ b/vendor/oauth2-client/README.md
@@ -0,0 +1,270 @@
+# OAuth 2.0 Client
+
+This package makes it simple to integrate your application with [OAuth 2.0](http://oauth.net/2/) service providers.
+
+[![Gitter Chat](https://img.shields.io/badge/gitter-join_chat-brightgreen.svg?style=flat-square)](https://gitter.im/thephpleague/oauth2-client)
+[![Source Code](http://img.shields.io/badge/source-thephpleague/oauth2--client-blue.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client)
+[![Latest Version](https://img.shields.io/github/release/thephpleague/oauth2-client.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/releases)
+[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE)
+[![Build Status](https://img.shields.io/travis/thephpleague/oauth2-client/master.svg?style=flat-square)](https://travis-ci.org/thephpleague/oauth2-client)
+[![HHVM Status](https://img.shields.io/hhvm/league/oauth2-client.svg?style=flat-square)](http://hhvm.h4cc.de/package/league/oauth2-client)
+[![Scrutinizer](https://img.shields.io/scrutinizer/g/thephpleague/oauth2-client/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/thephpleague/oauth2-client/)
+[![Coverage Status](https://img.shields.io/coveralls/thephpleague/oauth2-client/master.svg?style=flat-square)](https://coveralls.io/r/thephpleague/oauth2-client?branch=master)
+[![Total Downloads](https://img.shields.io/packagist/dt/league/oauth2-client.svg?style=flat-square)](https://packagist.org/packages/league/oauth2-client)
+
+---
+
+We are all used to seeing those "Connect with Facebook/Google/etc." buttons around the internet, and social network integration is an important feature of most web applications these days. Many of these sites use an authentication and authorization standard called OAuth 2.0 ([RFC 6749](http://tools.ietf.org/html/rfc6749)).
+
+This OAuth 2.0 client library will work with any OAuth provider that conforms to the OAuth 2.0 standard. Out-of-the-box, we provide a `GenericProvider` that may be used to connect to any service provider that uses [Bearer tokens](http://tools.ietf.org/html/rfc6750) (see example below).
+
+Many service providers provide additional functionality above and beyond the OAuth 2.0 standard. For this reason, this library may be easily extended and wrapped to support this additional behavior. We provide links to [all known provider clients extending this library](docs/providers/thirdparty.md) (i.e. Facebook, GitHub, Google, Instagram, LinkedIn, etc.). If your provider isn't in the list, feel free to add it.
+
+This package is compliant with [PSR-1][], [PSR-2][], [PSR-4][], and [PSR-7][]. If you notice compliance oversights, please send a patch via pull request. If you're interesting in contributing to this library, please take a look at our [contributing guidelines](CONTRIBUTING.md).
+
+## Requirements
+
+The following versions of PHP are supported.
+
+* PHP 5.6
+* PHP 7.0
+* PHP 7.1
+* HHVM
+
+## Providers
+
+A list of official PHP League providers, as well as third-party providers, may be found in the [providers list README](docs/providers/thirdparty.md).
+
+To build your own provider, please refer to the [provider guide README](README.PROVIDER-GUIDE.md).
+
+## Usage
+
+**In most cases, you'll want to use a specific provider client library rather than this base library.**
+
+Take a look at [providers list README](docs/providers/thirdparty.md) to see a list of provider client libraries.
+
+If using Composer to require a specific provider client library, you **do not need to also require this library**. Composer will handle the dependencies for you.
+
+### Authorization Code Grant
+
+The following example uses the out-of-the-box `GenericProvider` provided by this library. If you're looking for a specific provider (i.e. Facebook, Google, GitHub, etc.), take a look at our [list of provider client libraries](docs/providers/thirdparty.md). **HINT: You're probably looking for a specific provider.**
+
+The authorization code grant type is the most common grant type used when authenticating users with a third-party service. This grant type utilizes a client (this library), a server (the service provider), and a resource owner (the user with credentials to a protected—or owned—resource) to request access to resources owned by the user. This is often referred to as _3-legged OAuth_, since there are three parties involved.
+
+The following example illustrates this using [Brent Shaffer's](https://github.com/bshaffer) demo OAuth 2.0 application named **Lock'd In**. When running this code, you will be redirected to Lock'd In, where you'll be prompted to authorize the client to make requests to a resource on your behalf.
+
+Now, you don't really have an account on Lock'd In, but for the sake of this example, imagine that you are already logged in on Lock'd In when you are redirected there.
+
+```php
+$provider = new \League\OAuth2\Client\Provider\GenericProvider([
+    'clientId'                => 'demoapp',    // The client ID assigned to you by the provider
+    'clientSecret'            => 'demopass',   // The client password assigned to you by the provider
+    'redirectUri'             => 'http://example.com/your-redirect-url/',
+    'urlAuthorize'            => 'http://brentertainment.com/oauth2/lockdin/authorize',
+    'urlAccessToken'          => 'http://brentertainment.com/oauth2/lockdin/token',
+    'urlResourceOwnerDetails' => 'http://brentertainment.com/oauth2/lockdin/resource'
+]);
+
+// If we don't have an authorization code then get one
+if (!isset($_GET['code'])) {
+
+    // Fetch the authorization URL from the provider; this returns the
+    // urlAuthorize option and generates and applies any necessary parameters
+    // (e.g. state).
+    $authorizationUrl = $provider->getAuthorizationUrl();
+
+    // Get the state generated for you and store it to the session.
+    $_SESSION['oauth2state'] = $provider->getState();
+
+    // Redirect the user to the authorization URL.
+    header('Location: ' . $authorizationUrl);
+    exit;
+
+// Check given state against previously stored one to mitigate CSRF attack
+} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {
+
+    if (isset($_SESSION['oauth2state'])) {
+        unset($_SESSION['oauth2state']);
+    }
+    
+    exit('Invalid state');
+
+} else {
+
+    try {
+
+        // Try to get an access token using the authorization code grant.
+        $accessToken = $provider->getAccessToken('authorization_code', [
+            'code' => $_GET['code']
+        ]);
+
+        // We have an access token, which we may use in authenticated
+        // requests against the service provider's API.
+        echo 'Access Token: ' . $accessToken->getToken() . "<br>";
+        echo 'Refresh Token: ' . $accessToken->getRefreshToken() . "<br>";
+        echo 'Expired in: ' . $accessToken->getExpires() . "<br>";
+        echo 'Already expired? ' . ($accessToken->hasExpired() ? 'expired' : 'not expired') . "<br>";
+
+        // Using the access token, we may look up details about the
+        // resource owner.
+        $resourceOwner = $provider->getResourceOwner($accessToken);
+
+        var_export($resourceOwner->toArray());
+
+        // The provider provides a way to get an authenticated API request for
+        // the service, using the access token; it returns an object conforming
+        // to Psr\Http\Message\RequestInterface.
+        $request = $provider->getAuthenticatedRequest(
+            'GET',
+            'http://brentertainment.com/oauth2/lockdin/resource',
+            $accessToken
+        );
+
+    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
+
+        // Failed to get the access token or user details.
+        exit($e->getMessage());
+
+    }
+
+}
+```
+
+### Refreshing a Token
+
+Once your application is authorized, you can refresh an expired token using a refresh token rather than going through the entire process of obtaining a brand new token. To do so, simply reuse this refresh token from your data store to request a refresh.
+
+_This example uses [Brent Shaffer's](https://github.com/bshaffer) demo OAuth 2.0 application named **Lock'd In**. See authorization code example above, for more details._
+
+```php
+$provider = new \League\OAuth2\Client\Provider\GenericProvider([
+    'clientId'                => 'demoapp',    // The client ID assigned to you by the provider
+    'clientSecret'            => 'demopass',   // The client password assigned to you by the provider
+    'redirectUri'             => 'http://example.com/your-redirect-url/',
+    'urlAuthorize'            => 'http://brentertainment.com/oauth2/lockdin/authorize',
+    'urlAccessToken'          => 'http://brentertainment.com/oauth2/lockdin/token',
+    'urlResourceOwnerDetails' => 'http://brentertainment.com/oauth2/lockdin/resource'
+]);
+
+$existingAccessToken = getAccessTokenFromYourDataStore();
+
+if ($existingAccessToken->hasExpired()) {
+    $newAccessToken = $provider->getAccessToken('refresh_token', [
+        'refresh_token' => $existingAccessToken->getRefreshToken()
+    ]);
+
+    // Purge old access token and store new access token to your data store.
+}
+```
+
+### Resource Owner Password Credentials Grant
+
+Some service providers allow you to skip the authorization code step to exchange a user's credentials (username and password) for an access token. This is referred to as the "resource owner password credentials" grant type.
+
+According to [section 1.3.3](http://tools.ietf.org/html/rfc6749#section-1.3.3) of the OAuth 2.0 standard (emphasis added):
+
+> The credentials **should only be used when there is a high degree of trust**
+> between the resource owner and the client (e.g., the client is part of the
+> device operating system or a highly privileged application), and when other
+> authorization grant types are not available (such as an authorization code).
+
+**We do not advise using this grant type if the service provider supports the authorization code grant type (see above), as this reinforces the [password anti-pattern](https://agentile.com/the-password-anti-pattern) by allowing users to think it's okay to trust third-party applications with their usernames and passwords.**
+
+That said, there are use-cases where the resource owner password credentials grant is acceptable and useful. Here's an example using it with [Brent Shaffer's](https://github.com/bshaffer) demo OAuth 2.0 application named **Lock'd In**. See authorization code example above, for more details about the Lock'd In demo application.
+
+``` php
+$provider = new \League\OAuth2\Client\Provider\GenericProvider([
+    'clientId'                => 'demoapp',    // The client ID assigned to you by the provider
+    'clientSecret'            => 'demopass',   // The client password assigned to you by the provider
+    'redirectUri'             => 'http://example.com/your-redirect-url/',
+    'urlAuthorize'            => 'http://brentertainment.com/oauth2/lockdin/authorize',
+    'urlAccessToken'          => 'http://brentertainment.com/oauth2/lockdin/token',
+    'urlResourceOwnerDetails' => 'http://brentertainment.com/oauth2/lockdin/resource'
+]);
+
+try {
+
+    // Try to get an access token using the resource owner password credentials grant.
+    $accessToken = $provider->getAccessToken('password', [
+        'username' => 'demouser',
+        'password' => 'testpass'
+    ]);
+
+} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
+
+    // Failed to get the access token
+    exit($e->getMessage());
+
+}
+```
+
+### Client Credentials Grant
+
+When your application is acting on its own behalf to access resources it controls/owns in a service provider, it may use the client credentials grant type. This is best used when the credentials for your application are stored privately and never exposed (e.g. through the web browser, etc.) to end-users. This grant type functions similarly to the resource owner password credentials grant type, but it does not request a user's username or password. It uses only the client ID and secret issued to your client by the service provider.
+
+Unlike earlier examples, the following does not work against a functioning demo service provider. It is provided for the sake of example only.
+
+``` php
+// Note: the GenericProvider requires the `urlAuthorize` option, even though
+// it's not used in the OAuth 2.0 client credentials grant type.
+
+$provider = new \League\OAuth2\Client\Provider\GenericProvider([
+    'clientId'                => 'XXXXXX',    // The client ID assigned to you by the provider
+    'clientSecret'            => 'XXXXXX',    // The client password assigned to you by the provider
+    'redirectUri'             => 'http://my.example.com/your-redirect-url/',
+    'urlAuthorize'            => 'http://service.example.com/authorize',
+    'urlAccessToken'          => 'http://service.example.com/token',
+    'urlResourceOwnerDetails' => 'http://service.example.com/resource'
+]);
+
+try {
+
+    // Try to get an access token using the client credentials grant.
+    $accessToken = $provider->getAccessToken('client_credentials');
+
+} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
+
+    // Failed to get the access token
+    exit($e->getMessage());
+
+}
+```
+
+### Using a proxy
+
+It is possible to use a proxy to debug HTTP calls made to a provider. All you need to do is set the `proxy` and `verify` options when creating your Provider instance. Make sure you enable SSL proxying in your proxy.
+
+``` php
+$provider = new \League\OAuth2\Client\Provider\GenericProvider([
+    'clientId'                => 'XXXXXX',    // The client ID assigned to you by the provider
+    'clientSecret'            => 'XXXXXX',    // The client password assigned to you by the provider
+    'redirectUri'             => 'http://my.example.com/your-redirect-url/',
+    'urlAuthorize'            => 'http://service.example.com/authorize',
+    'urlAccessToken'          => 'http://service.example.com/token',
+    'urlResourceOwnerDetails' => 'http://service.example.com/resource',
+    'proxy'                   => '192.168.0.1:8888',
+    'verify'                  => false
+]);
+```
+
+## Install
+
+Via Composer
+
+``` bash
+$ composer require league/oauth2-client
+```
+
+## Contributing
+
+Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-client/blob/master/CONTRIBUTING.md) for details.
+
+## License
+
+The MIT License (MIT). Please see [License File](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE) for more information.
+
+
+[PSR-1]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
+[PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
+[PSR-4]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
+[PSR-7]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message.md
diff --git a/vendor/oauth2-client/composer.json b/vendor/oauth2-client/composer.json
new file mode 100755
index 0000000000000000000000000000000000000000..bab65b660ec49f7ec7ea21ebd7c55e9574b2a221
--- /dev/null
+++ b/vendor/oauth2-client/composer.json
@@ -0,0 +1,59 @@
+{
+    "name": "league/oauth2-client",
+    "description": "OAuth 2.0 Client Library",
+    "license": "MIT",
+    "config": {
+        "sort-packages": true
+    },
+    "require": {
+        "php": ">=5.6.0",
+        "guzzlehttp/guzzle": "^6.0",
+        "paragonie/random_compat": "^1|^2"
+    },
+    "require-dev": {
+        "eloquent/liberator": "^2.0",
+        "eloquent/phony": "^0.14.1",
+        "jakub-onderka/php-parallel-lint": "~0.9",
+        "phpunit/phpunit": "^5.0",
+        "squizlabs/php_codesniffer": "^2.0"
+    },
+    "keywords": [
+        "oauth",
+        "oauth2",
+        "authorization",
+        "authentication",
+        "idp",
+        "identity",
+        "sso",
+        "single sign on"
+    ],
+    "authors": [
+        {
+            "name": "Alex Bilbie",
+            "email": "hello@alexbilbie.com",
+            "homepage": "http://www.alexbilbie.com",
+            "role": "Developer"
+        },
+        {
+            "name": "Woody Gilk",
+            "homepage": "https://github.com/shadowhand",
+            "role": "Contributor"
+        }
+
+    ],
+    "autoload": {
+        "psr-4": {
+            "League\\OAuth2\\Client\\": "src/"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "League\\OAuth2\\Client\\Test\\": "test/src/"
+        }
+    },
+    "extra": {
+        "branch-alias": {
+            "dev-2.x": "2.0.x-dev"
+        }
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/AbstractGrant.php b/vendor/oauth2-client/src/Grant/AbstractGrant.php
new file mode 100755
index 0000000000000000000000000000000000000000..2c0244ba3dafc3b0f389d8804fc0c38b51f7a93c
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/AbstractGrant.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+use League\OAuth2\Client\Tool\RequiredParameterTrait;
+
+/**
+ * Represents a type of authorization grant.
+ *
+ * An authorization grant is a credential representing the resource
+ * owner's authorization (to access its protected resources) used by the
+ * client to obtain an access token.  OAuth 2.0 defines four
+ * grant types -- authorization code, implicit, resource owner password
+ * credentials, and client credentials -- as well as an extensibility
+ * mechanism for defining additional types.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.3 Authorization Grant (RFC 6749, §1.3)
+ */
+abstract class AbstractGrant
+{
+    use RequiredParameterTrait;
+
+    /**
+     * Returns the name of this grant, eg. 'grant_name', which is used as the
+     * grant type when encoding URL query parameters.
+     *
+     * @return string
+     */
+    abstract protected function getName();
+
+    /**
+     * Returns a list of all required request parameters.
+     *
+     * @return array
+     */
+    abstract protected function getRequiredRequestParameters();
+
+    /**
+     * Returns this grant's name as its string representation. This allows for
+     * string interpolation when building URL query parameters.
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->getName();
+    }
+
+    /**
+     * Prepares an access token request's parameters by checking that all
+     * required parameters are set, then merging with any given defaults.
+     *
+     * @param  array $defaults
+     * @param  array $options
+     * @return array
+     */
+    public function prepareRequestParameters(array $defaults, array $options)
+    {
+        $defaults['grant_type'] = $this->getName();
+
+        $required = $this->getRequiredRequestParameters();
+        $provided = array_merge($defaults, $options);
+
+        $this->checkRequiredParameters($required, $provided);
+
+        return $provided;
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/AuthorizationCode.php b/vendor/oauth2-client/src/Grant/AuthorizationCode.php
new file mode 100755
index 0000000000000000000000000000000000000000..c49460c02d0337c71caf2574813370b46bb6c171
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/AuthorizationCode.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+/**
+ * Represents an authorization code grant.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.3.1 Authorization Code (RFC 6749, §1.3.1)
+ */
+class AuthorizationCode extends AbstractGrant
+{
+    /**
+     * @inheritdoc
+     */
+    protected function getName()
+    {
+        return 'authorization_code';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getRequiredRequestParameters()
+    {
+        return [
+            'code',
+        ];
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/ClientCredentials.php b/vendor/oauth2-client/src/Grant/ClientCredentials.php
new file mode 100755
index 0000000000000000000000000000000000000000..dc78c4fdab8ba49b0edb31c16252d434490e4268
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/ClientCredentials.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+/**
+ * Represents a client credentials grant.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.3.4 Client Credentials (RFC 6749, §1.3.4)
+ */
+class ClientCredentials extends AbstractGrant
+{
+    /**
+     * @inheritdoc
+     */
+    protected function getName()
+    {
+        return 'client_credentials';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getRequiredRequestParameters()
+    {
+        return [];
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/Exception/InvalidGrantException.php b/vendor/oauth2-client/src/Grant/Exception/InvalidGrantException.php
new file mode 100755
index 0000000000000000000000000000000000000000..c3c4e677b440b08bcb2977593a6bfad8d68219dd
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/Exception/InvalidGrantException.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant\Exception;
+
+use InvalidArgumentException;
+
+/**
+ * Exception thrown if the grant does not extend from AbstractGrant.
+ *
+ * @see League\OAuth2\Client\Grant\AbstractGrant
+ */
+class InvalidGrantException extends InvalidArgumentException
+{
+}
diff --git a/vendor/oauth2-client/src/Grant/GrantFactory.php b/vendor/oauth2-client/src/Grant/GrantFactory.php
new file mode 100755
index 0000000000000000000000000000000000000000..71990e83dbc8aa645e9713e34a9a72c97eca1fdb
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/GrantFactory.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+use League\OAuth2\Client\Grant\Exception\InvalidGrantException;
+
+/**
+ * Represents a factory used when retrieving an authorization grant type.
+ */
+class GrantFactory
+{
+    /**
+     * @var array
+     */
+    protected $registry = [];
+
+    /**
+     * Defines a grant singleton in the registry.
+     *
+     * @param  string $name
+     * @param  AbstractGrant $grant
+     * @return self
+     */
+    public function setGrant($name, AbstractGrant $grant)
+    {
+        $this->registry[$name] = $grant;
+
+        return $this;
+    }
+
+    /**
+     * Returns a grant singleton by name.
+     *
+     * If the grant has not be registered, a default grant will be loaded.
+     *
+     * @param  string $name
+     * @return AbstractGrant
+     */
+    public function getGrant($name)
+    {
+        if (empty($this->registry[$name])) {
+            $this->registerDefaultGrant($name);
+        }
+
+        return $this->registry[$name];
+    }
+
+    /**
+     * Registers a default grant singleton by name.
+     *
+     * @param  string $name
+     * @return self
+     */
+    protected function registerDefaultGrant($name)
+    {
+        // PascalCase the grant. E.g: 'authorization_code' becomes 'AuthorizationCode'
+        $class = str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $name)));
+        $class = 'League\\OAuth2\\Client\\Grant\\' . $class;
+
+        $this->checkGrant($class);
+
+        return $this->setGrant($name, new $class);
+    }
+
+    /**
+     * Determines if a variable is a valid grant.
+     *
+     * @param  mixed $class
+     * @return boolean
+     */
+    public function isGrant($class)
+    {
+        return is_subclass_of($class, AbstractGrant::class);
+    }
+
+    /**
+     * Checks if a variable is a valid grant.
+     *
+     * @throws InvalidGrantException
+     * @param  mixed $class
+     * @return void
+     */
+    public function checkGrant($class)
+    {
+        if (!$this->isGrant($class)) {
+            throw new InvalidGrantException(sprintf(
+                'Grant "%s" must extend AbstractGrant',
+                is_object($class) ? get_class($class) : $class
+            ));
+        }
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/Password.php b/vendor/oauth2-client/src/Grant/Password.php
new file mode 100755
index 0000000000000000000000000000000000000000..6543b2ebd168add5dc5f2230470088eb7310f3ed
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/Password.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+/**
+ * Represents a resource owner password credentials grant.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.3.3 Resource Owner Password Credentials (RFC 6749, §1.3.3)
+ */
+class Password extends AbstractGrant
+{
+    /**
+     * @inheritdoc
+     */
+    protected function getName()
+    {
+        return 'password';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getRequiredRequestParameters()
+    {
+        return [
+            'username',
+            'password',
+        ];
+    }
+}
diff --git a/vendor/oauth2-client/src/Grant/RefreshToken.php b/vendor/oauth2-client/src/Grant/RefreshToken.php
new file mode 100755
index 0000000000000000000000000000000000000000..819218230136bfab80464513aee658459547049c
--- /dev/null
+++ b/vendor/oauth2-client/src/Grant/RefreshToken.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Grant;
+
+/**
+ * Represents a refresh token grant.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-6 Refreshing an Access Token (RFC 6749, §6)
+ */
+class RefreshToken extends AbstractGrant
+{
+    /**
+     * @inheritdoc
+     */
+    protected function getName()
+    {
+        return 'refresh_token';
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getRequiredRequestParameters()
+    {
+        return [
+            'refresh_token',
+        ];
+    }
+}
diff --git a/vendor/oauth2-client/src/Provider/AbstractProvider.php b/vendor/oauth2-client/src/Provider/AbstractProvider.php
new file mode 100755
index 0000000000000000000000000000000000000000..7f3f4c374040571eab7aecdffc93418c89d0791c
--- /dev/null
+++ b/vendor/oauth2-client/src/Provider/AbstractProvider.php
@@ -0,0 +1,820 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Provider;
+
+use GuzzleHttp\Client as HttpClient;
+use GuzzleHttp\ClientInterface as HttpClientInterface;
+use GuzzleHttp\Exception\BadResponseException;
+use League\OAuth2\Client\Grant\AbstractGrant;
+use League\OAuth2\Client\Grant\GrantFactory;
+use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
+use League\OAuth2\Client\Token\AccessToken;
+use League\OAuth2\Client\Tool\ArrayAccessorTrait;
+use League\OAuth2\Client\Tool\QueryBuilderTrait;
+use League\OAuth2\Client\Tool\RequestFactory;
+use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
+use UnexpectedValueException;
+
+/**
+ * Represents a service provider (authorization server).
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.1 Roles (RFC 6749, §1.1)
+ */
+abstract class AbstractProvider
+{
+    use ArrayAccessorTrait;
+    use QueryBuilderTrait;
+
+    /**
+     * @var string Key used in a token response to identify the resource owner.
+     */
+    const ACCESS_TOKEN_RESOURCE_OWNER_ID = null;
+
+    /**
+     * @var string HTTP method used to fetch access tokens.
+     */
+    const METHOD_GET = 'GET';
+
+    /**
+     * @var string HTTP method used to fetch access tokens.
+     */
+    const METHOD_POST = 'POST';
+
+    /**
+     * @var string
+     */
+    protected $clientId;
+
+    /**
+     * @var string
+     */
+    protected $clientSecret;
+
+    /**
+     * @var string
+     */
+    protected $redirectUri;
+
+    /**
+     * @var string
+     */
+    protected $state;
+
+    /**
+     * @var GrantFactory
+     */
+    protected $grantFactory;
+
+    /**
+     * @var RequestFactory
+     */
+    protected $requestFactory;
+
+    /**
+     * @var HttpClientInterface
+     */
+    protected $httpClient;
+
+    /**
+     * Constructs an OAuth 2.0 service provider.
+     *
+     * @param array $options An array of options to set on this provider.
+     *     Options include `clientId`, `clientSecret`, `redirectUri`, and `state`.
+     *     Individual providers may introduce more options, as needed.
+     * @param array $collaborators An array of collaborators that may be used to
+     *     override this provider's default behavior. Collaborators include
+     *     `grantFactory`, `requestFactory`, and `httpClient`.
+     *     Individual providers may introduce more collaborators, as needed.
+     */
+    public function __construct(array $options = [], array $collaborators = [])
+    {
+        foreach ($options as $option => $value) {
+            if (property_exists($this, $option)) {
+                $this->{$option} = $value;
+            }
+        }
+
+        if (empty($collaborators['grantFactory'])) {
+            $collaborators['grantFactory'] = new GrantFactory();
+        }
+        $this->setGrantFactory($collaborators['grantFactory']);
+
+        if (empty($collaborators['requestFactory'])) {
+            $collaborators['requestFactory'] = new RequestFactory();
+        }
+        $this->setRequestFactory($collaborators['requestFactory']);
+
+        if (empty($collaborators['httpClient'])) {
+            $client_options = $this->getAllowedClientOptions($options);
+
+            $collaborators['httpClient'] = new HttpClient(
+                array_intersect_key($options, array_flip($client_options))
+            );
+        }
+        $this->setHttpClient($collaborators['httpClient']);
+    }
+
+    /**
+     * Returns the list of options that can be passed to the HttpClient
+     *
+     * @param array $options An array of options to set on this provider.
+     *     Options include `clientId`, `clientSecret`, `redirectUri`, and `state`.
+     *     Individual providers may introduce more options, as needed.
+     * @return array The options to pass to the HttpClient constructor
+     */
+    protected function getAllowedClientOptions(array $options)
+    {
+        $client_options = ['timeout', 'proxy'];
+
+        // Only allow turning off ssl verification if it's for a proxy
+        if (!empty($options['proxy'])) {
+            $client_options[] = 'verify';
+        }
+
+        return $client_options;
+    }
+
+    /**
+     * Sets the grant factory instance.
+     *
+     * @param  GrantFactory $factory
+     * @return self
+     */
+    public function setGrantFactory(GrantFactory $factory)
+    {
+        $this->grantFactory = $factory;
+
+        return $this;
+    }
+
+    /**
+     * Returns the current grant factory instance.
+     *
+     * @return GrantFactory
+     */
+    public function getGrantFactory()
+    {
+        return $this->grantFactory;
+    }
+
+    /**
+     * Sets the request factory instance.
+     *
+     * @param  RequestFactory $factory
+     * @return self
+     */
+    public function setRequestFactory(RequestFactory $factory)
+    {
+        $this->requestFactory = $factory;
+
+        return $this;
+    }
+
+    /**
+     * Returns the request factory instance.
+     *
+     * @return RequestFactory
+     */
+    public function getRequestFactory()
+    {
+        return $this->requestFactory;
+    }
+
+    /**
+     * Sets the HTTP client instance.
+     *
+     * @param  HttpClientInterface $client
+     * @return self
+     */
+    public function setHttpClient(HttpClientInterface $client)
+    {
+        $this->httpClient = $client;
+
+        return $this;
+    }
+
+    /**
+     * Returns the HTTP client instance.
+     *
+     * @return HttpClientInterface
+     */
+    public function getHttpClient()
+    {
+        return $this->httpClient;
+    }
+
+    /**
+     * Returns the current value of the state parameter.
+     *
+     * This can be accessed by the redirect handler during authorization.
+     *
+     * @return string
+     */
+    public function getState()
+    {
+        return $this->state;
+    }
+
+    /**
+     * Returns the base URL for authorizing a client.
+     *
+     * Eg. https://oauth.service.com/authorize
+     *
+     * @return string
+     */
+    abstract public function getBaseAuthorizationUrl();
+
+    /**
+     * Returns the base URL for requesting an access token.
+     *
+     * Eg. https://oauth.service.com/token
+     *
+     * @param array $params
+     * @return string
+     */
+    abstract public function getBaseAccessTokenUrl(array $params);
+
+    /**
+     * Returns the URL for requesting the resource owner's details.
+     *
+     * @param AccessToken $token
+     * @return string
+     */
+    abstract public function getResourceOwnerDetailsUrl(AccessToken $token);
+
+    /**
+     * Returns a new random string to use as the state parameter in an
+     * authorization flow.
+     *
+     * @param  int $length Length of the random string to be generated.
+     * @return string
+     */
+    protected function getRandomState($length = 32)
+    {
+        // Converting bytes to hex will always double length. Hence, we can reduce
+        // the amount of bytes by half to produce the correct length.
+        return bin2hex(random_bytes($length / 2));
+    }
+
+    /**
+     * Returns the default scopes used by this provider.
+     *
+     * This should only be the scopes that are required to request the details
+     * of the resource owner, rather than all the available scopes.
+     *
+     * @return array
+     */
+    abstract protected function getDefaultScopes();
+
+    /**
+     * Returns the string that should be used to separate scopes when building
+     * the URL for requesting an access token.
+     *
+     * @return string Scope separator, defaults to ','
+     */
+    protected function getScopeSeparator()
+    {
+        return ',';
+    }
+
+    /**
+     * Returns authorization parameters based on provided options.
+     *
+     * @param  array $options
+     * @return array Authorization parameters
+     */
+    protected function getAuthorizationParameters(array $options)
+    {
+        if (empty($options['state'])) {
+            $options['state'] = $this->getRandomState();
+        }
+
+        if (empty($options['scope'])) {
+            $options['scope'] = $this->getDefaultScopes();
+        }
+
+        $options += [
+            'response_type'   => 'code',
+            'approval_prompt' => 'auto'
+        ];
+
+        if (is_array($options['scope'])) {
+            $separator = $this->getScopeSeparator();
+            $options['scope'] = implode($separator, $options['scope']);
+        }
+
+        // Store the state as it may need to be accessed later on.
+        $this->state = $options['state'];
+
+        // Business code layer might set a different redirect_uri parameter
+        // depending on the context, leave it as-is
+        if (!isset($options['redirect_uri'])) {
+            $options['redirect_uri'] = $this->redirectUri;
+        }
+
+        $options['client_id'] = $this->clientId;
+
+        return $options;
+    }
+
+    /**
+     * Builds the authorization URL's query string.
+     *
+     * @param  array $params Query parameters
+     * @return string Query string
+     */
+    protected function getAuthorizationQuery(array $params)
+    {
+        return $this->buildQueryString($params);
+    }
+
+    /**
+     * Builds the authorization URL.
+     *
+     * @param  array $options
+     * @return string Authorization URL
+     */
+    public function getAuthorizationUrl(array $options = [])
+    {
+        $base   = $this->getBaseAuthorizationUrl();
+        $params = $this->getAuthorizationParameters($options);
+        $query  = $this->getAuthorizationQuery($params);
+
+        return $this->appendQuery($base, $query);
+    }
+
+    /**
+     * Redirects the client for authorization.
+     *
+     * @param  array $options
+     * @param  callable|null $redirectHandler
+     * @return mixed
+     */
+    public function authorize(
+        array $options = [],
+        callable $redirectHandler = null
+    ) {
+        $url = $this->getAuthorizationUrl($options);
+        if ($redirectHandler) {
+            return $redirectHandler($url, $this);
+        }
+
+        // @codeCoverageIgnoreStart
+        header('Location: ' . $url);
+        exit;
+        // @codeCoverageIgnoreEnd
+    }
+
+    /**
+     * Appends a query string to a URL.
+     *
+     * @param  string $url The URL to append the query to
+     * @param  string $query The HTTP query string
+     * @return string The resulting URL
+     */
+    protected function appendQuery($url, $query)
+    {
+        $query = trim($query, '?&');
+
+        if ($query) {
+            $glue = strstr($url, '?') === false ? '?' : '&';
+            return $url . $glue . $query;
+        }
+
+        return $url;
+    }
+
+    /**
+     * Returns the method to use when requesting an access token.
+     *
+     * @return string HTTP method
+     */
+    protected function getAccessTokenMethod()
+    {
+        return self::METHOD_POST;
+    }
+
+    /**
+     * Returns the key used in the access token response to identify the resource owner.
+     *
+     * @return string|null Resource owner identifier key
+     */
+    protected function getAccessTokenResourceOwnerId()
+    {
+        return static::ACCESS_TOKEN_RESOURCE_OWNER_ID;
+    }
+
+    /**
+     * Builds the access token URL's query string.
+     *
+     * @param  array $params Query parameters
+     * @return string Query string
+     */
+    protected function getAccessTokenQuery(array $params)
+    {
+        return $this->buildQueryString($params);
+    }
+
+    /**
+     * Checks that a provided grant is valid, or attempts to produce one if the
+     * provided grant is a string.
+     *
+     * @param  AbstractGrant|string $grant
+     * @return AbstractGrant
+     */
+    protected function verifyGrant($grant)
+    {
+        if (is_string($grant)) {
+            return $this->grantFactory->getGrant($grant);
+        }
+
+        $this->grantFactory->checkGrant($grant);
+        return $grant;
+    }
+
+    /**
+     * Returns the full URL to use when requesting an access token.
+     *
+     * @param array $params Query parameters
+     * @return string
+     */
+    protected function getAccessTokenUrl(array $params)
+    {
+        $url = $this->getBaseAccessTokenUrl($params);
+
+        if ($this->getAccessTokenMethod() === self::METHOD_GET) {
+            $query = $this->getAccessTokenQuery($params);
+            return $this->appendQuery($url, $query);
+        }
+
+        return $url;
+    }
+
+    /**
+     * Returns the request body for requesting an access token.
+     *
+     * @param  array $params
+     * @return string
+     */
+    protected function getAccessTokenBody(array $params)
+    {
+        return $this->buildQueryString($params);
+    }
+
+    /**
+     * Builds request options used for requesting an access token.
+     *
+     * @param  array $params
+     * @return array
+     */
+    protected function getAccessTokenOptions(array $params)
+    {
+        $options = ['headers' => ['content-type' => 'application/x-www-form-urlencoded']];
+
+        if ($this->getAccessTokenMethod() === self::METHOD_POST) {
+            $options['body'] = $this->getAccessTokenBody($params);
+        }
+
+        return $options;
+    }
+
+    /**
+     * Returns a prepared request for requesting an access token.
+     *
+     * @param array $params Query string parameters
+     * @return RequestInterface
+     */
+    protected function getAccessTokenRequest(array $params)
+    {
+        $method  = $this->getAccessTokenMethod();
+        $url     = $this->getAccessTokenUrl($params);
+        $options = $this->getAccessTokenOptions($params);
+
+        return $this->getRequest($method, $url, $options);
+    }
+
+    /**
+     * Requests an access token using a specified grant and option set.
+     *
+     * @param  mixed $grant
+     * @param  array $options
+     * @return AccessToken
+     */
+    public function getAccessToken($grant, array $options = [])
+    {
+        $grant = $this->verifyGrant($grant);
+
+        $params = [
+            'client_id'     => $this->clientId,
+            'client_secret' => $this->clientSecret,
+            'redirect_uri'  => $this->redirectUri,
+        ];
+
+        $params   = $grant->prepareRequestParameters($params, $options);
+        $request  = $this->getAccessTokenRequest($params);
+        $response = $this->getParsedResponse($request);
+        $prepared = $this->prepareAccessTokenResponse($response);
+        $token    = $this->createAccessToken($prepared, $grant);
+
+        return $token;
+    }
+
+    /**
+     * Returns a PSR-7 request instance that is not authenticated.
+     *
+     * @param  string $method
+     * @param  string $url
+     * @param  array $options
+     * @return RequestInterface
+     */
+    public function getRequest($method, $url, array $options = [])
+    {
+        return $this->createRequest($method, $url, null, $options);
+    }
+
+    /**
+     * Returns an authenticated PSR-7 request instance.
+     *
+     * @param  string $method
+     * @param  string $url
+     * @param  AccessToken|string $token
+     * @param  array $options Any of "headers", "body", and "protocolVersion".
+     * @return RequestInterface
+     */
+    public function getAuthenticatedRequest($method, $url, $token, array $options = [])
+    {
+        return $this->createRequest($method, $url, $token, $options);
+    }
+
+    /**
+     * Creates a PSR-7 request instance.
+     *
+     * @param  string $method
+     * @param  string $url
+     * @param  AccessToken|string|null $token
+     * @param  array $options
+     * @return RequestInterface
+     */
+    protected function createRequest($method, $url, $token, array $options)
+    {
+        $defaults = [
+            'headers' => $this->getHeaders($token),
+        ];
+
+        $options = array_merge_recursive($defaults, $options);
+        $factory = $this->getRequestFactory();
+
+        return $factory->getRequestWithOptions($method, $url, $options);
+    }
+
+    /**
+     * Sends a request instance and returns a response instance.
+     *
+     * WARNING: This method does not attempt to catch exceptions caused by HTTP
+     * errors! It is recommended to wrap this method in a try/catch block.
+     *
+     * @param  RequestInterface $request
+     * @return ResponseInterface
+     */
+    public function getResponse(RequestInterface $request)
+    {
+        return $this->getHttpClient()->send($request);
+    }
+
+    /**
+     * Sends a request and returns the parsed response.
+     *
+     * @param  RequestInterface $request
+     * @return mixed
+     */
+    public function getParsedResponse(RequestInterface $request)
+    {
+        try {
+            $response = $this->getResponse($request);
+        } catch (BadResponseException $e) {
+            $response = $e->getResponse();
+        }
+
+        $parsed = $this->parseResponse($response);
+
+        $this->checkResponse($response, $parsed);
+
+        return $parsed;
+    }
+
+    /**
+     * Attempts to parse a JSON response.
+     *
+     * @param  string $content JSON content from response body
+     * @return array Parsed JSON data
+     * @throws UnexpectedValueException if the content could not be parsed
+     */
+    protected function parseJson($content)
+    {
+        $content = json_decode($content, true);
+
+        if (json_last_error() !== JSON_ERROR_NONE) {
+            throw new UnexpectedValueException(sprintf(
+                "Failed to parse JSON response: %s",
+                json_last_error_msg()
+            ));
+        }
+
+        return $content;
+    }
+
+    /**
+     * Returns the content type header of a response.
+     *
+     * @param  ResponseInterface $response
+     * @return string Semi-colon separated join of content-type headers.
+     */
+    protected function getContentType(ResponseInterface $response)
+    {
+        return join(';', (array) $response->getHeader('content-type'));
+    }
+
+    /**
+     * Parses the response according to its content-type header.
+     *
+     * @throws UnexpectedValueException
+     * @param  ResponseInterface $response
+     * @return array
+     */
+    protected function parseResponse(ResponseInterface $response)
+    {
+        $content = (string) $response->getBody();
+        $type = $this->getContentType($response);
+
+        if (strpos($type, 'urlencoded') !== false) {
+            parse_str($content, $parsed);
+            return $parsed;
+        }
+
+        // Attempt to parse the string as JSON regardless of content type,
+        // since some providers use non-standard content types. Only throw an
+        // exception if the JSON could not be parsed when it was expected to.
+        try {
+            return $this->parseJson($content);
+        } catch (UnexpectedValueException $e) {
+            if (strpos($type, 'json') !== false) {
+                throw $e;
+            }
+
+            if ($response->getStatusCode() == 500) {
+                throw new UnexpectedValueException(
+                    'An OAuth server error was encountered that did not contain a JSON body',
+                    0,
+                    $e
+                );
+            }
+
+            return $content;
+        }
+    }
+
+    /**
+     * Checks a provider response for errors.
+     *
+     * @throws IdentityProviderException
+     * @param  ResponseInterface $response
+     * @param  array|string $data Parsed response data
+     * @return void
+     */
+    abstract protected function checkResponse(ResponseInterface $response, $data);
+
+    /**
+     * Prepares an parsed access token response for a grant.
+     *
+     * Custom mapping of expiration, etc should be done here. Always call the
+     * parent method when overloading this method.
+     *
+     * @param  mixed $result
+     * @return array
+     */
+    protected function prepareAccessTokenResponse(array $result)
+    {
+        if ($this->getAccessTokenResourceOwnerId() !== null) {
+            $result['resource_owner_id'] = $this->getValueByKey(
+                $result,
+                $this->getAccessTokenResourceOwnerId()
+            );
+        }
+        return $result;
+    }
+
+    /**
+     * Creates an access token from a response.
+     *
+     * The grant that was used to fetch the response can be used to provide
+     * additional context.
+     *
+     * @param  array $response
+     * @param  AbstractGrant $grant
+     * @return AccessToken
+     */
+    protected function createAccessToken(array $response, AbstractGrant $grant)
+    {
+        return new AccessToken($response);
+    }
+
+    /**
+     * Generates a resource owner object from a successful resource owner
+     * details request.
+     *
+     * @param  array $response
+     * @param  AccessToken $token
+     * @return ResourceOwnerInterface
+     */
+    abstract protected function createResourceOwner(array $response, AccessToken $token);
+
+    /**
+     * Requests and returns the resource owner of given access token.
+     *
+     * @param  AccessToken $token
+     * @return ResourceOwnerInterface
+     */
+    public function getResourceOwner(AccessToken $token)
+    {
+        $response = $this->fetchResourceOwnerDetails($token);
+
+        return $this->createResourceOwner($response, $token);
+    }
+
+    /**
+     * Requests resource owner details.
+     *
+     * @param  AccessToken $token
+     * @return mixed
+     */
+    protected function fetchResourceOwnerDetails(AccessToken $token)
+    {
+        $url = $this->getResourceOwnerDetailsUrl($token);
+
+        $request = $this->getAuthenticatedRequest(self::METHOD_GET, $url, $token);
+
+        return $this->getParsedResponse($request);
+    }
+
+    /**
+     * Returns the default headers used by this provider.
+     *
+     * Typically this is used to set 'Accept' or 'Content-Type' headers.
+     *
+     * @return array
+     */
+    protected function getDefaultHeaders()
+    {
+        return [];
+    }
+
+    /**
+     * Returns the authorization headers used by this provider.
+     *
+     * Typically this is "Bearer" or "MAC". For more information see:
+     * http://tools.ietf.org/html/rfc6749#section-7.1
+     *
+     * No default is provided, providers must overload this method to activate
+     * authorization headers.
+     *
+     * @param  mixed|null $token Either a string or an access token instance
+     * @return array
+     */
+    protected function getAuthorizationHeaders($token = null)
+    {
+        return [];
+    }
+
+    /**
+     * Returns all headers used by this provider for a request.
+     *
+     * The request will be authenticated if an access token is provided.
+     *
+     * @param  mixed|null $token object or string
+     * @return array
+     */
+    public function getHeaders($token = null)
+    {
+        if ($token) {
+            return array_merge(
+                $this->getDefaultHeaders(),
+                $this->getAuthorizationHeaders($token)
+            );
+        }
+
+        return $this->getDefaultHeaders();
+    }
+}
diff --git a/vendor/oauth2-client/src/Provider/Exception/IdentityProviderException.php b/vendor/oauth2-client/src/Provider/Exception/IdentityProviderException.php
new file mode 100755
index 0000000000000000000000000000000000000000..52b7e0353cc79a293bcd8fd117e4ef934c93fcd3
--- /dev/null
+++ b/vendor/oauth2-client/src/Provider/Exception/IdentityProviderException.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Provider\Exception;
+
+/**
+ * Exception thrown if the provider response contains errors.
+ */
+class IdentityProviderException extends \Exception
+{
+    /**
+     * @var mixed
+     */
+    protected $response;
+
+    /**
+     * @param string $message
+     * @param int $code
+     * @param array|string $response The response body
+     */
+    public function __construct($message, $code, $response)
+    {
+        $this->response = $response;
+
+        parent::__construct($message, $code);
+    }
+
+    /**
+     * Returns the exception's response body.
+     *
+     * @return array|string
+     */
+    public function getResponseBody()
+    {
+        return $this->response;
+    }
+}
diff --git a/vendor/oauth2-client/src/Provider/GenericProvider.php b/vendor/oauth2-client/src/Provider/GenericProvider.php
new file mode 100755
index 0000000000000000000000000000000000000000..d25d25e9cbf825ad232648b9a5fbe0c63628a260
--- /dev/null
+++ b/vendor/oauth2-client/src/Provider/GenericProvider.php
@@ -0,0 +1,227 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Provider;
+
+use InvalidArgumentException;
+use League\OAuth2\Client\Provider\Exception\IdentityProviderException;
+use League\OAuth2\Client\Token\AccessToken;
+use League\OAuth2\Client\Tool\BearerAuthorizationTrait;
+use Psr\Http\Message\ResponseInterface;
+
+/**
+ * Represents a generic service provider that may be used to interact with any
+ * OAuth 2.0 service provider, using Bearer token authentication.
+ */
+class GenericProvider extends AbstractProvider
+{
+    use BearerAuthorizationTrait;
+
+    /**
+     * @var string
+     */
+    private $urlAuthorize;
+
+    /**
+     * @var string
+     */
+    private $urlAccessToken;
+
+    /**
+     * @var string
+     */
+    private $urlResourceOwnerDetails;
+
+    /**
+     * @var string
+     */
+    private $accessTokenMethod;
+
+    /**
+     * @var string
+     */
+    private $accessTokenResourceOwnerId;
+
+    /**
+     * @var array|null
+     */
+    private $scopes = null;
+
+    /**
+     * @var string
+     */
+    private $scopeSeparator;
+
+    /**
+     * @var string
+     */
+    private $responseError = 'error';
+
+    /**
+     * @var string
+     */
+    private $responseCode;
+
+    /**
+     * @var string
+     */
+    private $responseResourceOwnerId = 'id';
+
+    /**
+     * @param array $options
+     * @param array $collaborators
+     */
+    public function __construct(array $options = [], array $collaborators = [])
+    {
+        $this->assertRequiredOptions($options);
+
+        $possible   = $this->getConfigurableOptions();
+        $configured = array_intersect_key($options, array_flip($possible));
+
+        foreach ($configured as $key => $value) {
+            $this->$key = $value;
+        }
+
+        // Remove all options that are only used locally
+        $options = array_diff_key($options, $configured);
+
+        parent::__construct($options, $collaborators);
+    }
+
+    /**
+     * Returns all options that can be configured.
+     *
+     * @return array
+     */
+    protected function getConfigurableOptions()
+    {
+        return array_merge($this->getRequiredOptions(), [
+            'accessTokenMethod',
+            'accessTokenResourceOwnerId',
+            'scopeSeparator',
+            'responseError',
+            'responseCode',
+            'responseResourceOwnerId',
+            'scopes',
+        ]);
+    }
+
+    /**
+     * Returns all options that are required.
+     *
+     * @return array
+     */
+    protected function getRequiredOptions()
+    {
+        return [
+            'urlAuthorize',
+            'urlAccessToken',
+            'urlResourceOwnerDetails',
+        ];
+    }
+
+    /**
+     * Verifies that all required options have been passed.
+     *
+     * @param  array $options
+     * @return void
+     * @throws InvalidArgumentException
+     */
+    private function assertRequiredOptions(array $options)
+    {
+        $missing = array_diff_key(array_flip($this->getRequiredOptions()), $options);
+
+        if (!empty($missing)) {
+            throw new InvalidArgumentException(
+                'Required options not defined: ' . implode(', ', array_keys($missing))
+            );
+        }
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getBaseAuthorizationUrl()
+    {
+        return $this->urlAuthorize;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getBaseAccessTokenUrl(array $params)
+    {
+        return $this->urlAccessToken;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getResourceOwnerDetailsUrl(AccessToken $token)
+    {
+        return $this->urlResourceOwnerDetails;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getDefaultScopes()
+    {
+        return $this->scopes;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getAccessTokenMethod()
+    {
+        return $this->accessTokenMethod ?: parent::getAccessTokenMethod();
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getAccessTokenResourceOwnerId()
+    {
+        return $this->accessTokenResourceOwnerId ?: parent::getAccessTokenResourceOwnerId();
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function getScopeSeparator()
+    {
+        return $this->scopeSeparator ?: parent::getScopeSeparator();
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function checkResponse(ResponseInterface $response, $data)
+    {
+        if (!empty($data[$this->responseError])) {
+            $error = $data[$this->responseError];
+            $code  = $this->responseCode ? $data[$this->responseCode] : 0;
+            throw new IdentityProviderException($error, $code, $data);
+        }
+    }
+
+    /**
+     * @inheritdoc
+     */
+    protected function createResourceOwner(array $response, AccessToken $token)
+    {
+        return new GenericResourceOwner($response, $this->responseResourceOwnerId);
+    }
+}
diff --git a/vendor/oauth2-client/src/Provider/GenericResourceOwner.php b/vendor/oauth2-client/src/Provider/GenericResourceOwner.php
new file mode 100755
index 0000000000000000000000000000000000000000..f8766148514ec2a39a21d5986dd3f5b2c5b56367
--- /dev/null
+++ b/vendor/oauth2-client/src/Provider/GenericResourceOwner.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Provider;
+
+/**
+ * Represents a generic resource owner for use with the GenericProvider.
+ */
+class GenericResourceOwner implements ResourceOwnerInterface
+{
+    /**
+     * @var array
+     */
+    protected $response;
+
+    /**
+     * @var string
+     */
+    protected $resourceOwnerId;
+
+    /**
+     * @param array $response
+     * @param string $resourceOwnerId
+     */
+    public function __construct(array $response, $resourceOwnerId)
+    {
+        $this->response = $response;
+        $this->resourceOwnerId = $resourceOwnerId;
+    }
+
+    /**
+     * Returns the identifier of the authorized resource owner.
+     *
+     * @return mixed
+     */
+    public function getId()
+    {
+        return $this->response[$this->resourceOwnerId];
+    }
+
+    /**
+     * Returns the raw resource owner response.
+     *
+     * @return array
+     */
+    public function toArray()
+    {
+        return $this->response;
+    }
+}
diff --git a/vendor/oauth2-client/src/Provider/ResourceOwnerInterface.php b/vendor/oauth2-client/src/Provider/ResourceOwnerInterface.php
new file mode 100755
index 0000000000000000000000000000000000000000..828442425fa2aa545cbab2c2a00a93364d077416
--- /dev/null
+++ b/vendor/oauth2-client/src/Provider/ResourceOwnerInterface.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Provider;
+
+/**
+ * Classes implementing `ResourceOwnerInterface` may be used to represent
+ * the resource owner authenticated with a service provider.
+ */
+interface ResourceOwnerInterface
+{
+    /**
+     * Returns the identifier of the authorized resource owner.
+     *
+     * @return mixed
+     */
+    public function getId();
+
+    /**
+     * Return all of the owner details available as an array.
+     *
+     * @return array
+     */
+    public function toArray();
+}
diff --git a/vendor/oauth2-client/src/Token/AccessToken.php b/vendor/oauth2-client/src/Token/AccessToken.php
new file mode 100755
index 0000000000000000000000000000000000000000..89d693c6f50d37b2e614d320b0a3cc55e797fc16
--- /dev/null
+++ b/vendor/oauth2-client/src/Token/AccessToken.php
@@ -0,0 +1,228 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Token;
+
+use InvalidArgumentException;
+use JsonSerializable;
+use RuntimeException;
+
+/**
+ * Represents an access token.
+ *
+ * @link http://tools.ietf.org/html/rfc6749#section-1.4 Access Token (RFC 6749, §1.4)
+ */
+class AccessToken implements JsonSerializable
+{
+    /**
+     * @var string
+     */
+    protected $accessToken;
+
+    /**
+     * @var int
+     */
+    protected $expires;
+
+    /**
+     * @var string
+     */
+    protected $refreshToken;
+
+    /**
+     * @var string
+     */
+    protected $resourceOwnerId;
+
+    /**
+     * @var array
+     */
+    protected $values = [];
+
+    /**
+     * Constructs an access token.
+     *
+     * @param array $options An array of options returned by the service provider
+     *     in the access token request. The `access_token` option is required.
+     * @throws InvalidArgumentException if `access_token` is not provided in `$options`.
+     */
+    public function __construct(array $options = [])
+    {
+        if (empty($options['access_token'])) {
+            throw new InvalidArgumentException('Required option not passed: "access_token"');
+        }
+
+        $this->accessToken = $options['access_token'];
+
+        if (!empty($options['resource_owner_id'])) {
+            $this->resourceOwnerId = $options['resource_owner_id'];
+        }
+
+        if (!empty($options['refresh_token'])) {
+            $this->refreshToken = $options['refresh_token'];
+        }
+
+        // We need to know when the token expires. Show preference to
+        // 'expires_in' since it is defined in RFC6749 Section 5.1.
+        // Defer to 'expires' if it is provided instead.
+        if (isset($options['expires_in'])) {
+            if (!is_numeric($options['expires_in'])) {
+                throw new \InvalidArgumentException('expires_in value must be an integer');
+            }
+
+            $this->expires = $options['expires_in'] != 0 ? time() + $options['expires_in'] : 0;
+        } elseif (!empty($options['expires'])) {
+            // Some providers supply the seconds until expiration rather than
+            // the exact timestamp. Take a best guess at which we received.
+            $expires = $options['expires'];
+
+            if (!$this->isExpirationTimestamp($expires)) {
+                $expires += time();
+            }
+
+            $this->expires = $expires;
+        }
+
+        // Capture any additional values that might exist in the token but are
+        // not part of the standard response. Vendors will sometimes pass
+        // additional user data this way.
+        $this->values = array_diff_key($options, array_flip([
+            'access_token',
+            'resource_owner_id',
+            'refresh_token',
+            'expires_in',
+            'expires',
+        ]));
+    }
+
+    /**
+     * Check if a value is an expiration timestamp or second value.
+     *
+     * @param integer $value
+     * @return bool
+     */
+    protected function isExpirationTimestamp($value)
+    {
+        // If the given value is larger than the original OAuth 2 draft date,
+        // assume that it is meant to be a (possible expired) timestamp.
+        $oauth2InceptionDate = 1349067600; // 2012-10-01
+        return ($value > $oauth2InceptionDate);
+    }
+
+    /**
+     * Returns the access token string of this instance.
+     *
+     * @return string
+     */
+    public function getToken()
+    {
+        return $this->accessToken;
+    }
+
+    /**
+     * Returns the refresh token, if defined.
+     *
+     * @return string|null
+     */
+    public function getRefreshToken()
+    {
+        return $this->refreshToken;
+    }
+
+    /**
+     * Returns the expiration timestamp, if defined.
+     *
+     * @return integer|null
+     */
+    public function getExpires()
+    {
+        return $this->expires;
+    }
+
+    /**
+     * Returns the resource owner identifier, if defined.
+     *
+     * @return string|null
+     */
+    public function getResourceOwnerId()
+    {
+        return $this->resourceOwnerId;
+    }
+
+    /**
+     * Checks if this token has expired.
+     *
+     * @return boolean true if the token has expired, false otherwise.
+     * @throws RuntimeException if 'expires' is not set on the token.
+     */
+    public function hasExpired()
+    {
+        $expires = $this->getExpires();
+
+        if (empty($expires)) {
+            throw new RuntimeException('"expires" is not set on the token');
+        }
+
+        return $expires < time();
+    }
+
+    /**
+     * Returns additional vendor values stored in the token.
+     *
+     * @return array
+     */
+    public function getValues()
+    {
+        return $this->values;
+    }
+
+    /**
+     * Returns the token key.
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return (string) $this->getToken();
+    }
+
+    /**
+     * Returns an array of parameters to serialize when this is serialized with
+     * json_encode().
+     *
+     * @return array
+     */
+    public function jsonSerialize()
+    {
+        $parameters = $this->values;
+
+        if ($this->accessToken) {
+            $parameters['access_token'] = $this->accessToken;
+        }
+
+        if ($this->refreshToken) {
+            $parameters['refresh_token'] = $this->refreshToken;
+        }
+
+        if ($this->expires) {
+            $parameters['expires'] = $this->expires;
+        }
+
+        if ($this->resourceOwnerId) {
+            $parameters['resource_owner_id'] = $this->resourceOwnerId;
+        }
+
+        return $parameters;
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/ArrayAccessorTrait.php b/vendor/oauth2-client/src/Tool/ArrayAccessorTrait.php
new file mode 100755
index 0000000000000000000000000000000000000000..a18198cf30d40cfd06829cbba20dc496617cad06
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/ArrayAccessorTrait.php
@@ -0,0 +1,52 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+/**
+ * Provides generic array navigation tools.
+ */
+trait ArrayAccessorTrait
+{
+    /**
+     * Returns a value by key using dot notation.
+     *
+     * @param  array      $data
+     * @param  string     $key
+     * @param  mixed|null $default
+     * @return mixed
+     */
+    private function getValueByKey(array $data, $key, $default = null)
+    {
+        if (!is_string($key) || empty($key) || !count($data)) {
+            return $default;
+        }
+
+        if (strpos($key, '.') !== false) {
+            $keys = explode('.', $key);
+
+            foreach ($keys as $innerKey) {
+                if (!is_array($data) || !array_key_exists($innerKey, $data)) {
+                    return $default;
+                }
+
+                $data = $data[$innerKey];
+            }
+
+            return $data;
+        }
+
+        return array_key_exists($key, $data) ? $data[$key] : $default;
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/BearerAuthorizationTrait.php b/vendor/oauth2-client/src/Tool/BearerAuthorizationTrait.php
new file mode 100755
index 0000000000000000000000000000000000000000..967cca868c9df2b551251d7a2dbd32d090e11737
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/BearerAuthorizationTrait.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+/**
+ * Enables `Bearer` header authorization for providers.
+ *
+ * @link http://tools.ietf.org/html/rfc6750 Bearer Token Usage (RFC 6750)
+ */
+trait BearerAuthorizationTrait
+{
+    /**
+     * Returns authorization headers for the 'bearer' grant.
+     *
+     * @param  mixed|null $token Either a string or an access token instance
+     * @return array
+     */
+    protected function getAuthorizationHeaders($token = null)
+    {
+        return ['Authorization' => 'Bearer ' . $token];
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/MacAuthorizationTrait.php b/vendor/oauth2-client/src/Tool/MacAuthorizationTrait.php
new file mode 100755
index 0000000000000000000000000000000000000000..d36c00ad61d106ca98698148fdc20b84c5b61e3a
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/MacAuthorizationTrait.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+use League\OAuth2\Client\Token\AccessToken;
+
+/**
+ * Enables `MAC` header authorization for providers.
+ *
+ * @link http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-05 Message Authentication Code (MAC) Tokens
+ */
+trait MacAuthorizationTrait
+{
+    /**
+     * Returns the id of this token for MAC generation.
+     *
+     * @param  AccessToken $token
+     * @return string
+     */
+    abstract protected function getTokenId(AccessToken $token);
+
+    /**
+     * Returns the MAC signature for the current request.
+     *
+     * @param  string $id
+     * @param  integer $ts
+     * @param  string $nonce
+     * @return string
+     */
+    abstract protected function getMacSignature($id, $ts, $nonce);
+
+    /**
+     * Returns a new random string to use as the state parameter in an
+     * authorization flow.
+     *
+     * @param  int $length Length of the random string to be generated.
+     * @return string
+     */
+    abstract protected function getRandomState($length);
+
+    /**
+     * Returns the authorization headers for the 'mac' grant.
+     *
+     * @param  AccessToken $token
+     * @return array
+     * @codeCoverageIgnore
+     *
+     * @todo This is currently untested and provided only as an example. If you
+     * complete the implementation, please create a pull request for
+     * https://github.com/thephpleague/oauth2-client
+     */
+    protected function getAuthorizationHeaders($token)
+    {
+        $ts    = time();
+        $id    = $this->getTokenId($token);
+        $nonce = $this->getRandomState(16);
+        $mac   = $this->getMacSignature($id, $ts, $nonce);
+
+        $parts = [];
+        foreach (compact('id', 'ts', 'nonce', 'mac') as $key => $value) {
+            $parts[] = sprintf('%s="%s"', $key, $value);
+        }
+
+        return ['Authorization' => 'MAC ' . implode(', ', $parts)];
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/QueryBuilderTrait.php b/vendor/oauth2-client/src/Tool/QueryBuilderTrait.php
new file mode 100755
index 0000000000000000000000000000000000000000..ebccdffc6e601e95e2f2149ae396a1710909290e
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/QueryBuilderTrait.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+/**
+ * Provides a standard way to generate query strings.
+ */
+trait QueryBuilderTrait
+{
+    /**
+     * Build a query string from an array.
+     *
+     * @param array $params
+     *
+     * @return string
+     */
+    protected function buildQueryString(array $params)
+    {
+        return http_build_query($params, null, '&', \PHP_QUERY_RFC3986);
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/RequestFactory.php b/vendor/oauth2-client/src/Tool/RequestFactory.php
new file mode 100755
index 0000000000000000000000000000000000000000..1af434297ff854f26fba9af4d9db40037ed77efb
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/RequestFactory.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+use GuzzleHttp\Psr7\Request;
+
+/**
+ * Used to produce PSR-7 Request instances.
+ *
+ * @link https://github.com/guzzle/guzzle/pull/1101
+ */
+class RequestFactory
+{
+    /**
+     * Creates a PSR-7 Request instance.
+     *
+     * @param  null|string $method HTTP method for the request.
+     * @param  null|string $uri URI for the request.
+     * @param  array $headers Headers for the message.
+     * @param  string|resource|StreamInterface $body Message body.
+     * @param  string $version HTTP protocol version.
+     *
+     * @return Request
+     */
+    public function getRequest(
+        $method,
+        $uri,
+        array $headers = [],
+        $body = null,
+        $version = '1.1'
+    ) {
+        return new Request($method, $uri, $headers, $body, $version);
+    }
+
+    /**
+     * Parses simplified options.
+     *
+     * @param array $options Simplified options.
+     *
+     * @return array Extended options for use with getRequest.
+     */
+    protected function parseOptions(array $options)
+    {
+        // Should match default values for getRequest
+        $defaults = [
+            'headers' => [],
+            'body'    => null,
+            'version' => '1.1',
+        ];
+
+        return array_merge($defaults, $options);
+    }
+
+    /**
+     * Creates a request using a simplified array of options.
+     *
+     * @param  null|string $method
+     * @param  null|string $uri
+     * @param  array $options
+     *
+     * @return Request
+     */
+    public function getRequestWithOptions($method, $uri, array $options = [])
+    {
+        $options = $this->parseOptions($options);
+
+        return $this->getRequest(
+            $method,
+            $uri,
+            $options['headers'],
+            $options['body'],
+            $options['version']
+        );
+    }
+}
diff --git a/vendor/oauth2-client/src/Tool/RequiredParameterTrait.php b/vendor/oauth2-client/src/Tool/RequiredParameterTrait.php
new file mode 100755
index 0000000000000000000000000000000000000000..47da9771779bbf4026c2cb93e3dff1db71fcf263
--- /dev/null
+++ b/vendor/oauth2-client/src/Tool/RequiredParameterTrait.php
@@ -0,0 +1,56 @@
+<?php
+/**
+ * This file is part of the league/oauth2-client library
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @copyright Copyright (c) Alex Bilbie <hello@alexbilbie.com>
+ * @license http://opensource.org/licenses/MIT MIT
+ * @link http://thephpleague.com/oauth2-client/ Documentation
+ * @link https://packagist.org/packages/league/oauth2-client Packagist
+ * @link https://github.com/thephpleague/oauth2-client GitHub
+ */
+
+namespace League\OAuth2\Client\Tool;
+
+use BadMethodCallException;
+
+/**
+ * Provides functionality to check for required parameters.
+ */
+trait RequiredParameterTrait
+{
+    /**
+     * Checks for a required parameter in a hash.
+     *
+     * @throws BadMethodCallException
+     * @param  string $name
+     * @param  array  $params
+     * @return void
+     */
+    private function checkRequiredParameter($name, array $params)
+    {
+        if (!isset($params[$name])) {
+            throw new BadMethodCallException(sprintf(
+                'Required parameter not passed: "%s"',
+                $name
+            ));
+        }
+    }
+
+    /**
+     * Checks for multiple required parameters in a hash.
+     *
+     * @throws InvalidArgumentException
+     * @param  array $names
+     * @param  array $params
+     * @return void
+     */
+    private function checkRequiredParameters(array $names, array $params)
+    {
+        foreach ($names as $name) {
+            $this->checkRequiredParameter($name, $params);
+        }
+    }
+}
diff --git a/views/configure/myarea.php b/views/configure/myarea.php
new file mode 100644
index 0000000000000000000000000000000000000000..c6abd115bdc4915f0a7f1f3782608b9299de0258
--- /dev/null
+++ b/views/configure/myarea.php
@@ -0,0 +1,50 @@
+<form action="<?= PluginEngine::getLink($plugin, array(), "configure/myarea") ?>"
+      method="post"
+      data-dialog
+      class="default"
+      sautocomplete="off">
+
+    <fieldset>
+        <legend>
+            <?= _("OwnCloud konfigurieren") ?>
+        </legend>
+
+        <? if (UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_OAUTH_ACCESS_TOKEN && UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_OAUTH_REFRESH_TOKEN) : ?>
+            <?= MessageBox::info(_("OwnCloud-Rechte sind freigegeben")) ?>
+        <? elseif(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT) : ?>
+            <div style="text-align: center;">
+                <?= \Studip\LinkButton::create(_("OwnCloud f�r Stud.IP freigeben"), PluginEngine::getURL($plugin, array(), "oauth/request_access_token")) ?>
+            </div>
+        <? endif ?>
+
+        <? if (!Config::get()->OWNCLOUD_ENDPOINT) : ?>
+            <label>
+                <?= _("Adresse der OwnCloud") ?>
+                <input type="text" name="owncloud[endpoint]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ENDPOINT) ?>" placeholder="<?= "z.B. https://myserver.tdl/owncloud" ?>">
+            </label>
+        <? endif ?>
+
+        <? if (!Config::get()->OWNCLOUD_CLIENT_ID) : ?>
+            <label>
+                <?= _("App-ID") ?>
+                <input type="text" name="owncloud[client_id]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_ID) ?>">
+            </label>
+        <? endif ?>
+
+        <? if (!Config::get()->OWNCLOUD_CLIENT_SECRET) : ?>
+            <label>
+                <?= _("Secret") ?>
+                <input type="text" name="owncloud[client_secret]" value="<?= htmlReady(UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_CLIENT_SECRET) ?>">
+            </label>
+        <? endif ?>
+
+        <label>
+            <input type="checkbox" name="owncloud[activated]" value="1"<?= UserConfig::get($GLOBALS['user']->id)->OWNCLOUD_ACTIVATED ? " checked" : "" ?>>
+            <?= _("Aktiviert") ?>
+        </label>
+    </fieldset>
+
+    <div data-dialog-button>
+        <?= \Studip\Button::create(_("Speichern")) ?>
+    </div>
+</form>
\ No newline at end of file