From a046ff085a852afe66f5d8d1c6c3cd9d207cec0c Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 17 Oct 2012 17:36:53 -0500 Subject: [PATCH 1/4] remove jetty-policy from jetty9 --- BUILDING.txt | 9 -- LICENSE-APACHE-2.0.txt | 202 ------------------------ LICENSE-ECLIPSE-1.0.html | 320 --------------------------------------- pom.xml | 1 - 4 files changed, 532 deletions(-) delete mode 100644 BUILDING.txt delete mode 100644 LICENSE-APACHE-2.0.txt delete mode 100644 LICENSE-ECLIPSE-1.0.html diff --git a/BUILDING.txt b/BUILDING.txt deleted file mode 100644 index ff168133e48..00000000000 --- a/BUILDING.txt +++ /dev/null @@ -1,9 +0,0 @@ -BUILDING JETTY --------------- - -Jetty is built with maven 3.x+ - - $ cd /my/work/directory/jetty-7 - $ mvn clean install - - diff --git a/LICENSE-APACHE-2.0.txt b/LICENSE-APACHE-2.0.txt deleted file mode 100644 index d6456956733..00000000000 --- a/LICENSE-APACHE-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/LICENSE-ECLIPSE-1.0.html b/LICENSE-ECLIPSE-1.0.html deleted file mode 100644 index 9320c9f37cf..00000000000 --- a/LICENSE-ECLIPSE-1.0.html +++ /dev/null @@ -1,320 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 63d3829d65d..543d3250dd9 100644 --- a/pom.xml +++ b/pom.xml @@ -419,7 +419,6 @@ jetty-jaspi jetty-client jetty-proxy - jetty-policy jetty-monitor jetty-nested jetty-overlay-deployer From a6f564e8dac4b4f729d225534ef275f6afb0d0d7 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 17 Oct 2012 17:37:20 -0500 Subject: [PATCH 2/4] add combo license file --- license-eplv10-aslv20.html | 576 +++++++++++++++++++++++++++++++++++++ 1 file changed, 576 insertions(+) create mode 100644 license-eplv10-aslv20.html diff --git a/license-eplv10-aslv20.html b/license-eplv10-aslv20.html new file mode 100644 index 00000000000..48addaaddf7 --- /dev/null +++ b/license-eplv10-aslv20.html @@ -0,0 +1,576 @@ + + + + + + + + +Eclipse Public License - Version 1.0 / Apache License - Version 2.0 + + + + +
+ +

Eclipse Public License - v 1.0 +

+ +

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.

+ +

1. DEFINITIONS

+ +

"Contribution" means:

+ +

a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and
+b) in the case of each subsequent Contributor:

+ +

i) +changes to the Program, and

+ +

ii) +additions to the Program;

+ +

where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program.

+ +

"Contributor" means any person or +entity that distributes the Program.

+ +

"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program.

+ +

"Program" means the Contributions +distributed in accordance with this Agreement.

+ +

"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.

+ +

2. GRANT OF RIGHTS

+ +

a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.

+ +

b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder.

+ +

c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.

+ +

d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement.

+ +

3. REQUIREMENTS

+ +

A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that: +

+ +

a) +it complies with the terms and conditions of this Agreement; and

+ +

b) +its license agreement:

+ +

i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose;

+ +

ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits;

+ +

iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and

+ +

iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.

+ +

When the Program is made available in source +code form:

+ +

a) +it must be made available under this Agreement; and

+ +

b) a +copy of this Agreement must be included with each copy of the Program.

+ +

Contributors may not remove or alter any +copyright notices contained within the Program.

+ +

Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution.

+ +

4. COMMERCIAL DISTRIBUTION

+ +

Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.

+ +

For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.

+ +

5. NO WARRANTY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations.

+ +

6. DISCLAIMER OF LIABILITY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.

+ +

7. GENERAL

+ +

If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.

+ +

If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed.

+ +

All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

+ +

Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.

+ +

This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.

+ +

 

+ +
+ +
+ +

Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

+ "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document.

+

+ "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License.

+

+ "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity.

+

+ "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License.

+

+ "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files.

+

+ "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types.

+

+ "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below).

+

+ "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof.

+

+ "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution."

+

+ "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work.

+ +

2. Grant of Copyright License.

+

+Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form.

+ + +

3. Grant of Patent License.

+ +

+ Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. +

+

+ 4. Redistribution. +

+ +

You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions:

+

    +
  • + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and

    +

  • +
  • + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and

    +

  • + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and

    + +

  • + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License.

    +

  • +
+

+ +

+ You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. +

+

+ 5. Submission of Contributions. +

+ +

Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. +

+

+ 6. Trademarks. +

+ +

This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. +

+

+ 7. Disclaimer of Warranty. +

+ +

Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. +

+

+ 8. Limitation of Liability. +

+ +

In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. +

+

+ 9. Accepting Warranty or Additional Liability. +

+

While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. +

+ +

+ END OF TERMS AND CONDITIONS +

+ +

+ APPENDIX: How to apply the Apache License to your work. +

+ +

+ To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. +

+ +

+ Copyright [yyyy] [name of copyright owner] +

+ +

+ Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at +

+ +

+ http://www.apache.org/licenses/LICENSE-2.0 +

+ +

+ Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +

+ +
+ \ No newline at end of file From 7a676b1c8562a4dc511c14337929fbebfd04355a Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 17 Oct 2012 17:37:41 -0500 Subject: [PATCH 3/4] remove jetty-policy from jetty9 --- jetty-policy/pom.xml | 138 ------ .../src/main/config/etc/jetty-policy.xml | 23 - .../src/main/config/lib/policy/global.policy | 43 -- .../main/config/lib/policy/jetty-jmx.policy | 54 -- .../main/config/lib/policy/jetty-start.policy | 40 -- .../main/config/lib/policy/jetty-work.policy | 19 - .../src/main/config/lib/policy/jetty.policy | 96 ---- .../main/config/lib/policy/temp-dirs.policy | 30 -- .../org/eclipse/jetty/policy/JettyPolicy.java | 462 ------------------ .../jetty/policy/JettyPolicyConfigurator.java | 58 --- .../org/eclipse/jetty/policy/PolicyBlock.java | 102 ---- .../eclipse/jetty/policy/PolicyContext.java | 200 -------- .../eclipse/jetty/policy/PolicyException.java | 45 -- .../eclipse/jetty/policy/PolicyMonitor.java | 328 ------------- .../jetty/policy/entry/AbstractEntry.java | 52 -- .../jetty/policy/entry/GrantEntry.java | 209 -------- .../jetty/policy/entry/KeystoreEntry.java | 98 ---- .../jetty/policy/entry/PermissionEntry.java | 226 --------- .../jetty/policy/entry/PrincipalEntry.java | 115 ----- .../policy/loader/DefaultPolicyLoader.java | 102 ---- .../policy/loader/PolicyFileScanner.java | 459 ----------------- .../jetty/policy/JettyPolicyRuntimeTest.java | 265 ---------- .../eclipse/jetty/policy/JettyPolicyTest.java | 424 ---------------- .../jetty/policy/PolicyContextTest.java | 120 ----- .../jetty/policy/PolicyMonitorTest.java | 138 ------ .../context/jetty-certificate-alias.policy | 6 - .../context/jetty-certificate.policy | 6 - .../global-all-permission.policy | 3 - .../global-all-permission.policy | 3 - .../monitor-test-2/template1.template | 3 - .../global-all-permission.policy | 3 - ...lobal-file-read-only-tmp-permission.policy | 10 - .../jetty-bad-certificate.policy | 25 - .../monitor-test-3/jetty-certificate.policy | 31 -- .../multiple-codebase-file-permission.policy | 13 - .../multiple-codebase-mixed-permission.policy | 16 - .../single-codebase-file-permission-2.policy | 3 - .../single-codebase-file-permission-3.policy | 3 - .../single-codebase-file-permission.policy | 3 - .../monitor-test-3/template1.template | 3 - .../global-all-permission.policy | 3 - .../single-codebase-file-permission.policy | 3 - .../multiple-codebase-file-permission.policy | 13 - .../multiple-codebase-mixed-permission.policy | 16 - .../single-codebase-file-permission-2.policy | 3 - .../single-codebase-file-permission.policy | 3 - .../single-codebase-file-permission-2.policy | 3 - .../single-codebase-file-permission-3.policy | 3 - .../single-codebase-file-permission.policy | 3 - .../global-all-permission.policy | 3 - .../a/global-all-permission.policy | 3 - ...lobal-file-read-only-tmp-permission.policy | 10 - ...lobal-file-read-only-tmp-permission.policy | 10 - .../runtime-test-4/jetty-certificate.policy | 31 -- .../jetty-bad-certificate.policy | 25 - 55 files changed, 4109 deletions(-) delete mode 100644 jetty-policy/pom.xml delete mode 100644 jetty-policy/src/main/config/etc/jetty-policy.xml delete mode 100644 jetty-policy/src/main/config/lib/policy/global.policy delete mode 100644 jetty-policy/src/main/config/lib/policy/jetty-jmx.policy delete mode 100644 jetty-policy/src/main/config/lib/policy/jetty-start.policy delete mode 100644 jetty-policy/src/main/config/lib/policy/jetty-work.policy delete mode 100644 jetty-policy/src/main/config/lib/policy/jetty.policy delete mode 100644 jetty-policy/src/main/config/lib/policy/temp-dirs.policy delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicyConfigurator.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyBlock.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyContext.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyException.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyMonitor.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/AbstractEntry.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/GrantEntry.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/KeystoreEntry.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PermissionEntry.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PrincipalEntry.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java delete mode 100644 jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java delete mode 100644 jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java delete mode 100644 jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java delete mode 100644 jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyContextTest.java delete mode 100644 jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java delete mode 100644 jetty-policy/src/test/resources/context/jetty-certificate-alias.policy delete mode 100644 jetty-policy/src/test/resources/context/jetty-certificate.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-1/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-2/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-2/template1.template delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/global-file-read-only-tmp-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/jetty-bad-certificate.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/jetty-certificate.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-mixed-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-2.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-3.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/monitor-test-3/template1.template delete mode 100644 jetty-policy/src/test/resources/policy-test-1/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-2/single-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-3/multiple-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-4/multiple-codebase-mixed-permission.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission-2.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-2.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-3.policy delete mode 100644 jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-1/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-2/a/global-all-permission.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-2/b/global-file-read-only-tmp-permission.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-3/global-file-read-only-tmp-permission.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-4/jetty-certificate.policy delete mode 100644 jetty-policy/src/test/resources/runtime-test-5/jetty-bad-certificate.policy diff --git a/jetty-policy/pom.xml b/jetty-policy/pom.xml deleted file mode 100644 index 100fa60fa5d..00000000000 --- a/jetty-policy/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ - - 4.0.0 - - org.eclipse.jetty - jetty-project - 9.0.0-SNAPSHOT - - jetty-policy - Jetty :: Policy Tool - jar - - target/test-policy - ${project.groupId}.policy - - - - - org.apache.felix - maven-bundle-plugin - true - - - generate-manifest - - manifest - - - - org.eclipse.jetty.policy.*;version="${parsedVersion.osgiVersion}" - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - - config - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - generate-test-resources - - unpack - - - - - org.eclipse.jetty.toolchain - jetty-test-policy - ${jetty-test-policy-version} - jar - true - **/*.keystore - ${jetty.test.policy.loc} - - - - - - copy - generate-test-resources - - copy - - - - - org.eclipse.jetty.toolchain - jetty-test-policy - ${jetty-test-policy-version} - jar - true - ** - ${jetty.test.policy.loc} - jetty-test-policy.jar - - - - - - - - org.codehaus.mojo - findbugs-maven-plugin - - org.eclipse.jetty.policy.* - - - - - - - org.eclipse.jetty - jetty-util - ${project.version} - - - org.eclipse.jetty - jetty-jmx - ${project.version} - true - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - - diff --git a/jetty-policy/src/main/config/etc/jetty-policy.xml b/jetty-policy/src/main/config/etc/jetty-policy.xml deleted file mode 100644 index c122da318cb..00000000000 --- a/jetty-policy/src/main/config/etc/jetty-policy.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - /lib/policy - - - - jetty.home - - - - - diff --git a/jetty-policy/src/main/config/lib/policy/global.policy b/jetty-policy/src/main/config/lib/policy/global.policy deleted file mode 100644 index 4ad9340607c..00000000000 --- a/jetty-policy/src/main/config/lib/policy/global.policy +++ /dev/null @@ -1,43 +0,0 @@ -// -// These permissions are granted to all codebases whilst a security -// manager is installed and JettyPolicy is in play. -// -// Note the lack of codebase declared. - -grant { - - // allows anyone to listen on un-privileged ports - permission java.net.SocketPermission "localhost:1024-", "listen"; - permission java.net.SocketPermission "localhost:1024-", "accept"; - - permission java.security.SecurityPermission "putProviderProperty.SunJCE"; - permission java.util.PropertyPermission "org.eclipse.jetty.io.nio.JVMBUG_THRESHHOLD", "read, write"; - - // "standard" properties that can be read by anyone - permission java.util.PropertyPermission "entityExpansionLimit", "read"; - permission java.util.PropertyPermission "elementAttributeLimit", "read"; - permission java.util.PropertyPermission "maxOccurLimit", "read"; - permission java.util.PropertyPermission "java.version", "read"; - permission java.util.PropertyPermission "java.vendor", "read"; - permission java.util.PropertyPermission "java.vendor.url", "read"; - permission java.util.PropertyPermission "java.class.version", "read"; - permission java.util.PropertyPermission "os.name", "read"; - permission java.util.PropertyPermission "os.version", "read"; - permission java.util.PropertyPermission "os.arch", "read"; - permission java.util.PropertyPermission "file.separator", "read"; - permission java.util.PropertyPermission "path.separator", "read"; - permission java.util.PropertyPermission "line.separator", "read"; - permission java.util.PropertyPermission "java.io.tmpdir", "read"; - - permission java.util.PropertyPermission "java.specification.version", "read"; - permission java.util.PropertyPermission "java.specification.vendor", "read"; - permission java.util.PropertyPermission "java.specification.name", "read"; - - permission java.util.PropertyPermission "java.vm.specification.version", "read"; - permission java.util.PropertyPermission "java.vm.specification.vendor", "read"; - permission java.util.PropertyPermission "java.vm.specification.name", "read"; - permission java.util.PropertyPermission "java.vm.version", "read"; - permission java.util.PropertyPermission "java.vm.vendor", "read"; - permission java.util.PropertyPermission "java.vm.name", "read"; - -}; diff --git a/jetty-policy/src/main/config/lib/policy/jetty-jmx.policy b/jetty-policy/src/main/config/lib/policy/jetty-jmx.policy deleted file mode 100644 index b591fc87a5e..00000000000 --- a/jetty-policy/src/main/config/lib/policy/jetty-jmx.policy +++ /dev/null @@ -1,54 +0,0 @@ -// This file contains permissions related to jmx support - -grant codeBase "file:${jetty.home}${/}lib${/}-" { - - // related to using JMX - permission javax.management.MBeanTrustPermission "register"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.client.HttpClient#-[org.eclipse.jetty.client:*,type=httpclient]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.deploy.ContextDeployer#-[org.eclipse.jetty.deploy:id=0,type=contextdeployer]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.deploy.DeploymentManager#-[org.eclipse.jetty.deploy:id=0,type=deploymentmanager]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.deploy.WebAppDeployer#-[org.eclipse.jetty.deploy:id=0,type=webappdeployer]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.deploy.providers.ContextProvider#-[org.eclipse.jetty.deploy.providers:id=0,type=contextprovider]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.jmx.MBeanContainer#-[org.eclipse.jetty.jmx:id=0,type=mbeancontainer]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.ContextHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.ResourceHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.ContextHandlerCollection#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.DefaultHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.ErrorHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.HandlerCollection#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.MovedContextHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.MovedContextHandler$Redirector#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.handler.RequestLogHandler#-[org.eclipse.jetty.server.handler:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.NCSARequestLog#-[org.eclipse.jetty.server:id=0,type=ncsarequestlog]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.session.HashSessionIdManager#-[org.eclipse.jetty.server.session:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.session.HashSessionManager#-[org.eclipse.jetty.server.session:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.session.SessionHandler#-[org.eclipse.jetty.server.session:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.Server#-[org.eclipse.jetty.server:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.server.ssl.SslSelectChannelConnector#-[org.eclipse.jetty.server.ssl:id=0,type=sslselectchannelconnector]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.ServletMapping#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.ServletHolder#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.ServletHandler#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.security.ConstraintSecurityHandler#-[org.eclipse.jetty.security:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.security.HashLoginService#-[org.eclipse.jetty.security:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.ErrorPageErrorHandler#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.FilterHolder#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.servlet.FilterMapping#-[org.eclipse.jetty.servlet:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.util.log.Slf4jLog#-[org.eclipse.jetty.util.log:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.util.log.StdErrLog#-[org.eclipse.jetty.util.log:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.util.Scanner#-[org.eclipse.jetty.util:*]", "registerMBean,unregisterMBean"; - permission javax.management.MBeanPermission "org.eclipse.jetty.util.thread.QueuedThreadPool#-[org.eclipse.jetty.util.thread:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.webapp.WebAppContext#-[org.eclipse.jetty.webapp:*]", "registerMBean,unregisterMBean"; - - permission javax.management.MBeanPermission "org.eclipse.jetty.policy.JettyPolicy#-[org.eclipse.jetty.policy:*]", "registerMBean,unregisterMBean"; - -} \ No newline at end of file diff --git a/jetty-policy/src/main/config/lib/policy/jetty-start.policy b/jetty-policy/src/main/config/lib/policy/jetty-start.policy deleted file mode 100644 index 0cf665553e5..00000000000 --- a/jetty-policy/src/main/config/lib/policy/jetty-start.policy +++ /dev/null @@ -1,40 +0,0 @@ -// This file contains permissions necessary for jetty-start to operate and to -// bootstrap jetty -// -// Once the required processing in jetty-start has completed jetty itself -// is started via XmlConfiguration which executes under AccessController -// doPrivledged freeing any further permissions being required to this -// module. - -grant codeBase "file:${jetty.home}${/}start.jar" { - - permission java.io.FilePermission "${jetty.home}${/}-", "read"; - - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - - permission java.util.PropertyPermission "jetty.home", "read, write"; - - permission java.util.PropertyPermission "user.home", "read"; - - permission java.util.PropertyPermission "jetty.class.path", "read, write"; - permission java.util.PropertyPermission "java.class.path", "read, write"; - - permission java.util.PropertyPermission "repository", "read, write"; - - permission java.util.PropertyPermission "jetty.lib", "read"; - permission java.util.PropertyPermission "jetty.server", "read"; - permission java.util.PropertyPermission "jetty.host", "read"; - permission java.util.PropertyPermission "jetty.port", "read"; - permission java.util.PropertyPermission "start.class", "read"; - - permission java.util.PropertyPermission "main.class", "read"; - permission java.util.PropertyPermission "ISO_8859_1", "read"; - permission javax.security.auth.AuthPermission "modifyPrincipals"; - - permission javax.security.auth.AuthPermission "modifyPrivateCredentials"; - permission javax.security.auth.AuthPermission "setReadOnly"; - permission java.lang.RuntimePermission "getClassLoader"; -} \ No newline at end of file diff --git a/jetty-policy/src/main/config/lib/policy/jetty-work.policy b/jetty-policy/src/main/config/lib/policy/jetty-work.policy deleted file mode 100644 index b1c22790972..00000000000 --- a/jetty-policy/src/main/config/lib/policy/jetty-work.policy +++ /dev/null @@ -1,19 +0,0 @@ -// -// This file contains permissions for the work directory of jetty. -// -// Typical usage of secured jetty implies usage of a standard work -// style directory that web applications are unpacked into. These specific -// web applications should have their own policy files however this -// file exists to provide a codebase that all webapps under a certain code -// base can be given should there not be a more exclusive policy file -// provided. - - -grant codeBase "file:${jetty.home${/}work${/}-" { - permission java.io.FilePermission "${jetty.home}${/}webapps${/}-", "read"; // Ought to go up a specific codebase - permission java.io.FilePermission "${jetty.home}${/}work${/}-", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - -}; diff --git a/jetty-policy/src/main/config/lib/policy/jetty.policy b/jetty-policy/src/main/config/lib/policy/jetty.policy deleted file mode 100644 index 632f7a7bf7d..00000000000 --- a/jetty-policy/src/main/config/lib/policy/jetty.policy +++ /dev/null @@ -1,96 +0,0 @@ -// This file governs the permissions directly granted to all jar files -// listed under the jetty.home/lib directory. -// -// Review of this file is recommended and possible tweaking of the codeBase -// is likely in the future. - -grant codeBase "file:${jetty.home}${/}lib${/}-" { - - permission java.lang.RuntimePermission "getClassLoader"; - - permission java.util.PropertyPermission "org.eclipse.jetty.webapp.WebAppClassLoader.extensions", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.ajp.PathMap.separators", "read"; - - permission java.util.PropertyPermission "ROLLOVERFILE_BACKUP_FORMAT", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.server.webapp.parentLoaderPriority", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.server.Request.maxFormContentSize", "read"; - - permission javax.security.auth.AuthPermission "modifyPrincipals"; - permission javax.security.auth.AuthPermission "modifyPrivateCredentials"; - permission javax.security.auth.AuthPermission "setReadOnly"; - - permission java.io.FilePermission "${jetty.home}${/}-", "read"; - permission java.io.FilePermission "${java.io.tmpdir}", "read, write"; - permission java.io.FilePermission "${java.io.tmpdir}${/}-", "read, write"; - permission java.io.FilePermission "${/}private${/}${java.io.tmpdir}", "read, write"; - permission java.io.FilePermission "${/}private${/}${java.io.tmpdir}${/}-", "read, write"; - permission java.io.FilePermission "${jetty.home}${/}lib${/}policy${/}-", "read"; - - - permission java.io.FilePermission "${java.io.tmpdir}${/}-", "delete"; - - - permission java.io.FilePermission "${jetty.home}${/}logs", "read, write"; - permission java.io.FilePermission "${jetty.home}${/}logs${/}*", "read, write"; - - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setContextClassLoader"; - - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - - // jetty specific properties - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.DEBUG", "read"; - permission java.util.PropertyPermission "START", "read"; - permission java.util.PropertyPermission "STOP.PORT", "read"; - permission java.util.PropertyPermission "STOP.KEY", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - permission java.util.PropertyPermission "CLASSPATH", "read"; - permission java.util.PropertyPermission "OPTIONS", "read"; - permission java.util.PropertyPermission "JETTY_NO_SHUTDOWN_HOOK", "read"; - permission java.util.PropertyPermission "ISO_8859_1", "read"; - permission java.util.PropertyPermission "jetty.home", "read, write"; - - permission java.util.PropertyPermission "user.home", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - - - permission java.util.PropertyPermission "jetty.class.path", "read, write"; - permission java.util.PropertyPermission "java.class.path", "read, write"; - - permission java.util.PropertyPermission "jetty.lib", "read"; - permission java.util.PropertyPermission "jetty.server", "read"; - permission java.util.PropertyPermission "jetty.host", "read"; - permission java.util.PropertyPermission "jetty.port", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.class", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.URI.charset", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.FileResource.checkAliases", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.xml.XmlParser.Validating", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.io.nio.JVMBUG_THRESHHOLD", "read, write"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.TypeUtil.IntegerCacheSize", "read, write"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.TypeUtil.LongCacheSize", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.io.AbstractBuffer.boundsChecking", "read"; - - // provides access to webapps - permission java.io.FilePermission "${jetty.home}${/}webapps${/}-", "read"; // Ought to go up a specific codebase - - - // Allows any thread to stop itself using the java.lang.Thread.stop() - // method that takes no argument. - permission java.lang.RuntimePermission "stopThread"; - - // jsp support - permission java.net.SocketPermission "java.sun.com:80", "connect,resolve"; - -}; \ No newline at end of file diff --git a/jetty-policy/src/main/config/lib/policy/temp-dirs.policy b/jetty-policy/src/main/config/lib/policy/temp-dirs.policy deleted file mode 100644 index 128e78defd6..00000000000 --- a/jetty-policy/src/main/config/lib/policy/temp-dirs.policy +++ /dev/null @@ -1,30 +0,0 @@ -// This file contains permissions for various temporary directories that -// jetty might operate under. -// -// Careful auditing of this file is recommended for your particular use case - -// -// the tmp directory is where webapps are unpacked by default so setup their restricted permissions -// -grant codeBase "file:${java.io.tmpdir}${/}" { - - permission java.io.FilePermission "${jetty.home}${/}webapps${/}-", "read"; // Ought to go up a specific codebases - permission java.io.FilePermission "${java.io.tmpdir}${/}-", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - -}; - -// -// some operating systems have tmp as a symbolic link to /private/tmp -// -grant codeBase "file:/private${java.io.tmpdir}${/}-" { - - permission java.io.FilePermission "${jetty.home}${/}webapps${/}-", "read"; // Ought to go up a specific codebase - permission java.io.FilePermission "/private/${java.io.tmpdir}${/}-", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - -}; \ No newline at end of file diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java deleted file mode 100644 index 1b5817a0006..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicy.java +++ /dev/null @@ -1,462 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.io.PrintStream; -import java.io.PrintWriter; -import java.security.AccessControlException; -import java.security.CodeSource; -import java.security.Permission; -import java.security.PermissionCollection; -import java.security.Permissions; -import java.security.Policy; -import java.security.Principal; -import java.security.ProtectionDomain; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.security.CertificateValidator; - - -/** - * Policy implementation that will load a set of policy files and manage the mapping of permissions and protection domains - * - * Features of JettyPolicy are: - * - * - we are able to follow the startup mechanic that jetty uses with jetty-start using OPTIONS=policy,default to be able to startup a security manager and policy implementation without have to rely on the existing JVM cli options - * - support for specifying multiple policy files to source permissions from - * - support for merging protection domains across multiple policy files for the same codesource - * - support for directories of policy files, just specify directory and all *.policy files will be loaded. - - * Possible additions are: - * - scan policy directory for new policy files being added - * - jmx reporting - * - proxying of system security policy where we can proxy access to the system policy should the jvm have been started with one, I had support for this but ripped it - * out to add in again later - * - an xml policy file parser, had originally added this using modello but tore it out since it would have been a - * nightmare to get its dependencies through IP validation, could do this with jvm xml parser instead sometime - * - check performance of the synch'd map I am using for the protection domain mapping - */ -public class JettyPolicy extends Policy -{ - private static final Logger LOG = Log.getLogger(JettyPolicy.class); - - private static boolean __DEBUG = false; - private static boolean __RELOAD = false; - - private boolean _STARTED = false; - - private String _policyDirectory; - - private final Set _grants = new HashSet(); - - /* - * TODO: make into a proper cache - */ - private final Map _cache = new ConcurrentHashMap(); - - private final static PolicyContext _context = new PolicyContext(); - - private CertificateValidator _validator = null; - - private PolicyMonitor _policyMonitor = new PolicyMonitor() - { - @Override - public void onPolicyChange(PolicyBlock grant) - { - boolean setGrant = true; - - if ( _validator != null ) - { - if (grant.getCertificates() != null) - { - for ( Certificate cert : grant.getCertificates() ) - { - try - { - _validator.validate(_context.getKeystore(), cert); - } - catch ( CertificateException ce ) - { - setGrant = false; - } - } - } - } - - if ( setGrant ) - { - _grants.add( grant ); - _cache.clear(); - } - } - }; - - public JettyPolicy(String policyDirectory, Map properties) - { - try - { - __RELOAD = Boolean.getBoolean("org.eclipse.jetty.policy.RELOAD"); - __DEBUG = Boolean.getBoolean("org.eclipse.jetty.policy.DEBUG"); - } - catch (AccessControlException ace) - { - __RELOAD = false; - __DEBUG = false; - } - - _policyDirectory = policyDirectory; - _context.setProperties(properties); - - try - { - _policyMonitor.setPolicyDirectory(_policyDirectory); - //_policyMonitor.setReload( __RELOAD ); - } - catch ( Exception e) - { - throw new PolicyException(e); - } - } - - - - @Override - public void refresh() - { - if ( !_STARTED ) - { - initialize(); - } - } - - /** - * required for the jetty policy to start function, initializes the - * policy monitor and blocks for a full cycle of policy grant updates - */ - public void initialize() - { - if ( _STARTED ) - { - return; - } - - try - { - _policyMonitor.start(); - _policyMonitor.waitForScan(); - } - catch (Exception e) - { - e.printStackTrace(); - throw new PolicyException(e); - } - - _STARTED = true; - } - - @Override - public PermissionCollection getPermissions(ProtectionDomain domain) - { - - if (!_STARTED) - { - throw new PolicyException("JettyPolicy must be started."); - } - - synchronized (_cache) - { - if (_cache.containsKey(domain)) - { - return copyOf(_cache.get(domain)); - } - - PermissionCollection perms = new Permissions(); - - for (Iterator i = _grants.iterator(); i.hasNext();) - { - PolicyBlock policyBlock = i.next(); - ProtectionDomain grantPD = policyBlock.toProtectionDomain(); - - if (__DEBUG) - { - debug("----START----"); - debug("PDCS: " + policyBlock.getCodeSource()); - debug("CS: " + domain.getCodeSource()); - - } - - // 1) if protection domain codesource is null, it is the global permissions (grant {}) - // 2) if protection domain codesource implies target codesource and there are no prinicpals - if (grantPD.getCodeSource() == null - || - grantPD.getCodeSource().implies(domain.getCodeSource()) - && - grantPD.getPrincipals() == null - || - grantPD.getCodeSource().implies(domain.getCodeSource()) - && - validate(grantPD.getPrincipals(),domain.getPrincipals())) - - { - - for (Enumeration e = policyBlock.getPermissions().elements(); e.hasMoreElements();) - { - Permission perm = e.nextElement(); - if (__DEBUG) - { - debug("D: " + perm); - } - perms.add(perm); - } - } - if (__DEBUG) - { - debug("----STOP----"); - } - } - - _cache.put(domain,perms); - - return copyOf(perms); - } - } - - @Override - public PermissionCollection getPermissions(CodeSource codesource) - { - if (!_STARTED) - { - throw new PolicyException("JettyPolicy must be started."); - } - - synchronized (_cache) - { - if (_cache.containsKey(codesource)) - { - return copyOf(_cache.get(codesource)); - } - - PermissionCollection perms = new Permissions(); - - for (Iterator i = _grants.iterator(); i.hasNext();) - { - PolicyBlock policyBlock = i.next(); - ProtectionDomain grantPD = policyBlock.toProtectionDomain(); - - if (grantPD.getCodeSource() == null - || - grantPD.getCodeSource().implies(codesource)) - { - if (__DEBUG) - { - debug("----START----"); - debug("PDCS: " + grantPD.getCodeSource()); - debug("CS: " + codesource); - } - - for (Enumeration e = policyBlock.getPermissions().elements(); e.hasMoreElements();) - { - Permission perm = e.nextElement(); - if (__DEBUG) - { - debug("D: " + perm); - } - perms.add(perm); - } - - if (__DEBUG) - { - debug("----STOP----"); - } - } - } - - _cache.put(codesource,perms); - - return copyOf(perms); - } - } - - @Override - public boolean implies(ProtectionDomain domain, Permission permission) - { - if (!_STARTED) - { - throw new PolicyException("JettyPolicy must be started."); - } - - PermissionCollection pc = getPermissions(domain); - - return (pc == null ? false : pc.implies(permission)); - } - - - private static boolean validate(Principal[] permCerts, Principal[] classCerts) - { - if (classCerts == null) - { - return false; - } - - for (int i = 0; i < permCerts.length; ++i) - { - boolean found = false; - for (int j = 0; j < classCerts.length; ++j) - { - if (permCerts[i].equals(classCerts[j])) - { - found = true; - break; - } - } - // if we didn't find the permCert in the classCerts then we don't match up - if (found == false) - { - return false; - } - } - - return true; - } - - - /** - * returns the policy context which contains the map of properties that - * can be referenced in policy files and the keystore for validation - * - * @return the policy context - */ - public static PolicyContext getContext() - { - return _context; - } - - - - /** - * Try and log to normal logging channels and should that not be allowed - * debug to system.out - * - * @param message - */ - private void debug( String message ) - { - try - { - LOG.info(message); - } - catch ( AccessControlException ace ) - { - System.out.println( "[DEBUG] " + message ); - } - catch ( NoClassDefFoundError ace ) - { - System.out.println( "[DEBUG] " + message ); - //ace.printStackTrace(); - } - } - /** - * Try and log to normal logging channels and should that not be allowed - * log to system.out - * - * @param message - */ - private void log( String message ) - { - log( message, null ); - } - - /** - * Try and log to normal logging channels and should that not be allowed - * log to system.out - * - * @param message - */ - private void log( String message, Throwable t ) - { - try - { - LOG.info(message, t); - } - catch ( AccessControlException ace ) - { - System.out.println( message ); - t.printStackTrace(); - } - catch ( NoClassDefFoundError ace ) - { - System.out.println( message ); - t.printStackTrace(); - } - } - - - public void dump(PrintStream out) - { - PrintWriter write = new PrintWriter(out); - write.println("JettyPolicy: policy settings dump"); - - synchronized (_cache) - { - for (Iterator i = _cache.keySet().iterator(); i.hasNext();) - { - Object o = i.next(); - write.println(o.toString()); - } - } - write.flush(); - } - - private PermissionCollection copyOf(final PermissionCollection in) - { - PermissionCollection out = new Permissions(); - synchronized (in) - { - for (Enumeration el = in.elements() ; el.hasMoreElements() ;) - { - out.add((Permission)el.nextElement()); - } - } - return out; - } - - public CertificateValidator getCertificateValidator() - { - return _validator; - } - - public void setCertificateValidator(CertificateValidator validator) - { - if (_STARTED) - { - throw new PolicyException("JettyPolicy already started, unable to set validator on running policy"); - } - - _validator = validator; - } -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicyConfigurator.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicyConfigurator.java deleted file mode 100644 index 099f7e7de27..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/JettyPolicyConfigurator.java +++ /dev/null @@ -1,58 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.security.Policy; -import java.util.HashMap; -import java.util.Map; - -/** - * - * - */ -public class JettyPolicyConfigurator -{ - String _policyDirectory; - Map _properties = new HashMap(); - - public JettyPolicyConfigurator() - { - - } - - public void setPolicyDirectory( String policyDirectory ) - { - _policyDirectory = policyDirectory; - } - - public void addProperty( String name, String value ) - { - _properties.put(name,value); - } - - public void initialize() - { - JettyPolicy jpolicy = new JettyPolicy(_policyDirectory,_properties); - - jpolicy.refresh(); - Policy.setPolicy(jpolicy); - System.setSecurityManager(new SecurityManager()); - } - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyBlock.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyBlock.java deleted file mode 100644 index 717f18929b3..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyBlock.java +++ /dev/null @@ -1,102 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.security.CodeSource; -import java.security.KeyStore; -import java.security.PermissionCollection; -import java.security.Principal; -import java.security.ProtectionDomain; -import java.security.cert.Certificate; -import java.util.Set; - -public class PolicyBlock -{ - public CodeSource codesource; - - public KeyStore keyStore; - - public Set certificates; - - public Principal[] principals; - - public PermissionCollection permissions; - - private ProtectionDomain protectionDomain; - - public ProtectionDomain toProtectionDomain() - { - if ( protectionDomain == null ) - { - protectionDomain = new ProtectionDomain(codesource,null,Thread.currentThread().getContextClassLoader(),principals); - } - - return protectionDomain; - } - - public KeyStore getKeyStore() - { - return keyStore; - } - - public void setKeyStore(KeyStore keyStore) - { - this.keyStore = keyStore; - } - - public CodeSource getCodeSource() - { - return codesource; - } - - public void setCodeSource( CodeSource codesource ) - { - this.codesource = codesource; - } - - public Set getCertificates() - { - return certificates; - } - - public void setCertificates( Set certificates ) - { - this.certificates = certificates; - } - - public Principal[] getPrincipals() - { - return principals; - } - - public void setPrincipals( Principal[] principals ) - { - this.principals = principals; - } - - public PermissionCollection getPermissions() - { - return permissions; - } - - public void setPermissions( PermissionCollection permissions ) - { - this.permissions = permissions; - } -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyContext.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyContext.java deleted file mode 100644 index 18c2e870155..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyContext.java +++ /dev/null @@ -1,200 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.io.File; -import java.security.KeyStore; -import java.security.Principal; -import java.security.cert.Certificate; -import java.security.cert.X509Certificate; -import java.util.HashMap; -import java.util.Map; - -public class PolicyContext -{ - private Map properties = new HashMap(); - - private Principal[] principals; - private KeyStore keystore; - - public PolicyContext() - { - // special property case for resolving ${/} to native separator - properties.put( "/", File.separator ); - } - - public void addProperty( String name, String value ) - { - this.properties.put( name, value ); - } - - public void setProperties( Map properties ) - { - this.properties.putAll( properties ); - } - - public KeyStore getKeystore() - { - return keystore; - } - - public void setKeystore( KeyStore keystore ) - { - this.keystore = keystore; - } - - public Principal[] getPrincipals() - { - return principals; - } - - public void setPrincipals( Principal[] principals ) - { - this.principals = principals; - } - - public String evaluate(String s) throws PolicyException - { - s = processProtocols( s ); - - int i1=0; - int i2=0; - - while (s!=null) - { - i1=s.indexOf("${"); - if (i1<0) - { - break; - } - - i2=s.indexOf("}",i1+2); - if (i2<0) - { - break; - } - - String property=getProperty(s.substring(i1+2,i2)); - - s=s.substring(0,i1)+property+s.substring(i2+1); - } - - return s; - } - - private String processProtocols( String s ) throws PolicyException - { - int i1=0; - int i2=0; - - while (s!=null) - { - i1=s.indexOf("${{"); - if (i1<0) - { - break; - } - - i2=s.indexOf("}}",i1+2); - if (i2<0) - { - break; - } - - String property; - String target = s.substring(i1+3,i2); - - if ( target.indexOf( ":" ) >= 0 ) - { - String[] resolve = target.split( ":" ); - property = resolve(resolve[0], resolve[1] ); - } - else - { - property = resolve( target, null ); - } - s=s.substring(0,i1)+property+s.substring(i2+2); - } - - return s; - } - - - public String getProperty(String name) - { - if (properties.containsKey(name)) - { - return properties.get(name); - } - - return System.getProperty(name); - } - - private String resolve( String protocol, String data ) throws PolicyException - { - - if ( "self".equals( protocol ) ) - { - // need expanding to list of principals in grant clause - if ( principals != null && principals.length != 0 ) - { - StringBuilder sb = new StringBuilder(); - for ( int i = 0; i < principals.length; ++i ) - { - sb.append( principals[i].getClass().getName() ); - sb.append( " \"" ); - sb.append( principals[i].getName() ); - sb.append( "\" " ); - } - return sb.toString(); - } - else - { - throw new PolicyException( "self can not be expanded, missing principals" ); - } - } - if ( "alias".equals( protocol ) ) - { - try - { - Certificate cert = keystore.getCertificate(data); - - if ( cert instanceof X509Certificate ) - { - Principal principal = ((X509Certificate) cert).getSubjectX500Principal(); - StringBuilder sb = new StringBuilder(); - sb.append( principal.getClass().getName() ); - sb.append( " \"" ); - sb.append( principal.getName() ); - sb.append( "\" " ); - return sb.toString(); - } - else - { - throw new PolicyException( "alias can not be expanded, bad cert" ); - } - } - catch ( Exception e ) - { - throw new PolicyException( "alias can not be expanded: " + data ); - } - } - throw new PolicyException( "unknown protocol: " + protocol ); - } -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyException.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyException.java deleted file mode 100644 index e023e484f84..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyException.java +++ /dev/null @@ -1,45 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -@SuppressWarnings("serial") -public class PolicyException extends RuntimeException -{ - - public PolicyException() - { - super(); - } - - public PolicyException( final String message, final Throwable cause) - { - super( message, cause ); - } - - public PolicyException( final String message ) - { - super( message ); - } - - public PolicyException( final Throwable cause ) - { - super( cause ); - } - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyMonitor.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyMonitor.java deleted file mode 100644 index 982940b201b..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/PolicyMonitor.java +++ /dev/null @@ -1,328 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.io.File; -import java.io.FileInputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; - -import org.eclipse.jetty.policy.loader.DefaultPolicyLoader; -import org.eclipse.jetty.util.Scanner; -import org.eclipse.jetty.util.component.AbstractLifeCycle; - -/** - * PolicyMonitor watches a directory for files ending in the *.policy extension, - * loads them and detects when they change. PolicyGrants are peeped out the - * onPolicyChange method to whoever is using this monitor. - * - */ -public abstract class PolicyMonitor extends AbstractLifeCycle -{ - - /** - * the directory to be scanned for policy files. - */ - private String _policyDirectory; - - /** - * instance of the scanner that detects policy files - */ - private Scanner _scanner; - - /** - * true if updates to policy grants will be pushed through the - * onPolicyChange() method - */ - private boolean _reload = true; - - /** - * scan interval in seconds for policy file changes - */ - private int _scanInterval = 1; - - /** - * specialized listener enabling waitForScan() functionality - */ - private LatchScannerListener _scanningListener; - - /** - * true if the scanner has completed one cycle. - */ - private boolean _initialized = false; - - /** - * record of the number of scans that have been made - */ - private AtomicInteger _scanCount = new AtomicInteger(0); - - /** - * empty constructor - */ - public PolicyMonitor() - { - - } - - /** - * construtor with a predetermined directory to monitor - * - * @param directory - */ - public PolicyMonitor( String directory ) - { - this(); - _policyDirectory = directory; - } - - /** - * set the policy directory to scan on a non-running monitor - * - * @param directory - */ - public void setPolicyDirectory( String directory ) - { - if (isRunning()) - { - throw new PolicyException("policy monitor is running, unable to set policy directory"); - } - - _policyDirectory = directory; - } - - /** - * gets the scanner interval - * - * @return the scan interval - */ - public int getScanInterval() - { - return _scanInterval; - } - - /** - * sets the scanner interval on a non-running instance of the monitor - * - * @param scanInterval in seconds - * @see Scanner#setScanInterval(int) - */ - public void setScanInterval( int scanInterval ) - { - if (isRunning()) - { - throw new PolicyException("policy monitor is running, unable to set scan interval"); - } - - _scanInterval = scanInterval; - } - - /** - * true of the monitor is initialized, meaning that at least one - * scan cycle has completed and any policy grants found have been chirped - * - * @return true if initialized - */ - public boolean isInitialized() - { - return _initialized; - } - - /** - * gets the number of times the scan has been run - * - * @return scan count - */ - public int getScanCount() - { - return _scanCount.get(); - } - - /** - * initiates a scan and blocks until it has been completed - * - * @throws Exception - */ - public synchronized void waitForScan() throws Exception - { - // wait for 2 scans for stable files - CountDownLatch latch = new CountDownLatch(2); - - _scanningListener.setScanningLatch(latch); - _scanner.scan(); - latch.await(); - } - - /** - * true of reload is enabled, false otherwise - * - * @return true if reload is enabled - */ - public boolean isReloadEnabled() - { - return _reload; - } - - /** - * sets the monitor to reload or not, but only if the monitor isn't already running - * - * TODO this doesn't really _have_ to be on a non-running monitor - * - * @param reload - */ - public void setReload(boolean reload) - { - if (isRunning()) - { - throw new PolicyException("policy monitor is running, unable to set reload at this time"); - } - - _reload = reload; - } - - /** - * processes a policy file via the default policy loader and chirps - * changes to the onPolicyChange() abstract method - * - * @param filename - */ - private void processPolicyFile(String filename) - { - try - { - File policyFile = new File(filename); - - Set policyBlocks = DefaultPolicyLoader.load(new FileInputStream(policyFile),JettyPolicy.getContext()); - - for (PolicyBlock policy : policyBlocks) - { - onPolicyChange(policy); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * called by the abstract lifecycle to start the monitor - */ - @Override - protected void doStart() throws Exception - { - super.doStart(); - - _scanner = new Scanner(); - - List scanDirs = new ArrayList(); - - scanDirs.add(new File( _policyDirectory ) ); - - //System.out.println("Scanning: " + _policyDirectory ); - - _scanner.addListener(new Scanner.DiscreteListener() - { - - public void fileRemoved(String filename) throws Exception - { - - } - - /* will trigger when files are changed, not on load time, just when changed */ - public void fileChanged(String filename) throws Exception - { - if (_reload && filename.endsWith("policy")) - { - // System.out.println("PolicyMonitor: policy file"); - processPolicyFile(filename); - } - } - - public void fileAdded(String filename) throws Exception - { - if (filename.endsWith("policy")) - { - // System.out.println("PolicyMonitor: added policy file"); - processPolicyFile(filename); - } - } - }); - - _scanningListener = new LatchScannerListener(); - - _scanner.addListener(_scanningListener); - - _scanner.setScanDirs(scanDirs); - _scanner.setReportExistingFilesOnStartup(true); - _scanner.start(); - _scanner.setScanInterval(_scanInterval); - } - - /** - * called by the abstract life cycle to turn off the monitor - */ - @Override - protected void doStop() throws Exception - { - super.doStop(); - - _scanner.stop(); - } - - /** - * latch listener that can taken in a countdownlatch and notify other - * blocking threads that the scan has been completed - * - */ - private class LatchScannerListener implements Scanner.ScanCycleListener - { - CountDownLatch _latch; - - public void scanStarted(int cycle) throws Exception - { - - } - - public void scanEnded(int cycle) throws Exception - { - _initialized = true; // just really needed the first time - _scanCount.incrementAndGet(); - if ( _latch != null ) - { - _latch.countDown(); - } - } - - public void setScanningLatch( CountDownLatch latch ) - { - _latch = latch; - } - } - - /** - * implemented by the user of the policy monitor to handle custom logic - * related to the usage of the policy grant instance/s. - * - * @param grant - */ - public abstract void onPolicyChange(PolicyBlock grant); -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/AbstractEntry.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/AbstractEntry.java deleted file mode 100644 index 9b958d195ff..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/AbstractEntry.java +++ /dev/null @@ -1,52 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy.entry; - -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; - -public abstract class AbstractEntry -{ - private boolean isDirty = false; - private boolean isExpanded = false; - - public abstract void expand( PolicyContext context ) throws PolicyException; - - public boolean isDirty() - { - return isDirty; - } - - public void setDirty( boolean isDirty ) - { - this.isDirty = isDirty; - } - - public boolean isExpanded() - { - return isExpanded; - } - - public void setExpanded( boolean isExpanded ) - { - this.isExpanded = isExpanded; - } - - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/GrantEntry.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/GrantEntry.java deleted file mode 100644 index 1fa0bcbc1e5..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/GrantEntry.java +++ /dev/null @@ -1,209 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy.entry; - -import java.net.URI; -import java.net.URL; -import java.security.CodeSource; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.PermissionCollection; -import java.security.Permissions; -import java.security.Principal; -import java.security.cert.Certificate; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; - -public class GrantEntry extends AbstractEntry -{ - - /** - * The signers part of grant clause. This is a comma-separated list of certificate aliases. - */ - private String signers; - - /** - * The codebase part of grant clause. This is an URL from which code originates. - */ - private String codebase; - - /** - * Collection of PrincipalEntries of grant clause. - */ - private Collection principalNodes; - - /** - * Collection of PermissionEntries of grant clause. - */ - private Collection permissionNodes; - - // cached permissions - private PermissionCollection permissions; - private Certificate[] signerArray; - private CodeSource codesource; - private Principal[] principals; - - /** - * Adds specified element to the principals collection. If collection does not exist yet, creates a - * new one. - */ - public void addPrincipal( PrincipalEntry pe ) - { - if ( principalNodes == null ) - { - principalNodes = new HashSet(); - } - principalNodes.add( pe ); - } - - public void expand( PolicyContext context ) throws PolicyException - { - if ( signers != null ) - { - signerArray = resolveToCertificates( context.getKeystore(), signers ); // TODO alter to support self:: etc - } - codebase = context.evaluate( codebase ); - - if ( principalNodes != null ) - { - Set principalSet = new HashSet(); - for ( Iterator i = principalNodes.iterator(); i.hasNext(); ) - { - PrincipalEntry node = i.next(); - node.expand( context ); - principalSet.add( node.toPrincipal( context ) ); - } - principals = principalSet.toArray( new Principal[principalSet.size()] ); - } - - context.setPrincipals( principals ); - permissions = new Permissions(); - for ( Iterator i = permissionNodes.iterator(); i.hasNext(); ) - { - PermissionEntry node = i.next(); - node.expand( context ); - permissions.add( node.toPermission() ); - } - context.setPrincipals( null ); - - setExpanded( true ); - } - - public PermissionCollection getPermissions() throws PolicyException - { - return permissions; - } - - public Principal[] getPrincipals() throws PolicyException - { - return principals; - } - - public CodeSource getCodeSource() throws PolicyException - { - if ( !isExpanded() ) - { - throw new PolicyException("GrantNode needs to be expanded."); - } - - try - { - if ( codesource == null && codebase != null ) - { - URL url = new URI( codebase ).toURL(); - codesource = new CodeSource( url, signerArray ); - } - - return codesource; - } - catch ( Exception e ) - { - throw new PolicyException( e ); - } - } - - /** - * resolve signers into an array of certificates using a given keystore - * - * @param keyStore - * @param signers - * @return - * @throws Exception - */ - private Certificate[] resolveToCertificates( KeyStore keyStore, String signers ) throws PolicyException - { - if ( keyStore == null ) - { - Certificate[] certs = null; - return certs; - } - - Set certificateSet = new HashSet(); - StringTokenizer strTok = new StringTokenizer( signers, ","); - - for ( int i = 0; strTok.hasMoreTokens(); ++i ) - { - try - { - Certificate certificate = keyStore.getCertificate( strTok.nextToken().trim() ); - - if ( certificate != null ) - { - certificateSet.add( certificate ); - } - } - catch ( KeyStoreException kse ) - { - throw new PolicyException( kse ); - } - } - - return certificateSet.toArray( new Certificate[certificateSet.size()] ); - } - - - public void setSigners( String signers ) - { - this.signers = signers; - } - - public void setCodebase( String codebase ) - { - this.codebase = codebase; - } - - public void setPrincipals( Collection principals ) - { - this.principalNodes = principals; - } - - public void setPermissions( Collection permissions ) - { - this.permissionNodes = permissions; - } - - - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/KeystoreEntry.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/KeystoreEntry.java deleted file mode 100644 index 88c94781a44..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/KeystoreEntry.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy.entry; - -import java.io.InputStream; -import java.net.URL; -import java.security.KeyStore; - -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; -import org.eclipse.jetty.util.resource.Resource; - -public class KeystoreEntry extends AbstractEntry -{ - /** - * The URL part of keystore clause. - */ - private String url; - - /** - * The typename part of keystore clause. - */ - private String type; - - // cached value - private KeyStore keystore; - - public KeyStore toKeyStore() throws PolicyException - { - if ( keystore != null && !isDirty() ) - { - return keystore; - } - - try - { - keystore = KeyStore.getInstance( type ); - - URL keyStoreLocation = new URL ( url ); - Resource r = Resource.newResource(keyStoreLocation); - InputStream istream = r.getInputStream(); - - keystore.load( istream, null ); - - - } - catch ( Exception e ) - { - throw new PolicyException( e ); - } - - return keystore; - } - - @Override - public void expand( PolicyContext context ) throws PolicyException - { - url = context.evaluate( url ); - - setExpanded( true ); - } - - public String getUrl() - { - return url; - } - - public void setUrl( String url ) - { - this.url = url; - } - - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PermissionEntry.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PermissionEntry.java deleted file mode 100644 index e4929e45a1f..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PermissionEntry.java +++ /dev/null @@ -1,226 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy.entry; - -import java.lang.reflect.Constructor; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.Permission; -import java.security.cert.Certificate; -import java.util.HashSet; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; - -public class PermissionEntry extends AbstractEntry -{ - /** - * The classname part of permission clause. - */ - private String klass; - - /** - * The name part of permission clause. - */ - private String name; - - /** - * The actions part of permission clause. - */ - private String actions; - - /** - * The signers part of permission clause. This is a comma-separated list of certificate aliases. - */ - private String signers; - - - private Certificate[] signerArray; - - public Permission toPermission() throws PolicyException - { - try - { - Class clazz = Class.forName(klass); - - if ( signerArray != null && !validate( signerArray, (Certificate[])clazz.getSigners() ) ) - { - throw new PolicyException( "Unvalidated Permissions: " + klass + "/" + name ); - } - - Permission permission = null; - - if ( name == null && actions == null ) - { - permission = (Permission) clazz.newInstance(); - } - else if ( name != null && actions == null ) - { - Constructor c = clazz.getConstructor(new Class[] - { String.class }); - permission = (Permission) c.newInstance( name ); - } - else if ( name != null && actions != null ) - { - Constructor c = clazz.getConstructor(new Class[] - { String.class, String.class }); - permission = (Permission) c.newInstance( name, actions ); - } - - return permission; - } - catch ( Exception e ) - { - throw new PolicyException( e ); - } - } - - @Override - public void expand( PolicyContext context ) throws PolicyException - { - if ( name != null ) - { - name = context.evaluate( name ).trim(); - } - - if ( actions != null ) - { - actions = context.evaluate( actions ).trim(); - } - - if ( signers != null ) - { - signerArray = resolveCertificates( context.getKeystore(), signers ); - } - - setExpanded( true ); - } - - /** - * validate that all permission certs are present in the class certs - * - * @param permCerts - * @param classCerts - * @return true if the permissions match up - */ - private static boolean validate( Certificate[] permCerts, Certificate[] classCerts ) - { - if ( classCerts == null ) - { - return false; - } - - for ( int i = 0; i < permCerts.length; ++i ) - { - boolean found = false; - for ( int j = 0; j < classCerts.length; ++j ) - { - if ( permCerts[i].equals( classCerts[j] ) ) - { - found = true; - break; - } - } - // if we didn't find the permCert in the classCerts then we don't match up - if ( found == false ) - { - return false; - } - } - - // we found all the permCerts in classCerts so return true - return true; - } - - private static Certificate[] resolveCertificates( KeyStore keyStore, String signers ) throws PolicyException - { - if ( keyStore == null ) - { - Certificate[] certs = null; - return certs; - } - - Set certificateSet = new HashSet(); - StringTokenizer strTok = new StringTokenizer( signers, ","); - - for ( int i = 0; strTok.hasMoreTokens(); ++i ) - { - try - { - Certificate certificate = keyStore.getCertificate( strTok.nextToken().trim() ); - - if ( certificate != null ) - { - certificateSet.add( certificate ); - } - } - catch ( KeyStoreException kse ) - { - throw new PolicyException( kse ); - } - } - - return certificateSet.toArray( new Certificate[certificateSet.size()]); - } - - public String getKlass() - { - return klass; - } - - public void setKlass( String klass ) - { - this.klass = klass; - } - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - public String getActions() - { - return actions; - } - - public void setActions( String actions ) - { - this.actions = actions; - } - - public String getSigners() - { - return signers; - } - - public void setSigners( String signers ) - { - this.signers = signers; - } - - - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PrincipalEntry.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PrincipalEntry.java deleted file mode 100644 index c9981b848e5..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/entry/PrincipalEntry.java +++ /dev/null @@ -1,115 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy.entry; - -import java.security.KeyStoreException; -import java.security.Principal; -import java.security.cert.Certificate; -import java.security.cert.X509Certificate; - -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; - -public class PrincipalEntry extends AbstractEntry -{ - /** - * Wildcard value denotes any class and/or any name. Must be asterisk, for proper general expansion and - * PrivateCredentialsPermission wildcarding - */ - public static final String WILDCARD = "*"; //$NON-NLS-1$ - - /** - * The classname part of principal clause. - */ - private String klass; - - /** - * The name part of principal clause. - */ - private String name; - - /** - * cached principal if already computed - */ - private Principal principal; - - public Principal toPrincipal( PolicyContext context ) throws PolicyException - { - if ( principal != null && !isDirty() ) - { - return principal; - } - - // if there is no keystore, there is no way to obtain a principal object - // TODO validate we need this check - if ( context.getKeystore() == null ) - { - return null; - } - - try - { - Certificate certificate = context.getKeystore().getCertificate( name ); - - if ( certificate instanceof X509Certificate ) - { - principal = ( (X509Certificate) certificate ).getSubjectX500Principal(); - return principal; - } - else - { - throw new PolicyException( "Unknown Certificate, unable to obtain Principal: " + certificate.getType() ); - } - } - catch ( KeyStoreException kse ) - { - throw new PolicyException( kse ); - } - } - - public void expand( PolicyContext context ) - throws PolicyException - { - name = context.evaluate( name ); - - setExpanded(true); - } - - public String getKlass() - { - return klass; - } - - public void setKlass( String klass ) - { - this.klass = klass; - } - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - -} diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java deleted file mode 100644 index 94145aad1a5..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/DefaultPolicyLoader.java +++ /dev/null @@ -1,102 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// Portions of this file adapted for use from Apache Harmony code by written -// and contributed to that project by Alexey V. Varlamov under the ASL -// ======================================================================== -// - -package org.eclipse.jetty.policy.loader; - -import java.io.InputStream; -import java.io.InputStreamReader; -import java.security.KeyStore; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.jetty.policy.PolicyBlock; -import org.eclipse.jetty.policy.PolicyContext; -import org.eclipse.jetty.policy.PolicyException; -import org.eclipse.jetty.policy.entry.GrantEntry; -import org.eclipse.jetty.policy.entry.KeystoreEntry; - -/** - * Load the policies within the stream and resolve into protection domains and permission collections - * - */ -public class DefaultPolicyLoader -{ - - public static Set load( InputStream policyStream, PolicyContext context ) throws PolicyException - { - Set policies = new HashSet(); - KeyStore keystore = null; - - try - { - PolicyFileScanner loader = new PolicyFileScanner(); - - Collection grantEntries = new ArrayList(); - List keystoreEntries = new ArrayList(); - - loader.scanStream( new InputStreamReader(policyStream), grantEntries, keystoreEntries ); - - for ( Iterator i = keystoreEntries.iterator(); i.hasNext();) - { - KeystoreEntry node = i.next(); - node.expand( context ); - - keystore = node.toKeyStore(); - - if ( keystore != null ) - { - // we only process the first valid keystore - context.setKeystore( keystore ); - break; - } - } - - for ( Iterator i = grantEntries.iterator(); i.hasNext(); ) - { - GrantEntry grant = i.next(); - grant.expand( context ); - - PolicyBlock policy = new PolicyBlock(); - - policy.setCodeSource( grant.getCodeSource() ); - policy.setPrincipals( grant.getPrincipals() ); - policy.setPermissions( grant.getPermissions() ); - - policies.add(policy); - } - - return policies; - } - catch ( Exception e ) - { - throw new PolicyException( e ); - } - } -} - - - - - diff --git a/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java b/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java deleted file mode 100644 index 4a2b6d1d637..00000000000 --- a/jetty-policy/src/main/java/org/eclipse/jetty/policy/loader/PolicyFileScanner.java +++ /dev/null @@ -1,459 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// This file adapted for use from Apache Harmony code by written and contributed -// to that project by Alexey V. Varlamov under the ASL-2.0 -// See CQ3380 -// ======================================================================== - -package org.eclipse.jetty.policy.loader; - - -import java.io.IOException; -import java.io.Reader; -import java.io.StreamTokenizer; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import org.eclipse.jetty.policy.entry.GrantEntry; -import org.eclipse.jetty.policy.entry.KeystoreEntry; -import org.eclipse.jetty.policy.entry.PermissionEntry; -import org.eclipse.jetty.policy.entry.PrincipalEntry; - - -/** - * This is a basic high-level tokenizer of policy files. It takes in a stream, analyzes data read from it and returns a - * set of structured tokens.
- * This implementation recognizes text files, consisting of clauses with the following syntax: - * - *
- * 
- *     keystore "some_keystore_url", "keystore_type";
- * 
- * 
- * - *
- * 
- *     grant [SignedBy "signer_names"] [, CodeBase "URL"]
- *      [, Principal [principal_class_name] "principal_name"]
- *      [, Principal [principal_class_name] "principal_name"] ... {
- *      permission permission_class_name [ "target_name" ] [, "action"] 
- *      [, SignedBy "signer_names"];
- *      permission ...
- *      };
- * 
- * 
- * - * For semantical details of this format, see org.apache.harmony.security.DefaultPolicy javadoc.
- * - * Keywords are case-insensitive in contrast to quoted string literals. Comma-separation rule is quite forgiving, most - * commas may be just omitted. Whitespaces, line- and block comments are ignored. Symbol-level tokenization is delegated - * to java.io.StreamTokenizer.
- *
- * This implementation is effectively thread-safe, as it has no field references to data being processed (that is, - * passes all the data as method parameters). - * - * This implementation is a bit more strict in enforcing format then the default policy scanner as implemented in the sun jdk. - */ -public class PolicyFileScanner -{ - - /** - * Specific exception class to signal policy file syntax error. - */ - public static class InvalidFormatException - extends Exception - { - - /** - * @serial - */ - private static final long serialVersionUID = 5789786270390222184L; - - /** - * Constructor with detailed message parameter. - */ - public InvalidFormatException( String arg0 ) - { - super( arg0 ); - } - } - - /** - * Configures passed tokenizer accordingly to supported syntax. - */ - protected StreamTokenizer configure( StreamTokenizer st ) - { - st.slashSlashComments( true ); - st.slashStarComments( true ); - st.wordChars( '_', '_' ); - st.wordChars( '$', '$' ); - return st; - } - - /** - * Performs the main parsing loop. Starts with creating and configuring a StreamTokenizer instance; then tries to - * recognize keystore or grant keyword. When found, invokes read method corresponding to the clause - * and collects result to the passed collection. - * - * @param r policy stream reader - * @param grantEntries a collection to accumulate parsed GrantEntries - * @param keystoreEntries a collection to accumulate parsed KeystoreEntries - * @throws IOException if stream reading failed - * @throws InvalidFormatException if unexpected or unknown token encountered - */ - public void scanStream( Reader r, Collection grantEntries, List keystoreEntries ) - throws IOException, InvalidFormatException - { - StreamTokenizer st = configure( new StreamTokenizer( r ) ); - // main parsing loop - parsing: while ( true ) - { - switch ( st.nextToken() ) - { - case StreamTokenizer.TT_EOF: // we've done the job - break parsing; - - case StreamTokenizer.TT_WORD: - if ( Util.equalsIgnoreCase( "keystore", st.sval ) ) { //$NON-NLS-1$ - keystoreEntries.add( readKeystoreNode( st ) ); - } - else if ( Util.equalsIgnoreCase( "grant", st.sval ) ) { //$NON-NLS-1$ - grantEntries.add( readGrantNode( st ) ); - } - else - { - handleUnexpectedToken( st, "Expected entries are : \"grant\" or \"keystore\"" ); //$NON-NLS-1$ - - } - break; - - case ';': // just delimiter of entries - break; - - default: - handleUnexpectedToken( st ); - break; - } - } - } - - /** - * Tries to read keystore clause fields. The expected syntax is - * - *
-     * 
-     *     "some_keystore_url"[, "keystore_type"];
-     * 
-     * 
- * - * @return successfully parsed KeystoreNode - * @throws IOException if stream reading failed - * @throws InvalidFormatException if unexpected or unknown token encountered - */ - protected KeystoreEntry readKeystoreNode( StreamTokenizer st ) - throws IOException, InvalidFormatException - { - KeystoreEntry ke = new KeystoreEntry(); - if ( st.nextToken() == '"' ) - { - ke.setUrl( st.sval ); - if ( ( st.nextToken() == '"' ) || ( ( st.ttype == ',' ) && ( st.nextToken() == '"' ) ) ) - { - ke.setType( st.sval ); - } - else - { // handle token in the main loop - st.pushBack(); - } - } - else - { - handleUnexpectedToken( st, "Expected syntax is : keystore \"url\"[, \"type\"]" ); //$NON-NLS-1$ - - } - return ke; - } - - /** - * Tries to read grant clause.
- * First, it reads codebase , signedby , principal entries till the '{' (opening curly brace) - * symbol. Then it calls readPermissionEntries() method to read the permissions of this clause.
- * Principal entries (if any) are read by invoking readPrincipalNode() method, obtained PrincipalEntries are - * accumulated.
- * The expected syntax is - * - *
-     * 
-     *     [ [codebase "url"] | [signedby "name1,...,nameN"] | 
-     *          principal ...] ]* { ... }
-     * 
-     * 
- * - * @return successfully parsed GrantNode - * @throws IOException if stream reading failed - * @throws InvalidFormatException if unexpected or unknown token encountered - */ - protected GrantEntry readGrantNode( StreamTokenizer st ) - throws IOException, InvalidFormatException - { - GrantEntry ge = new GrantEntry(); - parsing: while ( true ) - { - switch ( st.nextToken() ) - { - - case StreamTokenizer.TT_WORD: - if ( Util.equalsIgnoreCase( "signedby", st.sval ) ) { //$NON-NLS-1$ - if ( st.nextToken() == '"' ) - { - ge.setSigners( st.sval ); - } - else - { - handleUnexpectedToken( st, "Expected syntax is : signedby \"name1,...,nameN\"" ); //$NON-NLS-1$ - } - } - else if ( Util.equalsIgnoreCase( "codebase", st.sval ) ) { //$NON-NLS-1$ - if ( st.nextToken() == '"' ) - { - ge.setCodebase( st.sval ); - } - else - { - handleUnexpectedToken( st, "Expected syntax is : codebase \"url\"" ); //$NON-NLS-1$ - } - } - else if ( Util.equalsIgnoreCase( "principal", st.sval ) ) { //$NON-NLS-1$ - ge.addPrincipal( readPrincipalNode( st ) ); - } - else - { - handleUnexpectedToken( st ); - } - break; - - case ',': // just delimiter of entries - break; - - case '{': - ge.setPermissions( readPermissionEntries( st ) ); - break parsing; - - default: // handle token in the main loop - st.pushBack(); - break parsing; - } - } - - return ge; - } - - /** - * Tries to read Principal Node fields. The expected syntax is - * - *
-     * 
-     *     [ principal_class_name ] "principal_name"
-     * 
-     * 
- * - * Both class and name may be wildcards, wildcard names should not surrounded by quotes. - * - * @return successfully parsed PrincipalNode - * @throws IOException if stream reading failed - * @throws InvalidFormatException if unexpected or unknown token encountered - */ - protected PrincipalEntry readPrincipalNode( StreamTokenizer st ) - throws IOException, InvalidFormatException - { - PrincipalEntry pe = new PrincipalEntry(); - if ( st.nextToken() == StreamTokenizer.TT_WORD ) - { - pe.setKlass( st.sval ); - st.nextToken(); - } - else if ( st.ttype == '*' ) - { - pe.setKlass( PrincipalEntry.WILDCARD ); - st.nextToken(); - } - if ( st.ttype == '"' ) - { - pe.setName( st.sval ); - } - else if ( st.ttype == '*' ) - { - pe.setName( PrincipalEntry.WILDCARD ); - } - else - { - handleUnexpectedToken( st, "Expected syntax is : principal [class_name] \"principal_name\"" ); //$NON-NLS-1$ - } - return pe; - } - - /** - * Tries to read a list of permission entries. The expected syntax is - * - *
-     * 
-     *     permission permission_class_name
-     *          [ "target_name" ] [, "action_list"]
-     *          [, signedby "name1,name2,..."];
-     * 
-     * 
- * - * List is terminated by '}' (closing curly brace) symbol. - * - * @return collection of successfully parsed PermissionEntries - * @throws IOException if stream reading failed - * @throws InvalidFormatException if unexpected or unknown token encountered - */ - protected Collection readPermissionEntries( StreamTokenizer st ) - throws IOException, InvalidFormatException - { - Collection permissions = new HashSet(); - parsing: while ( true ) - { - switch ( st.nextToken() ) - { - - case StreamTokenizer.TT_WORD: - if ( Util.equalsIgnoreCase( "permission", st.sval ) ) { //$NON-NLS-1$ - PermissionEntry pe = new PermissionEntry(); - if ( st.nextToken() == StreamTokenizer.TT_WORD ) - { - pe.setKlass( st.sval ); - if ( st.nextToken() == '"' ) - { - pe.setName( st.sval ); - st.nextToken(); - } - if ( st.ttype == ',' ) - { - st.nextToken(); - } - if ( st.ttype == '"' ) - { - pe.setActions( st.sval ); - if ( st.nextToken() == ',' ) - { - st.nextToken(); - } - } - if ( st.ttype == StreamTokenizer.TT_WORD && Util.equalsIgnoreCase( "signedby", st.sval ) ) { //$NON-NLS-1$ - if ( st.nextToken() == '"' ) - { - pe.setSigners( st.sval ); - } - else - { - handleUnexpectedToken( st ); - } - } - else - { // handle token in the next iteration - st.pushBack(); - } - permissions.add( pe ); - continue parsing; - } - } - handleUnexpectedToken( - st, - "Expected syntax is : permission permission_class_name [\"target_name\"] [, \"action_list\"] [, signedby \"name1,...,nameN\"]" ); //$NON-NLS-1$ - break; - - case ';': // just delimiter of entries - break; - - case '}': // end of list - break parsing; - - default: // invalid token - handleUnexpectedToken( st ); - break; - } - } - - return permissions; - } - - /** - * Formats a detailed description of tokenizer status: current token, current line number, etc. - */ - protected String composeStatus( StreamTokenizer st ) - { - return st.toString(); - } - - /** - * Throws InvalidFormatException with detailed diagnostics. - * - * @param st a tokenizer holding the erroneous token - * @param message a user-friendly comment, probably explaining expected syntax. Should not be null- use - * the overloaded single-parameter method instead. - */ - protected final void handleUnexpectedToken( StreamTokenizer st, String message ) - throws InvalidFormatException - { - throw new InvalidFormatException( "Unexpected token encountered: " + composeStatus( st ) + ". " + message ); - } - - /** - * Throws InvalidFormatException with error status: which token is unexpected on which line. - * - * @param st a tokenizer holding the erroneous token - */ - protected final void handleUnexpectedToken( StreamTokenizer st ) - throws InvalidFormatException - { - throw new InvalidFormatException( "Unexpected token encountered: " + composeStatus( st ) ); - } - - - private static class Util - { - public static String toUpperCase( String s ) - { - int len = s.length(); - StringBuilder buffer = new StringBuilder( len ); - for ( int i = 0; i < len; i++ ) - { - char c = s.charAt( i ); - if ( 'a' <= c && c <= 'z' ) - { - buffer.append( (char) ( c - ( 'a' - 'A' ) ) ); - } - else - { - buffer.append( c ); - } - } - return buffer.toString(); - } - - public static boolean equalsIgnoreCase( String s1, String s2 ) - { - s1 = toUpperCase( s1 ); - s2 = toUpperCase( s2 ); - return s1.equals( s2 ); - } - } - -} diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java deleted file mode 100644 index 67cc0f803fb..00000000000 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyRuntimeTest.java +++ /dev/null @@ -1,265 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessControlException; -import java.security.Policy; -import java.util.Collections; -import java.util.HashMap; -import java.util.Set; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.OS; -import org.eclipse.jetty.util.IO; -import org.junit.After; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; - -public class JettyPolicyRuntimeTest -{ - private HashMap evaluator = new HashMap(); - - @Before - public void init() throws Exception - { - System.setSecurityManager(null); - Policy.setPolicy(null); - - evaluator.put("jetty.home",MavenTestingUtils.getBaseURI().toASCIIString()); - evaluator.put("basedir",MavenTestingUtils.getBaseURI().toASCIIString()); - } - - @After - public void destroy() throws Exception - { - System.setSecurityManager(null); - Policy.setPolicy(null); - IO.delete(new File ("/tmp", "foo")); - } - - @Test - public void testSimplePolicyReplacement() throws Exception - { - Assume.assumeTrue(!OS.IS_WINDOWS); // Ignore test if running under windows. - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-1").getAbsolutePath(), evaluator); - ap.refresh(); - - Policy.setPolicy( ap ); - System.setSecurityManager( new SecurityManager() ); - - File test = new File( "/tmp" ); - - assertTrue( test.canRead() ); - } - - @Test - public void testRepeatedPolicyReplacement() throws Exception - { - Assume.assumeTrue(!OS.IS_WINDOWS); // Ignore test if running under windows. - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-2/a").getAbsolutePath(),evaluator); - ap.refresh(); - - Policy.setPolicy( ap ); - System.setSecurityManager( new SecurityManager() ); - - // Test that the all permission policy allows us to do this - try - { - File test3 = new File( "/tmp/foo/bar/do" ); - test3.mkdirs(); - test3.delete(); - } - catch ( AccessControlException ace ) - { - ace.printStackTrace(System.err); - fail("Should NOT have thrown an AccessControlException"); - } - - JettyPolicy ap2 = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-2/b").getAbsolutePath(),evaluator); - ap2.refresh(); - - Policy.setPolicy( ap2 ); - - // Test that the new policy does replace the old one and we are now not allowed - try - { - File test3 = new File( "/tmp/foo/bar/do" ); - test3.mkdirs(); - - fail("Should have thrown an AccessControlException"); - } - catch ( AccessControlException ace ) - { - // Expected Path - } - } - - @Test - public void testPolicyRestrictive() throws Exception - { - // TODO - temporary, create alternate file to load for windows - Assume.assumeTrue(!OS.IS_WINDOWS); // Ignore test if running under windows. - - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-3").getAbsolutePath(),evaluator); - ap.refresh(); - - Policy.setPolicy( ap ); - System.setSecurityManager( new SecurityManager() ); - - File test = new File( "/tmp" ); - - assertTrue ( test.canRead() ); - - File test2 = new File( "/tmp/foo" ); - test2.mkdirs(); - assertTrue ( test2.canRead() ); - - try - { - File test3 = new File("/tmp/foo/bar/do"); - test3.mkdirs(); - - fail("Should have thrown an AccessControlException"); - } - catch (AccessControlException ace) - { - // Expected Path - } - } - - @Test - public void testCertificateLoader() throws Exception - { - // TODO - temporary, create alternate file to load for windows - Assume.assumeTrue(!OS.IS_WINDOWS); // Ignore test if running under windows. - - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-4").getAbsolutePath(),evaluator); - ap.refresh(); - - - URL url = MavenTestingUtils.getTargetURL("test-policy/jetty-test-policy.jar"); - - //System.out.println(url.toURI().toASCIIString()); - //System.out.println(MavenTestingUtils.getBaseURI().toASCIIString()); - - URLClassLoader loader ; - if (Thread.currentThread().getContextClassLoader() != null ) - { - loader = new URLClassLoader( new URL[]{ url }, Thread.currentThread().getContextClassLoader() ); - } - else - { - loader = new URLClassLoader( new URL[]{ url }, ClassLoader.getSystemClassLoader() ); - } - - Thread.currentThread().setContextClassLoader(loader); - - Policy.setPolicy( ap ); - System.setSecurityManager( new SecurityManager() ); - - - ap.refresh(); - - ap.dump(System.out); - - - Class clazz = loader.loadClass("org.eclipse.jetty.toolchain.test.policy.Tester"); - - Method m = clazz.getMethod("testEcho",new Class[] - { String.class }); - - String foo = (String)m.invoke(clazz.newInstance(), "foo"); - - assertEquals("foo",foo); - - Method m2 = clazz.getMethod("testReadSystemProperty",new Class[] - { String.class }); - - m2.invoke(clazz.newInstance(), "foo"); - - assertTrue("system property access was granted",true); - - // ap.dump(System.out); - } - - @Test - public void testBadCertificateLoader() throws Exception - { - // TODO - temporary, create alternate file to load for windows - Assume.assumeTrue(!OS.IS_WINDOWS); // Ignore test if running under windows. - - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getTestResourceDir("runtime-test-5").getAbsolutePath(),evaluator); - ap.refresh(); - - Policy.setPolicy( ap ); - System.setSecurityManager( new SecurityManager() ); - - URL url = MavenTestingUtils.getTargetURL("test-policy/jetty-test-policy.jar"); - - URLClassLoader loader ; - if (Thread.currentThread().getContextClassLoader() != null ) - { - loader = new URLClassLoader( new URL[]{ url }, Thread.currentThread().getContextClassLoader() ); - } - else - { - loader = new URLClassLoader( new URL[]{ url }, ClassLoader.getSystemClassLoader() ); - } - - Thread.currentThread().setContextClassLoader(loader); - - ap.refresh(); - - try - { - Class clazz = loader.loadClass("org.eclipse.jetty.toolchain.test.policy.Tester"); - - Method m = clazz.getMethod( "testEcho", new Class[] {String.class} ); - - String foo = (String)m.invoke( clazz.newInstance(), "foo"); - - assertEquals("foo", foo ); - - Method m2 = clazz.getMethod( "testReadSystemProperty", new Class[] {String.class} ); - - m2.invoke(clazz.newInstance(), "foobar"); - - fail("Should have thrown an InvocationTargetException"); - } - catch ( InvocationTargetException e ) - { - assertTrue(e.getCause().getMessage().contains( "access denied" )); - } - } - - private Set getSinglePolicy(String name) - { - return Collections.singleton(MavenTestingUtils.getTestResourceFile(name).getAbsolutePath()); - } -} diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java deleted file mode 100644 index afda0442824..00000000000 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/JettyPolicyTest.java +++ /dev/null @@ -1,424 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.FilePermission; -import java.net.URL; -import java.security.CodeSource; -import java.security.Permission; -import java.security.PermissionCollection; -import java.security.ProtectionDomain; -import java.security.cert.Certificate; -import java.util.HashMap; -import java.util.PropertyPermission; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.junit.Before; -import org.junit.Test; - -public class JettyPolicyTest -{ - private HashMap evaluator = new HashMap(); - - @Before - public void setUp() throws Exception - { - evaluator.put("jetty.home",MavenTestingUtils.getBaseURI().toASCIIString()); - evaluator.put("basedir",MavenTestingUtils.getBaseURI().toASCIIString()); - } - - - /** - * Simple test for loading a policy file and validating that the AllPermission - * was granted successfully. - */ - @Test - public void testGlobalAllPermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-1").getAbsolutePath(), evaluator ); - - ap.refresh(); - - PermissionCollection pc = ap.getPermissions(new ProtectionDomain(null,null)); - - assertNotNull(pc); - - Permission testPerm = new FilePermission("/tmp","read"); - - assertTrue(pc.implies(testPerm)); - - } - - /** - * Simple test of loading a policy file with a single codebase defined that grants specific - * FilePermission. Then test that read and write were granted but delete was not. - */ - @Test - public void testSingleCodebaseFilePermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-2").getAbsolutePath(), evaluator ); - - ap.refresh(); - - URL url = new URL("file:///foo.jar"); - CodeSource cs = new CodeSource(url,new Certificate[0]); - - PermissionCollection pc = ap.getPermissions(cs); - - assertNotNull(pc); - - Permission testReadPerm = new FilePermission( "/tmp/*", "read" ); - Permission testWritePerm = new FilePermission( "/tmp/*", "write" ); - Permission testDeletePerm = new FilePermission( "/tmp/*", "delete" ); - - assertTrue( pc.implies( testReadPerm ) ); - assertTrue( pc.implies( testWritePerm ) ); - assertFalse(pc.implies( testDeletePerm ) ); - - } - - /** - * Tests multiple codebases in a single policy file are loaded correctly and that the various - * grants do indeed work accordingly - * - * @throws Exception - */ - @Test - public void testMultipleCodebaseFilePermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-3").getAbsolutePath(), evaluator ); - - ap.refresh(); - - // test the bar.jar codebase grant - URL url = new URL("file:///bar.jar"); - CodeSource cs = new CodeSource(url,new Certificate[0]); - - PermissionCollection barPermissionCollection = ap.getPermissions(cs); - - assertNotNull( barPermissionCollection ); - - Permission testBarPerm = new FilePermission("/tmp/*","read,write"); - Permission testBarPerm2 = new FilePermission("/usr/*","read"); // only read was granted - Permission testBarPerm3 = new FilePermission("/usr/*","write"); // only read was granted - - assertTrue( barPermissionCollection.implies( testBarPerm ) ); - assertTrue( barPermissionCollection.implies( testBarPerm2 ) ); - assertFalse( barPermissionCollection.implies( testBarPerm3 ) ); - - // test the global permission grant - PermissionCollection globalPermissionCollection = ap.getPermissions( new ProtectionDomain( null, null ) ); - - assertNotNull( globalPermissionCollection ); - - Permission testPropertyPermission = new PropertyPermission("main.class","read"); - assertTrue( globalPermissionCollection.implies(testPropertyPermission)); - // its global so it ought to be global, double check that - assertTrue( barPermissionCollection.implies(testPropertyPermission)); - - // test the foo.jar codebase grant - URL fooUrl = new URL( "file:///foo.jar" ); - CodeSource fooCodeSource = new CodeSource( fooUrl, new Certificate[0]); - - PermissionCollection fooPermissionCollection = ap.getPermissions( fooCodeSource ); - - assertNotNull( fooPermissionCollection ); - - Permission testFooPerm = new FilePermission( "/tmp/*", "read,write" ); - Permission testFooPerm2 = new FilePermission( "/tmp/*", "read,write,delete" ); - - assertTrue( fooPermissionCollection.implies(testFooPerm) ); - assertFalse( fooPermissionCollection.implies(testFooPerm2) ); - - // make sure that the foo codebase isn't getting bar permissions - assertFalse( fooPermissionCollection.implies(testBarPerm2) ); - // but make sure that foo codebase is getting global - assertTrue( fooPermissionCollection.implies(testPropertyPermission)); - } - - @Test - public void testMultipleCodebaseMixedPermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-4").getAbsolutePath(), evaluator ); - - ap.refresh(); - - // test the bar.jar codebase grant - URL url = new URL( "file:///bar.jar" ); - CodeSource cs = new CodeSource( url, new Certificate[0]); - - PermissionCollection barPermissionCollection = ap.getPermissions( cs ); - - assertNotNull( barPermissionCollection ); - - Permission testBarPerm = new FilePermission( "/tmp/*", "read,write" ); - Permission testBarPerm2 = new FilePermission( "/usr/*", "read" ); - - assertTrue( barPermissionCollection.implies( testBarPerm ) ); - assertTrue( barPermissionCollection.implies( testBarPerm2 ) ); - - // test the global permission grant - PermissionCollection globalPermissionCollection = ap.getPermissions( new ProtectionDomain( null, null ) ); - - assertNotNull( globalPermissionCollection ); - - Permission testPropertyPermission = new PropertyPermission("main.class","read"); - assertTrue( globalPermissionCollection.implies(testPropertyPermission)); - // its global so it ought to be global, double check that - assertTrue( barPermissionCollection.implies(testPropertyPermission)); - - // test the foo.jar codebase grant - URL fooUrl = new URL( "file:///foo.jar" ); - CodeSource fooCodeSource = new CodeSource( fooUrl, new Certificate[0]); - - PermissionCollection fooPermissionCollection = ap.getPermissions( fooCodeSource ); - - assertNotNull( fooPermissionCollection ); - - Permission testFooPerm = new FilePermission( "/tmp/*", "read,write" ); - Permission testFooPerm2 = new FilePermission( "/tmp/*", "read,write,delete" ); - - assertTrue( fooPermissionCollection.implies(testFooPerm) ); - assertFalse( fooPermissionCollection.implies(testFooPerm2) ); - - // make sure that the foo codebase isn't getting bar permissions - assertFalse( fooPermissionCollection.implies(testBarPerm2) ); - // but make sure that foo codebase is getting global - assertTrue( fooPermissionCollection.implies(testPropertyPermission)); - - } - - /** - * Sanity check that jetty policy file parses - * - * TODO insert typical jetty requirements in here to test - * - * @throws Exception - */ - @Test - public void testSCLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy(MavenTestingUtils.getProjectDir("src/main/config/lib/policy").getAbsolutePath(),evaluator); - - ap.refresh(); - } - - /** - * Test the simple loading of multiple files with no overlapping of security permission code sources - * @throws Exception - */ - @Test - public void testMultipleFilePermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-5").getAbsolutePath(), evaluator ); - - ap.refresh(); - - URL url = new URL("file:///bar.jar"); - CodeSource cs = new CodeSource(url,new Certificate[0]); - - PermissionCollection pc = ap.getPermissions(cs); - - assertNotNull(pc); - - Permission testPerm = new FilePermission("/tmp/*","read"); - Permission testPerm2 = new FilePermission("/usr/*","write"); // - - assertTrue(pc.implies(testPerm)); - assertFalse(pc.implies(testPerm2)); - } - - /** - * Tests the aggregation of multiple policy files into the same protection - * domain of a granted codesource - * - * @throws Exception - */ - @Test - public void testAggregateMultipleFilePermissionLoader() throws Exception - { - JettyPolicy ap = new JettyPolicy( MavenTestingUtils.getTestResourceDir("policy-test-6").getAbsolutePath(), evaluator ); - - ap.refresh(); - - URL url = new URL( "file:///bar.jar" ); - CodeSource cs = new CodeSource( url, new Certificate[0]); - - PermissionCollection pc = ap.getPermissions( cs ); - - assertNotNull( pc ); - - Permission testPerm = new FilePermission( "/tmp/*", "read, write" ); - Permission testPerm2 = new FilePermission( "/usr/*", "write" ); - - // this tests that two policy files granting to the same codebase aggregate - // together their permissions, /tmp/* should be read, write after loading policy 2 and 3 - assertTrue( pc.implies( testPerm ) ); - assertFalse( pc.implies( testPerm2 ) ); - - } - - - /** - * test the resolution of the loading of the policy files - * - * @throws Exception - */ -// @Test -// public void testPolicyDirectories() throws Exception -// { -// Set files = new HashSet(); -// -// files.add( MavenTestingUtils.getTestResourceFile("single-codebase-file-permission.policy").getAbsolutePath() ); -// files.add( MavenTestingUtils.getTestResourceDir("context").getAbsolutePath() ); -// -// JettyPolicy ap = new JettyPolicy( files, evaluator ); -// -// Assert.assertEquals(3, ap.getKnownPolicyFiles().size()); -// -// } - -// /** -// * test the discovery and loading of template files -// * -// * @throws Exception -// */ -// @Test -// public void testTemplateDirectories() throws Exception -// { -// Set policyFiles = new HashSet(); -// Set templateFiles = new HashSet(); -// -// policyFiles.add(MavenTestingUtils.getTestResourceFile("single-codebase-file-permission.policy").getAbsolutePath()); -// policyFiles.add(MavenTestingUtils.getTestResourceDir("context").getAbsolutePath()); -// -// templateFiles.add(MavenTestingUtils.getTestResourceDir("template").getAbsolutePath()); -// -// JettyPolicy ap = new JettyPolicy(policyFiles,templateFiles,evaluator); -// -// Assert.assertEquals(3,ap.getKnownPolicyFiles().size()); -// -// Assert.assertEquals(2,ap.getKnownTemplateFiles().size()); -// -// } -// -// /** -// * tests the assigning of a template to a codesource -// * -// * @throws Exception -// */ -// @Test -// public void testTemplateAssign() throws Exception -// { -// Set policyFiles = new HashSet(); -// Set templateFiles = new HashSet(); -// -// policyFiles.add(MavenTestingUtils.getTestResourceFile("single-codebase-file-permission.policy").getAbsolutePath()); -// policyFiles.add(MavenTestingUtils.getTestResourceDir("context").getAbsolutePath()); -// -// templateFiles.add(MavenTestingUtils.getTestResourceDir("template").getAbsolutePath()); -// -// JettyPolicy ap = new JettyPolicy(policyFiles,templateFiles,evaluator); -// -// ap.assignTemplate("file:///template.jar",new String[] -// { "template1", "template2" }); -// -// Assert.assertEquals(2,ap.getAssignedTemplates("file:///template.jar").length); -// -// } -// -// /** -// * tests the assigning of a template to a codesource -// * -// * @throws Exception -// */ -// @Test -// public void testTemplateRemove() throws Exception -// { -// Set policyFiles = new HashSet(); -// Set templateFiles = new HashSet(); -// -// policyFiles.add(MavenTestingUtils.getTestResourceFile("single-codebase-file-permission.policy").getAbsolutePath()); -// policyFiles.add(MavenTestingUtils.getTestResourceDir("context").getAbsolutePath()); -// -// templateFiles.add(MavenTestingUtils.getTestResourceDir("template").getAbsolutePath()); -// -// JettyPolicy ap = new JettyPolicy(policyFiles,templateFiles,evaluator); -// -// ap.assignTemplate("file:///template.jar",new String[] -// { "template1", "template2" }); -// -// Assert.assertEquals(2,ap.getAssignedTemplates("file:///template.jar").length); -// -// ap.unassignTemplates("file:///template.jar"); -// -// Assert.assertEquals(0,ap.getAssignedTemplates("file:///template.jar").length); -// -// } -// -// @Test -// public void testTemplatePermissions() throws Exception -// { -// Set policyFiles = new HashSet(); -// Set templateFiles = new HashSet(); -// -// policyFiles.add(MavenTestingUtils.getTestResourceFile("single-codebase-file-permission.policy").getAbsolutePath()); -// policyFiles.add(MavenTestingUtils.getTestResourceDir("context").getAbsolutePath()); -// -// templateFiles.add(MavenTestingUtils.getTestResourceDir("template").getAbsolutePath()); -// -// JettyPolicy ap = new JettyPolicy(policyFiles,templateFiles,evaluator); -// -// URL url = new URL("file:///template.jar"); -// CodeSource cs = new CodeSource(url,new Certificate[0]); -// -// PermissionCollection pc = ap.getPermissions(cs); -// -// assertNotNull(pc); -// -// Permission testPerm = new FilePermission("/tmp/*","read"); -// Permission testPerm2 = new FilePermission("/tmp/*","write"); -// -// // no templates have been assigned -// assertFalse(pc.implies(testPerm)); -// -// ap.assignTemplate("file:///template.jar",new String[] {"template1"}); -// -// PermissionCollection pc2 = ap.getPermissions(cs); -// -// assertNotNull(pc2); -// -// assertTrue(pc2.implies(testPerm)); -// assertFalse(pc2.implies(testPerm2)); -// -// -// ap.assignTemplate("file:///template.jar",new String[] {"template1", "template2"}); -// -// PermissionCollection pc3 = ap.getPermissions(cs); -// -// assertNotNull(pc3); -// -// assertTrue(pc3.implies(testPerm)); -// assertTrue(pc3.implies(testPerm2)); -// } -} diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyContextTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyContextTest.java deleted file mode 100644 index 77b4571598f..00000000000 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyContextTest.java +++ /dev/null @@ -1,120 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.security.Permission; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jetty.policy.entry.GrantEntry; -import org.eclipse.jetty.policy.entry.KeystoreEntry; -import org.eclipse.jetty.policy.loader.PolicyFileScanner; -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.OS; -import org.junit.Before; -import org.junit.Test; - -public class PolicyContextTest -{ - public static final String __PRINCIPAL = "javax.security.auth.x500.X500Principal \"CN=Jetty Policy,OU=Artifact,O=Jetty Project,L=Earth,ST=Internet,C=US\""; - - @Before - public void init() throws Exception - { - System.setProperty( "basedir", MavenTestingUtils.getBaseURI().toASCIIString() ); - } - - @Test - public void testSelfPropertyExpansion() throws Exception - { - PolicyContext context = new PolicyContext(); - PolicyFileScanner loader = new PolicyFileScanner(); - List grantEntries = new ArrayList(); - List keystoreEntries = new ArrayList(); - - File policyFile = MavenTestingUtils.getTestResourceFile("context/jetty-certificate.policy"); - - loader.scanStream( new InputStreamReader( new FileInputStream( policyFile ) ), grantEntries, keystoreEntries ); - - if ( !OS.IS_WINDOWS ) //temporary, create alternate file to load for windows - { - for (KeystoreEntry node : keystoreEntries) - { - node.expand(context); - - context.setKeystore(node.toKeyStore()); - } - - GrantEntry grant = grantEntries.get( 0 ); - grant.expand( context ); - - Permission perm = grant.getPermissions().elements().nextElement(); - - assertEquals( __PRINCIPAL, perm.getName() ); - } - } - - @Test - public void testAliasPropertyExpansion() throws Exception - { - PolicyContext context = new PolicyContext(); - PolicyFileScanner loader = new PolicyFileScanner(); - List grantEntries = new ArrayList(); - List keystoreEntries = new ArrayList(); - - File policyFile = MavenTestingUtils.getTestResourceFile("context/jetty-certificate-alias.policy"); - - loader.scanStream( new InputStreamReader( new FileInputStream( policyFile ) ), grantEntries, keystoreEntries ); - - if ( !OS.IS_WINDOWS ) //temporary, create alternate file to load for windows - { - for (KeystoreEntry node : keystoreEntries) - { - node.expand(context); - - context.setKeystore(node.toKeyStore()); - } - - GrantEntry grant = grantEntries.get( 0 ); - grant.expand( context ); - - Permission perm = grant.getPermissions().elements().nextElement(); - - assertEquals( __PRINCIPAL, perm.getName() ); - } - } - - @Test - public void testFileSeparatorExpansion() throws Exception - { - PolicyContext context = new PolicyContext(); - context.addProperty( "foo", "bar" ); - - assertEquals(File.separator, context.evaluate( "${/}" ) ); - - assertEquals(File.separator + "bar" + File.separator, context.evaluate( "${/}${foo}${/}" ) ); - - assertEquals(File.separator + File.separator, context.evaluate( "${/}${/}" ) ); - } -} diff --git a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java b/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java deleted file mode 100644 index 3997f5cf202..00000000000 --- a/jetty-policy/src/test/java/org/eclipse/jetty/policy/PolicyMonitorTest.java +++ /dev/null @@ -1,138 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.policy; - -import java.io.File; -import java.util.HashMap; -import java.util.concurrent.atomic.AtomicInteger; - -import junit.framework.Assert; - -import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.toolchain.test.OS; -import org.junit.Before; -import org.junit.Test; - -public class PolicyMonitorTest -{ - - private HashMap evaluator = new HashMap(); - - @Before - public void init() throws Exception - { - System.setProperty( "basedir", MavenTestingUtils.getBaseURI().toASCIIString() ); - } - - @Test - public void testSimpleLoading() throws Exception - { - final AtomicInteger count = new AtomicInteger(0); - - PolicyMonitor monitor = new PolicyMonitor(new File(MavenTestingUtils.getTargetDir(), - "test-classes/monitor-test-1").getAbsolutePath()) - { - - @Override - public void onPolicyChange(PolicyBlock grant) - { - count.incrementAndGet(); - } - }; - monitor.setScanInterval(1); - - monitor.start(); - - while (!monitor.isInitialized() ) - { - Thread.sleep(100); - } - - Assert.assertEquals(1,count.get()); - monitor.stop(); - } - - @Test - public void testSimpleReloading() throws Exception - { - if (OS.IS_WINDOWS) - { - return; - } - - final AtomicInteger count = new AtomicInteger(0); - - PolicyMonitor monitor = new PolicyMonitor(new File(MavenTestingUtils.getTargetDir(), - "test-classes/monitor-test-2").getAbsolutePath()) - { - @Override - public void onPolicyChange(PolicyBlock grant) - { - count.incrementAndGet(); - } - }; - - monitor.setScanInterval(1); - - monitor.start(); - monitor.waitForScan(); - monitor.waitForScan(); - - File permFile =new File(MavenTestingUtils.getTargetDir(), - "test-classes/monitor-test-2/global-all-permission.policy"); - - // Wait so that time is definitely different - monitor.waitForScan(); - permFile.setLastModified(System.currentTimeMillis()); - - monitor.waitForScan(); - monitor.waitForScan(); - - Assert.assertEquals(2,count.get()); - monitor.stop(); - } - - @Test - public void testLoading() throws Exception - { - final AtomicInteger count = new AtomicInteger(0); - - PolicyMonitor monitor = new PolicyMonitor(new File(MavenTestingUtils.getTargetDir(), - "test-classes/monitor-test-3").getAbsolutePath()) - { - @Override - public void onPolicyChange(PolicyBlock grant) - { - count.incrementAndGet(); - } - }; - - monitor.setScanInterval(1); - - monitor.start(); - - while (! monitor.isInitialized() ) - { - Thread.sleep(100); - } - - Assert.assertEquals(16,count.get()); - monitor.stop(); - } -} diff --git a/jetty-policy/src/test/resources/context/jetty-certificate-alias.policy b/jetty-policy/src/test/resources/context/jetty-certificate-alias.policy deleted file mode 100644 index d7e53c4b5a7..00000000000 --- a/jetty-policy/src/test/resources/context/jetty-certificate-alias.policy +++ /dev/null @@ -1,6 +0,0 @@ -keystore "${basedir}/target/test-policy/jetty-policy.keystore", "jks"; - -grant signedBy "jetty-policy-bad", codeBase "${basedir}/target/test-policy/jetty-test-policy-1.0-SNAPSHOT.jar" -{ - permission java.util.PropertyPermission "${{alias:jetty-policy}}", "read"; -}; diff --git a/jetty-policy/src/test/resources/context/jetty-certificate.policy b/jetty-policy/src/test/resources/context/jetty-certificate.policy deleted file mode 100644 index c583d78b3b9..00000000000 --- a/jetty-policy/src/test/resources/context/jetty-certificate.policy +++ /dev/null @@ -1,6 +0,0 @@ -keystore "${basedir}/target/test-policy/jetty-policy.keystore", "jks"; - -grant principal "jetty-policy" -{ - permission java.util.PropertyPermission "${{self}}", "read"; -}; diff --git a/jetty-policy/src/test/resources/monitor-test-1/global-all-permission.policy b/jetty-policy/src/test/resources/monitor-test-1/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-1/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-2/global-all-permission.policy b/jetty-policy/src/test/resources/monitor-test-2/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-2/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-2/template1.template b/jetty-policy/src/test/resources/monitor-test-2/template1.template deleted file mode 100644 index cdfae27a515..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-2/template1.template +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "TEMPLATE" { - permission java.io.FilePermission "/tmp/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/global-all-permission.policy b/jetty-policy/src/test/resources/monitor-test-3/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/global-file-read-only-tmp-permission.policy b/jetty-policy/src/test/resources/monitor-test-3/global-file-read-only-tmp-permission.policy deleted file mode 100644 index 96da8d65504..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/global-file-read-only-tmp-permission.policy +++ /dev/null @@ -1,10 +0,0 @@ -grant { - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "/tmp", "read,write"; - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/tmp/foo/bar/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/jetty-bad-certificate.policy b/jetty-policy/src/test/resources/monitor-test-3/jetty-bad-certificate.policy deleted file mode 100644 index 1b3310babe3..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/jetty-bad-certificate.policy +++ /dev/null @@ -1,25 +0,0 @@ - -keystore "${basedir}target/test-policy/jetty-policy-nobody.keystore", "jks"; - -grant signedBy "jetty-policy-bad", codeBase "${basedir}target/test-policy/jetty-test-policy.jar" -{ - permission java.util.PropertyPermission "foo", "read"; -} - - -grant { - - permission java.io.FilePermission "/-", "read, write"; - - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - - permission java.util.PropertyPermission "java.class.path", "read,write"; - - permission java.util.PropertyPermission "basedir", "read"; - - -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/jetty-certificate.policy b/jetty-policy/src/test/resources/monitor-test-3/jetty-certificate.policy deleted file mode 100644 index 56a5401ec02..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/jetty-certificate.policy +++ /dev/null @@ -1,31 +0,0 @@ -keystore "${basedir}target/test-policy/jetty-policy.keystore", "jks"; - -grant signedBy "jetty-policy", codeBase "${basedir}target/test-policy/jetty-test-policy.jar" -{ - permission java.util.PropertyPermission "foo", "read"; -}; - - -grant { - - permission java.io.FilePermission "/-", "read, write"; - - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - - permission java.util.PropertyPermission "java.class.path", "read,write"; - - permission java.util.PropertyPermission "org.eclipse.jetty.policy.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.SOURCE", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.SOURCE", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - - permission java.util.PropertyPermission "basedir", "read"; -}; \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-file-permission.policy b/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-file-permission.policy deleted file mode 100644 index cac9470b2ab..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-file-permission.policy +++ /dev/null @@ -1,13 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} - -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/usr/*", "read"; -} - -grant { - - permission java.util.PropertyPermission "main.class", "read"; -} diff --git a/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-mixed-permission.policy b/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-mixed-permission.policy deleted file mode 100644 index 7865e077caf..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/multiple-codebase-mixed-permission.policy +++ /dev/null @@ -1,16 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} - -grant codeBase "file:///bar.jar" { - permission java.security.AllPermission; -} - -grant codeBase "file:///snap.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/usr/*", "read,write"; -} - -grant { - permission java.util.PropertyPermission "main.class", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-2.policy b/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-2.policy deleted file mode 100644 index ea34900fba1..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-2.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-3.policy b/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-3.policy deleted file mode 100644 index 45053095a9e..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission-3.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission.policy b/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission.policy deleted file mode 100644 index 646df090d24..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/single-codebase-file-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/monitor-test-3/template1.template b/jetty-policy/src/test/resources/monitor-test-3/template1.template deleted file mode 100644 index cdfae27a515..00000000000 --- a/jetty-policy/src/test/resources/monitor-test-3/template1.template +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "TEMPLATE" { - permission java.io.FilePermission "/tmp/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-1/global-all-permission.policy b/jetty-policy/src/test/resources/policy-test-1/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/policy-test-1/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-2/single-codebase-file-permission.policy b/jetty-policy/src/test/resources/policy-test-2/single-codebase-file-permission.policy deleted file mode 100644 index 646df090d24..00000000000 --- a/jetty-policy/src/test/resources/policy-test-2/single-codebase-file-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-3/multiple-codebase-file-permission.policy b/jetty-policy/src/test/resources/policy-test-3/multiple-codebase-file-permission.policy deleted file mode 100644 index cac9470b2ab..00000000000 --- a/jetty-policy/src/test/resources/policy-test-3/multiple-codebase-file-permission.policy +++ /dev/null @@ -1,13 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} - -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/usr/*", "read"; -} - -grant { - - permission java.util.PropertyPermission "main.class", "read"; -} diff --git a/jetty-policy/src/test/resources/policy-test-4/multiple-codebase-mixed-permission.policy b/jetty-policy/src/test/resources/policy-test-4/multiple-codebase-mixed-permission.policy deleted file mode 100644 index 7865e077caf..00000000000 --- a/jetty-policy/src/test/resources/policy-test-4/multiple-codebase-mixed-permission.policy +++ /dev/null @@ -1,16 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} - -grant codeBase "file:///bar.jar" { - permission java.security.AllPermission; -} - -grant codeBase "file:///snap.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/usr/*", "read,write"; -} - -grant { - permission java.util.PropertyPermission "main.class", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission-2.policy b/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission-2.policy deleted file mode 100644 index ea34900fba1..00000000000 --- a/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission-2.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission.policy b/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission.policy deleted file mode 100644 index 646df090d24..00000000000 --- a/jetty-policy/src/test/resources/policy-test-5/single-codebase-file-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-2.policy b/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-2.policy deleted file mode 100644 index ea34900fba1..00000000000 --- a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-2.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-3.policy b/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-3.policy deleted file mode 100644 index 45053095a9e..00000000000 --- a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission-3.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///bar.jar" { - permission java.io.FilePermission "/tmp/*", "write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission.policy b/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission.policy deleted file mode 100644 index 646df090d24..00000000000 --- a/jetty-policy/src/test/resources/policy-test-6/single-codebase-file-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant codeBase "file:///foo.jar" { - permission java.io.FilePermission "/tmp/*", "read,write"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-1/global-all-permission.policy b/jetty-policy/src/test/resources/runtime-test-1/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-1/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-2/a/global-all-permission.policy b/jetty-policy/src/test/resources/runtime-test-2/a/global-all-permission.policy deleted file mode 100644 index ae56d98e8ed..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-2/a/global-all-permission.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-2/b/global-file-read-only-tmp-permission.policy b/jetty-policy/src/test/resources/runtime-test-2/b/global-file-read-only-tmp-permission.policy deleted file mode 100644 index 96da8d65504..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-2/b/global-file-read-only-tmp-permission.policy +++ /dev/null @@ -1,10 +0,0 @@ -grant { - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "/tmp", "read,write"; - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/tmp/foo/bar/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-3/global-file-read-only-tmp-permission.policy b/jetty-policy/src/test/resources/runtime-test-3/global-file-read-only-tmp-permission.policy deleted file mode 100644 index 96da8d65504..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-3/global-file-read-only-tmp-permission.policy +++ /dev/null @@ -1,10 +0,0 @@ -grant { - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setIO"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - - permission java.io.FilePermission "/tmp", "read,write"; - permission java.io.FilePermission "/tmp/*", "read,write"; - permission java.io.FilePermission "/tmp/foo/bar/*", "read"; -} \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-4/jetty-certificate.policy b/jetty-policy/src/test/resources/runtime-test-4/jetty-certificate.policy deleted file mode 100644 index 56a5401ec02..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-4/jetty-certificate.policy +++ /dev/null @@ -1,31 +0,0 @@ -keystore "${basedir}target/test-policy/jetty-policy.keystore", "jks"; - -grant signedBy "jetty-policy", codeBase "${basedir}target/test-policy/jetty-test-policy.jar" -{ - permission java.util.PropertyPermission "foo", "read"; -}; - - -grant { - - permission java.io.FilePermission "/-", "read, write"; - - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - - permission java.util.PropertyPermission "java.class.path", "read,write"; - - permission java.util.PropertyPermission "org.eclipse.jetty.policy.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.stderr.SOURCE", "read"; - - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.DEBUG", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.SOURCE", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.class", "read"; - permission java.util.PropertyPermission "org.eclipse.jetty.util.log.IGNORED", "read"; - - permission java.util.PropertyPermission "basedir", "read"; -}; \ No newline at end of file diff --git a/jetty-policy/src/test/resources/runtime-test-5/jetty-bad-certificate.policy b/jetty-policy/src/test/resources/runtime-test-5/jetty-bad-certificate.policy deleted file mode 100644 index 1b3310babe3..00000000000 --- a/jetty-policy/src/test/resources/runtime-test-5/jetty-bad-certificate.policy +++ /dev/null @@ -1,25 +0,0 @@ - -keystore "${basedir}target/test-policy/jetty-policy-nobody.keystore", "jks"; - -grant signedBy "jetty-policy-bad", codeBase "${basedir}target/test-policy/jetty-test-policy.jar" -{ - permission java.util.PropertyPermission "foo", "read"; -} - - -grant { - - permission java.io.FilePermission "/-", "read, write"; - - permission java.lang.RuntimePermission "setContextClassLoader"; - permission java.lang.RuntimePermission "setSecurityManager"; - permission java.security.SecurityPermission "getPolicy"; - permission java.lang.RuntimePermission "createClassLoader"; - permission java.lang.RuntimePermission "setIO"; - - permission java.util.PropertyPermission "java.class.path", "read,write"; - - permission java.util.PropertyPermission "basedir", "read"; - - -} \ No newline at end of file From 376303d02c4645df1b3fe03874090f7dbd0123d0 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 17 Oct 2012 17:43:54 -0500 Subject: [PATCH 4/4] remove jetty templates to admin project --- eclipse-jetty-templates.xml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 eclipse-jetty-templates.xml diff --git a/eclipse-jetty-templates.xml b/eclipse-jetty-templates.xml deleted file mode 100644 index 1d077d09a6d..00000000000 --- a/eclipse-jetty-templates.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - -