Kaynağa Gözat

Merge remote-tracking branch 'origin/master' into ng-helpdesk

# Conflicts:
#	server/src/main/webapp/WEB-INF/jsp/helpdesk-detail.jsp
jalbr74 7 yıl önce
ebeveyn
işleme
4ee89489f5
100 değiştirilmiş dosya ile 915 ekleme ve 341 silme
  1. 1 1
      client/images/icons/m_circle-horz-menu_thin.svg
  2. 1 1
      client/images/icons/m_close_thick.svg
  3. 1 1
      client/images/icons/m_configure_thin.svg
  4. 1 1
      client/images/icons/m_down_thick.svg
  5. 1 1
      client/images/icons/m_orgchart_thin.svg
  6. 1 1
      client/images/icons/m_search_thick.svg
  7. 1 1
      client/images/icons/m_up_thick.svg
  8. 1 1
      client/images/icons/m_view-list_thin.svg
  9. 1 1
      client/images/icons/m_view-tile_thin.svg
  10. 1 1
      client/index.html
  11. 1 1
      client/karma.conf.js
  12. 1 1
      client/src/component.ts
  13. 1 1
      client/src/main.dev.ts
  14. 1 1
      client/src/main.ts
  15. 1 1
      client/src/models/column.model.ts
  16. 1 1
      client/src/models/orgchart-data.model.ts
  17. 1 1
      client/src/models/person.model.ts
  18. 1 1
      client/src/models/search-result.model.ts
  19. 1 1
      client/src/pages/changepassword/changepassword.controller.ts
  20. 1 1
      client/src/pages/changepassword/changepassword.module.ts
  21. 1 1
      client/src/pages/configeditor/configeditor.controller.ts
  22. 1 1
      client/src/pages/configeditor/configeditor.module.ts
  23. 1 1
      client/src/peoplesearch/orgchart-search.component.html
  24. 1 1
      client/src/peoplesearch/orgchart-search.component.scss
  25. 1 1
      client/src/peoplesearch/orgchart-search.component.ts
  26. 1 1
      client/src/peoplesearch/orgchart.component.html
  27. 1 1
      client/src/peoplesearch/orgchart.component.scss
  28. 1 1
      client/src/peoplesearch/orgchart.component.test.ts
  29. 1 1
      client/src/peoplesearch/orgchart.component.ts
  30. 1 1
      client/src/peoplesearch/peoplesearch-base.component.ts
  31. 1 1
      client/src/peoplesearch/peoplesearch-cards.component.html
  32. 1 1
      client/src/peoplesearch/peoplesearch-cards.component.scss
  33. 1 1
      client/src/peoplesearch/peoplesearch-cards.component.ts
  34. 1 1
      client/src/peoplesearch/peoplesearch-table.component.html
  35. 1 1
      client/src/peoplesearch/peoplesearch-table.component.scss
  36. 1 1
      client/src/peoplesearch/peoplesearch-table.component.ts
  37. 1 1
      client/src/peoplesearch/peoplesearch.module.ts
  38. 1 1
      client/src/peoplesearch/peoplesearch.scss
  39. 1 1
      client/src/peoplesearch/person-card.component.html
  40. 1 1
      client/src/peoplesearch/person-card.component.scss
  41. 1 1
      client/src/peoplesearch/person-card.component.ts
  42. 1 1
      client/src/peoplesearch/person-details-dialog.component.html
  43. 1 1
      client/src/peoplesearch/person-details-dialog.component.scss
  44. 1 1
      client/src/peoplesearch/person-details-dialog.component.ts
  45. 1 1
      client/src/peoplesearch/person.filters.ts
  46. 1 1
      client/src/peoplesearch/string.filters.ts
  47. 1 1
      client/src/route-error-handler.ts
  48. 1 1
      client/src/routes.ts
  49. 1 1
      client/src/services/base-config.service.ts
  50. 1 1
      client/src/services/local-storage.service.ts
  51. 1 1
      client/src/services/people.service.dev.ts
  52. 1 1
      client/src/services/people.service.ts
  53. 1 1
      client/src/services/peoplesearch-config.service.dev.ts
  54. 1 1
      client/src/services/pwm.service.dev.ts
  55. 1 1
      client/src/services/pwm.service.ts
  56. 1 1
      client/src/services/translations-loader.factory.ts
  57. 1 1
      client/src/ux/app-bar.component.scss
  58. 1 1
      client/src/ux/app-bar.component.ts
  59. 1 1
      client/src/ux/auto-complete.component.scss
  60. 1 1
      client/src/ux/auto-complete.component.ts
  61. 1 1
      client/src/ux/button.component.scss
  62. 1 1
      client/src/ux/button.component.ts
  63. 1 1
      client/src/ux/dialog.component.html
  64. 1 1
      client/src/ux/dialog.component.scss
  65. 1 1
      client/src/ux/dialog.component.ts
  66. 1 1
      client/src/ux/dialog.service.ts
  67. 1 1
      client/src/ux/element-size.service.ts
  68. 1 1
      client/src/ux/icon-button.component.scss
  69. 1 1
      client/src/ux/icon-button.component.ts
  70. 1 1
      client/src/ux/icon.component.scss
  71. 1 1
      client/src/ux/icon.component.ts
  72. 1 1
      client/src/ux/search-bar.component.html
  73. 1 1
      client/src/ux/search-bar.component.scss
  74. 1 1
      client/src/ux/search-bar.component.ts
  75. 1 1
      client/src/ux/table-column.directive.ts
  76. 1 1
      client/src/ux/table.directive.controller.ts
  77. 1 1
      client/src/ux/table.directive.html
  78. 1 1
      client/src/ux/table.directive.scss
  79. 1 1
      client/src/ux/table.directive.ts
  80. 1 1
      client/src/ux/ux.module.ts
  81. 1 1
      client/vendor/angular-ui-router.js
  82. 1 1
      client/webpack.build.js
  83. 1 1
      client/webpack.common.js
  84. 1 1
      client/webpack.dev.js
  85. 1 1
      client/webpack.test.js
  86. 18 0
      onejar/.gitignore
  87. 2 2
      onejar/onejar-assembly.xml
  88. 4 10
      onejar/pom.xml
  89. 103 0
      onejar/src/main/java/password/pwm/Argument.java
  90. 314 0
      onejar/src/main/java/password/pwm/ArgumentParser.java
  91. 31 0
      onejar/src/main/java/password/pwm/ArgumentParserException.java
  92. 46 0
      onejar/src/main/java/password/pwm/Resource.java
  93. 46 1
      onejar/src/main/java/password/pwm/TomcatConfig.java
  94. 31 0
      onejar/src/main/java/password/pwm/TomcatOneJarException.java
  95. 199 238
      onejar/src/main/java/password/pwm/TomcatOneJarMain.java
  96. 27 0
      onejar/src/main/resources/password/pwm/Resource.properties
  97. 6 2
      server/pom.xml
  98. 1 1
      server/src/build/assembly/ldif-schema-zip.xml
  99. 1 1
      server/src/build/assembly/release-bundle.xml
  100. 1 1
      server/src/build/assembly/source-reference.xml

+ 1 - 1
client/images/icons/m_circle-horz-menu_thin.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_close_thick.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_configure_thin.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_down_thick.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_orgchart_thin.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_search_thick.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_up_thick.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_view-list_thin.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/images/icons/m_view-tile_thin.svg

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/index.html

@@ -4,7 +4,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/karma.conf.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/main.dev.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/main.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/models/column.model.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/models/orgchart-data.model.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/models/person.model.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/models/search-result.model.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/pages/changepassword/changepassword.controller.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/pages/changepassword/changepassword.module.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/pages/configeditor/configeditor.controller.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/pages/configeditor/configeditor.module.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart-search.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart-search.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart-search.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart.component.test.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/orgchart.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-base.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-cards.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-cards.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-cards.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-table.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-table.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch-table.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch.module.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/peoplesearch.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-card.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-card.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-card.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-details-dialog.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-details-dialog.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person-details-dialog.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/person.filters.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/peoplesearch/string.filters.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/route-error-handler.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/routes.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/base-config.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/local-storage.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/people.service.dev.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/people.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/peoplesearch-config.service.dev.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/pwm.service.dev.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/pwm.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/services/translations-loader.factory.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/app-bar.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/app-bar.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/auto-complete.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/auto-complete.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/button.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/button.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/dialog.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/dialog.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/dialog.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/dialog.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/element-size.service.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/icon-button.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/icon-button.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/icon.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/icon.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/search-bar.component.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/search-bar.component.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/search-bar.component.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/table-column.directive.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/table.directive.controller.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/table.directive.html

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/table.directive.scss

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/table.directive.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/src/ux/ux.module.ts

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/vendor/angular-ui-router.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/webpack.build.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/webpack.common.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/webpack.dev.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
client/webpack.test.js

@@ -3,7 +3,7 @@
  * http://www.pwm-project.org
  *
  * Copyright (c) 2006-2009 Novell, Inc.
- * Copyright (c) 2009-2017 The PWM Project
+ * Copyright (c) 2009-2018 The PWM Project
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 18 - 0
onejar/.gitignore

@@ -0,0 +1,18 @@
+# PWM Project gitignore files
+#
+# Maven Output
+/target
+
+# Eclipse Project Files
+/.project
+/.settings
+/.classpath
+
+# IntelliJ Project Files
+.idea/
+/*.iml
+
+# OS folder info
+.directory
+.DS_Store
+.DS_Store?

+ 2 - 2
onejar/onejar-assembly.xml

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by
@@ -38,7 +38,7 @@
     </dependencySets>
     <files>
         <file>
-            <source>${project.basedir}${file.separator}..${file.separator}server${file.separator}target${file.separator}pwm-${project.version}.war</source>
+            <source>${project.basedir}${file.separator}..${file.separator}server${file.separator}target${file.separator}${warArtifactID}</source>
             <outputDirectory>/</outputDirectory>
             <destName>embed.war</destName>
         </file>

+ 4 - 10
onejar/pom.xml

@@ -19,6 +19,10 @@
         <tomcat.version>9.0.4</tomcat.version>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
+
+
+        <warArtifactID>pwm-${project.version}.war</warArtifactID>
+
     </properties>
 
     <build>
@@ -120,16 +124,6 @@
         </dependency>
 
         <!-- embedded tomcat -->
-        <dependency>
-            <groupId>org.apache.tomcat</groupId>
-            <artifactId>tomcat-catalina</artifactId>
-            <version>${tomcat.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat</groupId>
-            <artifactId>tomcat-util</artifactId>
-            <version>${tomcat.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.tomcat.embed</groupId>
             <artifactId>tomcat-embed-core</artifactId>

+ 103 - 0
onejar/src/main/java/password/pwm/Argument.java

@@ -0,0 +1,103 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+package password.pwm;
+
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+enum Argument
+{
+    applicationPath,
+    workPath,
+    version,
+    help,
+    war,
+    port,
+    context,
+    properties,
+    localAddress,;
+
+    static Options asOptions( )
+    {
+        final Options options = new Options();
+        asOptionMap().values().forEach( options::addOption );
+        return options;
+    }
+
+    static Map<Argument, Option> asOptionMap( )
+    {
+        final Map<Argument, Option> optionMap = new TreeMap<>();
+
+        optionMap.put( Argument.applicationPath, Option.builder( Argument.applicationPath.name() )
+                .desc( "application path (required)" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.workPath, Option.builder( Argument.workPath.name() )
+                .desc( "temporary work path" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.version, Option.builder( Argument.version.name() )
+                .desc( "show version" )
+                .numberOfArgs( 0 )
+                .build() );
+
+        optionMap.put( Argument.port, Option.builder( Argument.port.name() )
+                .desc( "web server port (default " + Resource.defaultPort.getValue() + ")" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.localAddress, Option.builder( Argument.localAddress.name() )
+                .desc( "local network address (default localhost)" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.context, Option.builder( Argument.context.name() )
+                .desc( "context (url path) name (default " + Resource.defaultContext.getValue() + ")" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.help, Option.builder( Argument.help.name() )
+                .desc( "show this help" )
+                .numberOfArgs( 0 )
+                .build() );
+
+        optionMap.put( Argument.properties, Option.builder( Argument.properties.name() )
+                .desc( "read arguments from properties file" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        optionMap.put( Argument.war, Option.builder( Argument.war.name() )
+                .desc( "source war file (default embedded)" )
+                .numberOfArgs( 1 )
+                .build() );
+
+        return Collections.unmodifiableMap( optionMap );
+    }
+
+}

+ 314 - 0
onejar/src/main/java/password/pwm/ArgumentParser.java

@@ -0,0 +1,314 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+package password.pwm;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.ParseException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.security.SecureRandom;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+public class ArgumentParser
+{
+    private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+    public TomcatConfig parseArguments( final String[] args )
+            throws ArgumentParserException, TomcatOneJarException
+    {
+        if ( args == null || args.length == 0 )
+        {
+            ArgumentParser.outputHelp();
+        }
+        else
+        {
+            final CommandLine commandLine;
+
+            try
+            {
+                commandLine = new DefaultParser().parse( Argument.asOptions(), args );
+            }
+            catch ( ParseException e )
+            {
+                throw new ArgumentParserException( "unable to parse command line: " + e.getMessage() );
+            }
+
+            if ( commandLine.hasOption( Argument.version.name() ) )
+            {
+                TomcatOneJarMain.out( TomcatOneJarMain.getVersion() );
+                return null;
+            }
+            else if ( commandLine.hasOption( Argument.help.name() ) )
+            {
+                ArgumentParser.outputHelp();
+                return null;
+            }
+            else
+            {
+                final Map<Argument, String> argumentMap;
+                if ( commandLine.hasOption( Argument.properties.name() ) )
+                {
+                    if ( args.length > 2 )
+                    {
+                        throw new ArgumentParserException( Argument.properties.name() + " must be the only argument specified" );
+                    }
+                    final String filename = commandLine.getOptionValue( Argument.properties.name() );
+                    argumentMap = mapFromProperties( filename );
+                }
+                else
+                {
+                    argumentMap = mapFromCommandLine( commandLine );
+                }
+                final TomcatConfig tomcatConfig;
+                try
+                {
+                    tomcatConfig = makeTomcatConfig( argumentMap );
+                }
+                catch ( IOException e )
+                {
+                    throw new ArgumentParserException( "error while reading input: " + e.getMessage() );
+                }
+                return tomcatConfig;
+            }
+        }
+
+        return null;
+    }
+
+    private Map<Argument, String> mapFromProperties( final String filename ) throws ArgumentParserException
+    {
+        final Properties props = new Properties();
+        try
+        {
+            props.load( new FileInputStream( new File( filename ) ) );
+        }
+        catch ( IOException e )
+        {
+            throw new ArgumentParserException( "unable to read properties input file: " + e.getMessage() );
+        }
+
+        final Map<Argument, String> map = new HashMap<>();
+        for ( final Option option : Argument.asOptionMap().values() )
+        {
+            if ( option.hasArg() )
+            {
+                final Argument argument = Argument.valueOf( option.getOpt() );
+                final String value = props.getProperty( argument.name() );
+                if ( value != null )
+                {
+                    map.put( argument, value );
+                }
+            }
+        }
+        return Collections.unmodifiableMap( map );
+    }
+
+    private Map<Argument, String> mapFromCommandLine( final CommandLine commandLine )
+    {
+        final Map<Argument, String> map = new HashMap<>();
+        for ( final Option option : Argument.asOptionMap().values() )
+        {
+            if ( option.hasArg() )
+            {
+                if ( commandLine.hasOption( option.getOpt() ) )
+                {
+                    final Argument argument = Argument.valueOf( option.getOpt() );
+                    final String value = commandLine.getOptionValue( option.getOpt() );
+                    map.put( argument, value );
+                }
+            }
+        }
+        return Collections.unmodifiableMap( map );
+    }
+
+
+    private TomcatConfig makeTomcatConfig( final Map<Argument, String> argumentMap ) throws IOException, ArgumentParserException
+    {
+        final TomcatConfig tomcatConfig = new TomcatConfig();
+        tomcatConfig.setKeystorePass( genRandomString( 32 ) );
+        tomcatConfig.setApplicationPath( parseFileOption( argumentMap, Argument.applicationPath ) );
+
+        tomcatConfig.setContext( argumentMap.getOrDefault( Argument.context, Resource.defaultContext.getValue() ) );
+
+        if ( argumentMap.containsKey( Argument.war ) )
+        {
+            final File inputWarFile = new File( argumentMap.get( Argument.war ) );
+            if ( !inputWarFile.exists() )
+            {
+                System.out.println( "output war file " + inputWarFile.getAbsolutePath() + "does not exist" );
+                System.exit( -1 );
+                return null;
+            }
+            tomcatConfig.setWar( new FileInputStream( inputWarFile ) );
+        }
+        else
+        {
+            tomcatConfig.setWar( getEmbeddedWar() );
+        }
+
+        tomcatConfig.setPort( Integer.parseInt( Resource.defaultPort.getValue() ) );
+        if ( argumentMap.containsKey( Argument.port ) )
+        {
+            try
+            {
+                tomcatConfig.setPort( Integer.parseInt( argumentMap.get( Argument.port ) ) );
+            }
+            catch ( NumberFormatException e )
+            {
+                System.out.println( Argument.port.name() + " argument must be numeric" );
+                System.exit( -1 );
+            }
+        }
+
+        tomcatConfig.setLocalAddress( argumentMap.getOrDefault( Argument.localAddress, Resource.defaultLocalAddress.getValue() ) );
+
+        try
+        {
+            final ServerSocket socket = new ServerSocket( tomcatConfig.getPort(), 100, InetAddress.getByName( tomcatConfig.getLocalAddress() ) );
+            socket.close();
+        }
+        catch ( Exception e )
+        {
+            throw new ArgumentParserException( "port or address conflict: " + e.getMessage() );
+        }
+
+        if ( argumentMap.containsKey( Argument.workPath ) )
+        {
+            tomcatConfig.setWorkingPath( parseFileOption( argumentMap, Argument.workPath ) );
+        }
+        else
+        {
+            tomcatConfig.setWorkingPath( figureDefaultWorkPath( tomcatConfig ) );
+        }
+
+        return tomcatConfig;
+    }
+
+
+    private static void outputHelp( ) throws TomcatOneJarException
+    {
+        final HelpFormatter formatter = new HelpFormatter();
+        System.out.println( TomcatOneJarMain.getVersion() );
+        System.out.println( "usage:" );
+        formatter.printOptions(
+                System.console().writer(),
+                HelpFormatter.DEFAULT_WIDTH,
+                Argument.asOptions(),
+                3,
+                8 );
+    }
+
+
+    private static File parseFileOption( final Map<Argument, String> argumentMap, final Argument argName ) throws ArgumentParserException
+    {
+        if ( !argumentMap.containsKey( argName ) )
+        {
+            throw new ArgumentParserException( "option " + argName + " required" );
+        }
+        final File file = new File( argumentMap.get( argName ) );
+        if ( !file.isAbsolute() )
+        {
+            throw new ArgumentParserException( "a fully qualified file path name is required for " + argName );
+        }
+        if ( !file.exists() )
+        {
+            throw new ArgumentParserException( "path specified by " + argName + " must exist" );
+        }
+        return file;
+    }
+
+    private static File figureDefaultWorkPath( final TomcatConfig tomcatConfig ) throws ArgumentParserException
+    {
+        final String userHomePath = System.getProperty( "user.home" );
+        if ( userHomePath != null && !userHomePath.isEmpty() )
+        {
+            final File basePath = new File( userHomePath + File.separator
+                    + Resource.defaultWorkPathName.getValue() );
+            basePath.mkdir();
+
+            final String workPath;
+            {
+                String workPathStr = basePath.getPath() + File.separator + "work"
+                        + "-"
+                        + escapeFilename( tomcatConfig.getContext() )
+                        + "-"
+                        + escapeFilename( Integer.toString( tomcatConfig.getPort() ) );
+
+                if ( tomcatConfig.getLocalAddress() != null && !tomcatConfig.getLocalAddress().isEmpty() )
+                {
+                    workPathStr += "-" + escapeFilename( tomcatConfig.getLocalAddress() );
+
+                }
+                workPath = workPathStr;
+            }
+            final File workFile = new File( workPath );
+            workFile.mkdirs();
+            TomcatOneJarMain.out( "using work directory: " + workPath );
+            return workFile;
+        }
+
+        throw new ArgumentParserException( "cant locate user home directory" );
+    }
+
+    private static InputStream getEmbeddedWar( ) throws IOException, ArgumentParserException
+    {
+        final Class clazz = TomcatOneJarMain.class;
+        final String className = clazz.getSimpleName() + ".class";
+        final String classPath = clazz.getResource( className ).toString();
+        if ( !classPath.startsWith( "jar" ) )
+        {
+            throw new ArgumentParserException( "not running from war, war option must be specified" );
+        }
+        final String warPath = classPath.substring( 0, classPath.lastIndexOf( "!" ) + 1 )
+                + "/" + Resource.defaultWarFileName.getValue();
+        return new URL( warPath ).openStream();
+    }
+
+    private static String escapeFilename( final String input )
+    {
+        return input.replaceAll( "\\W+", "_" );
+    }
+
+    private static String genRandomString( final int length )
+    {
+        final SecureRandom secureRandom = new SecureRandom();
+        final StringBuilder stringBuilder = new StringBuilder();
+        while ( stringBuilder.length() < length )
+        {
+            stringBuilder.append( ALPHABET.charAt( secureRandom.nextInt( ALPHABET.length() ) ) );
+        }
+        return stringBuilder.toString();
+    }
+}

+ 31 - 0
onejar/src/main/java/password/pwm/ArgumentParserException.java

@@ -0,0 +1,31 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+package password.pwm;
+
+public class ArgumentParserException extends Exception
+{
+    public ArgumentParserException( final String msg )
+    {
+        super( msg );
+    }
+}

+ 46 - 0
onejar/src/main/java/password/pwm/Resource.java

@@ -0,0 +1,46 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+package password.pwm;
+
+import java.util.ResourceBundle;
+
+enum Resource
+{
+    defaultContext,
+    defaultWorkPathName,
+    defaultPort,
+    defaultLocalAddress,
+    defaultWarFileName,;
+
+    String getValue()
+    {
+        return readResource( this );
+    }
+
+    private static String readResource( final Resource resource )
+    {
+        final ResourceBundle bundle = ResourceBundle.getBundle( Resource.class.getName() );
+        return bundle.getString( resource.name() );
+    }
+
+}

+ 46 - 1
onejar/src/main/java/password/pwm/TomcatConfig.java

@@ -1,14 +1,39 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 package password.pwm;
 
 import java.io.File;
 import java.io.InputStream;
 
-class TomcatConfig {
+class TomcatConfig
+{
     private int port;
     private File applicationPath;
     private File workingPath;
     private InputStream war;
     private String context;
+    private String localAddress;
+    private String keystorePass;
 
     public int getPort( )
     {
@@ -59,4 +84,24 @@ class TomcatConfig {
     {
         this.context = context;
     }
+
+    public String getLocalAddress( )
+    {
+        return localAddress;
+    }
+
+    public void setLocalAddress( final String localAddress )
+    {
+        this.localAddress = localAddress;
+    }
+
+    public String getKeystorePass( )
+    {
+        return keystorePass;
+    }
+
+    public void setKeystorePass( final String keystorePass )
+    {
+        this.keystorePass = keystorePass;
+    }
 }

+ 31 - 0
onejar/src/main/java/password/pwm/TomcatOneJarException.java

@@ -0,0 +1,31 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+package password.pwm;
+
+public class TomcatOneJarException extends Exception
+{
+    public TomcatOneJarException( final String msg )
+    {
+        super( msg );
+    }
+}

+ 199 - 238
onejar/src/main/java/password/pwm/TomcatOneJarMain.java

@@ -1,150 +1,147 @@
+/*
+ * Password Management Servlets (PWM)
+ * http://www.pwm-project.org
+ *
+ * Copyright (c) 2006-2009 Novell, Inc.
+ * Copyright (c) 2009-2018 The PWM Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 package password.pwm;
 
-import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
-import org.apache.catalina.connector.CoyoteAdapter;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.util.ServerInfo;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
 
 import javax.servlet.ServletException;
 import java.io.File;
-import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.Socket;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.net.URL;
+import java.net.URLClassLoader;
 import java.nio.file.FileVisitOption;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.time.Duration;
+import java.time.Instant;
+import java.util.ArrayList;
 import java.util.Comparator;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.List;
+import java.util.Properties;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
-import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 
 public class TomcatOneJarMain
 {
-    private static final  Logger LOGGER = Logger.getLogger(TomcatOneJarMain.class.getName());
-
-    private static final String ARG_APP_PATH = "applicationPath";
-    private static final String ARG_WORK_PATH = "workPath";
-    private static final String ARG_VERSION = "version";
-    private static final String ARG_HELP = "help";
-    private static final String ARG_WARFILE = "war";
-    private static final String ARG_PORT = "port";
-    private static final String ARG_CONTEXT = "context";
-
-    private static final String DEFAULT_CONTEXT = "pwm";
-    private static final int DEFAULT_PORT = 8080;
-    private static final String DEFAULT_WORK_DIR_NAME = ".pwm-workpath";
+    //private static final String TEMP_WAR_FILE_NAME = "embed.war";
+    private static final String KEYSTORE_ALIAS = "https";
 
-    private static final String EMBED_WAR_NAME = "embed.war";
-
-    public static void main(final String[] args) throws ServletException, IOException, LifecycleException
+    public static void main( final String[] args )
     {
-        if (args == null || args.length == 0) {
-            outputHelp();
-        } else
+        final ArgumentParser argumentParser = new ArgumentParser();
+        TomcatConfig tomcatConfig = null;
+        try
         {
-            final CommandLine commandLine = parseOptions( args );
-            if ( commandLine.hasOption( ARG_VERSION ) ) {
-                System.out.println( getVersion() );
-            } else if ( commandLine.hasOption( ARG_HELP ) ) {
-                outputHelp();
-            } else {
-                final TomcatConfig tomcatConfig = makeTomcatConfig( commandLine );
-                startTomcat(tomcatConfig);
+            tomcatConfig = argumentParser.parseArguments( args );
+        }
+        catch ( ArgumentParserException | TomcatOneJarException e )
+        {
+            out( "error parsing command line: " + e.getMessage() );
+        }
+        if ( tomcatConfig != null )
+        {
+            try
+            {
+                startTomcat( tomcatConfig );
+            }
+            catch ( TomcatOneJarException | ServletException | IOException e )
+            {
+                out( "error starting tomcat: " + e.getMessage() );
             }
         }
     }
 
-    private static TomcatConfig makeTomcatConfig(final CommandLine commandLine) throws IOException
+    private static File getWarFolder( final TomcatConfig tomcatConfig ) throws IOException
     {
-        final TomcatConfig tomcatConfig = new TomcatConfig();
-        tomcatConfig.setApplicationPath( parseFileOption( commandLine, ARG_APP_PATH ) );
+        return new File( tomcatConfig.getWorkingPath().getAbsoluteFile() + File.separator + "war" );
+    }
 
-        if (commandLine.hasOption( ARG_CONTEXT )) {
-            tomcatConfig.setContext( commandLine.getOptionValue( ARG_CONTEXT ) );
-        } else {
-            tomcatConfig.setContext( DEFAULT_CONTEXT );
-        }
+    private static File getKeystoreFile( final TomcatConfig tomcatConfig )
+    {
+        return new File( tomcatConfig.getWorkingPath().getAbsoluteFile() + File.separator + "keystore" );
+    }
 
-        if (commandLine.hasOption( ARG_WARFILE )) {
-            final File inputWarFile = new File (commandLine.getOptionValue( ARG_WARFILE ));
-            if (!inputWarFile.exists()) {
-                System.out.println( "output war file " + inputWarFile.getAbsolutePath() + "does not exist" );
-                System.exit( -1 );
-                return null;
-            }
-            tomcatConfig.setWar( new FileInputStream( inputWarFile ) );
-        } else {
-            tomcatConfig.setWar( getEmbeddedWar() );
-        }
+    private static File getPwmAppPropertiesFile( final TomcatConfig tomcatConfig )
+    {
+        return new File( tomcatConfig.getWorkingPath().getAbsoluteFile() + File.separator + "application.properties" );
+    }
 
-        tomcatConfig.setPort( DEFAULT_PORT );
-        if (commandLine.hasOption( ARG_PORT )) {
-            try {
-                tomcatConfig.setPort( Integer.parseInt( commandLine.getOptionValue( ARG_PORT ) ) );
-            } catch (NumberFormatException e) {
-                System.out.println( ARG_PORT + " argument must be numeric" );
-                System.exit( -1 );
-            }
-        }
 
-        if ( checkIfPortInUse( tomcatConfig.getPort())) {
-            System.out.println( "port " + tomcatConfig.getPort() +  " is in use" );
-            System.exit( -1 );
-        }
+    private static void explodeWar( final TomcatConfig tomcatConfig ) throws IOException
+    {
+        final InputStream warSource = tomcatConfig.getWar();
+        final ZipInputStream zipInputStream = new ZipInputStream( warSource );
+        final File outputFolder = getWarFolder( tomcatConfig );
+        outputFolder.mkdir();
 
-        if (commandLine.hasOption( ARG_WORK_PATH )) {
-            tomcatConfig.setWorkingPath( parseFileOption( commandLine, ARG_WORK_PATH ) );
-        } else {
-            tomcatConfig.setWorkingPath( figureDefaultWorkPath(tomcatConfig) );
-        }
+        ZipEntry zipEntry = zipInputStream.getNextEntry();
 
-        return tomcatConfig;
-    }
+        while ( zipEntry != null )
+        {
+            final String fileName = zipEntry.getName();
+            final File newFile = new File( outputFolder + File.separator + fileName );
 
-    private static File parseFileOption(final  CommandLine commandLine, final String argName) {
-        if (!commandLine.hasOption( argName )) {
-            outAndExit(  "option " + argName + " required");
-        }
-        final File file = new File(commandLine.getOptionValue( argName ));
-        if (!file.isAbsolute()) {
-            outAndExit( "a fully qualified file path name is required for " + argName);
-        }
-        if (!file.exists()) {
-            outAndExit( "path specified by " + argName + " must exist");
+            if ( !zipEntry.isDirectory() )
+            {
+                newFile.getParentFile().mkdirs();
+                Files.copy( zipInputStream, newFile.toPath() );
+            }
+            zipEntry = zipInputStream.getNextEntry();
         }
-        return file;
-    }
 
-    private static void outputHelp() throws IOException
-    {
-        final HelpFormatter formatter = new HelpFormatter();
-        System.out.println( getVersion() );
-        System.out.println( "usage:" );
-        formatter.printOptions( System.console().writer(), HelpFormatter.DEFAULT_WIDTH, makeOptions(),3 , 8);
     }
 
-    private static void startTomcat( final TomcatConfig tomcatConfig) throws ServletException, IOException
+    private static void startTomcat( final TomcatConfig tomcatConfig ) throws ServletException, IOException, TomcatOneJarException
     {
+        final Instant startTime = Instant.now();
+
         purgeDirectory( tomcatConfig.getWorkingPath().toPath() );
+
+        explodeWar( tomcatConfig );
+        out( "deployed war" );
+
+        try
         {
-            final Path outputPath = tomcatConfig.getWorkingPath().toPath().resolve( EMBED_WAR_NAME );
-            final InputStream warSource = tomcatConfig.getWar();
-            Files.copy(warSource, outputPath);
+            generatePwmKeystore( tomcatConfig );
+            out( "keystore generated" );
         }
-        System.setProperty( "PWM_APPLICATIONPATH", tomcatConfig.getApplicationPath().getAbsolutePath() );
+        catch ( Exception e )
+        {
+            throw new TomcatOneJarException( "error generating keystore: " + e.getMessage() );
+        }
+
+        outputPwmAppProperties( tomcatConfig );
+
+        setupEnv( tomcatConfig );
 
         final Tomcat tomcat = new Tomcat();
 
@@ -165,171 +162,135 @@ public class TomcatOneJarMain
             tomcat.getHost().setAppBase( workPath.getAbsolutePath() );
         }
 
-        tomcat.setConnector( makeConnector( tomcatConfig ) );
 
-        tomcat.setPort( DEFAULT_PORT );
-        tomcat.getConnector();
+        tomcat.getHost().setAutoDeploy( false );
+        tomcat.getHost().setDeployOnStartup( false );
 
-        tomcat.getHost().setAutoDeploy(false);
-        tomcat.getHost().setDeployOnStartup(false);
+        final String warPath = getWarFolder( tomcatConfig ).getAbsolutePath();
+        tomcat.addWebapp( "/" + tomcatConfig.getContext(), warPath );
 
-        final String warPath = tomcatConfig.getWorkingPath().getAbsolutePath() + File.separator + EMBED_WAR_NAME;
-        final Context pwmContext = tomcat.addWebapp( "/" + tomcatConfig.getContext(), warPath );
-        LOGGER.info("Deployed " + pwmContext.getBaseName() + " as " + pwmContext.getBaseName());
-
-        try {
+        try
+        {
             tomcat.start();
-        } catch (LifecycleException e) {
-            outAndExit( "unable to start tomcat: " + e.getMessage() );
+
+            tomcat.setConnector( makeConnector( tomcatConfig ) );
+
+            out( "tomcat started in " + Duration.between( Instant.now(), startTime ).toString() );
+        }
+        catch ( LifecycleException e )
+        {
+            throw new TomcatOneJarException( "unable to start tomcat: " + e.getMessage() );
         }
-        LOGGER.info("tomcat started on " + tomcat.getHost());
 
         tomcat.getServer().await();
-    }
 
-    private static Connector makeConnector(final TomcatConfig tomcatConfig) {
-        final Connector connector = new Connector("HTTP/1.1");
-        connector.setPort(tomcatConfig.getPort());
-        return connector;
+        System.out.println( "\n" );
     }
 
-    private static CommandLine parseOptions(final String[] args) {
-        final CommandLineParser parser = new DefaultParser();
-        try {
-            return parser.parse( makeOptions(), args);
-        } catch ( ParseException e ) {
-            outAndExit(  "error parsing commandline: " + e.getMessage() );
+    private static Connector makeConnector( final TomcatConfig tomcatConfig )
+    {
+        final Connector connector = new Connector( "HTTP/1.1" );
+        connector.setPort( tomcatConfig.getPort() );
+
+        if ( tomcatConfig.getLocalAddress() != null && !tomcatConfig.getLocalAddress().isEmpty() )
+        {
+            connector.setProperty( "address", tomcatConfig.getLocalAddress() );
         }
-        return null;
-    }
+        connector.setSecure( true );
+        connector.setScheme( "https" );
+        connector.setAttribute( "SSLEnabled", "true" );
+        connector.setAttribute( "keystoreFile", getKeystoreFile( tomcatConfig ).getAbsolutePath() );
+        connector.setAttribute( "keystorePass", tomcatConfig.getKeystorePass() );
+        connector.setAttribute( "keyAlias", KEYSTORE_ALIAS );
+        connector.setAttribute( "clientAuth", "false" );
 
-    private static Options makeOptions() {
-        final Map<String,Option> optionMap = new TreeMap<>(  );
-
-        optionMap.put(ARG_APP_PATH,Option.builder(ARG_APP_PATH)
-                .desc( "application path (required)" )
-                .numberOfArgs( 1 )
-                .required(false)
-                .build());
-
-        optionMap.put(ARG_WORK_PATH,Option.builder(ARG_WORK_PATH)
-                .desc( "temporary work path" )
-                .numberOfArgs( 1 )
-                .required(false)
-                .build());
-
-        optionMap.put(ARG_VERSION,Option.builder(ARG_VERSION)
-                .desc( "show version" )
-                .numberOfArgs( 0 )
-                .required(false)
-                .build());
-
-        optionMap.put(ARG_PORT,Option.builder()
-                .longOpt( ARG_PORT )
-                .desc( "web server port (default " + DEFAULT_PORT + ")" )
-                .numberOfArgs( 1 )
-                .build() );
-
-        optionMap.put(ARG_CONTEXT,Option.builder()
-                .longOpt( ARG_CONTEXT )
-                .desc( "context (url path) name (default " + DEFAULT_CONTEXT + ")" )
-                .numberOfArgs( 1 )
-                .build() );
-
-        optionMap.put(ARG_HELP,Option.builder(ARG_HELP)
-                .desc( "show this help" )
-                .numberOfArgs( 0 )
-                .required(false)
-                .build());
-
-        optionMap.put(ARG_WARFILE,Option.builder(ARG_WARFILE)
-                .desc( "source war file (default embedded)" )
-                .numberOfArgs( 1 )
-                .required(false)
-                .build());
-
-        final Options options = new Options();
-        optionMap.values().forEach( options::addOption );
-        return options;
+        return connector;
     }
 
-    private static InputStream getEmbeddedWar() throws IOException
+    static String getVersion( ) throws TomcatOneJarException
     {
-        final Class clazz = TomcatOneJarMain.class;
-        final String className = clazz.getSimpleName() + ".class";
-        final String classPath = clazz.getResource(className).toString();
-        if (!classPath.startsWith("jar")) {
-            outAndExit("not running from war, war option must be specified");
-            return null;
+        try
+        {
+            final Class clazz = TomcatOneJarMain.class;
+            final String className = clazz.getSimpleName() + ".class";
+            final String classPath = clazz.getResource( className ).toString();
+            if ( !classPath.startsWith( "jar" ) )
+            {
+                // Class not from JAR
+                return "version missing, not running inside jar";
+            }
+            final String manifestPath = classPath.substring( 0, classPath.lastIndexOf( "!" ) + 1 )
+                    + "/META-INF/MANIFEST.MF";
+            final Manifest manifest = new Manifest( new URL( manifestPath ).openStream() );
+            final Attributes attr = manifest.getMainAttributes();
+            return attr.getValue( "Implementation-Version-Display" )
+                    + "  [" + ServerInfo.getServerInfo() + "]";
         }
-        final String warPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) +
-                "/" + EMBED_WAR_NAME;
-        return new URL(warPath).openStream();
-    }
-
-    private static String getVersion() throws IOException
-    {
-        final Class clazz = TomcatOneJarMain.class;
-        final String className = clazz.getSimpleName() + ".class";
-        final String classPath = clazz.getResource(className).toString();
-        if (!classPath.startsWith("jar")) {
-            // Class not from JAR
-            return "--version missing--";
+        catch ( IOException e )
+        {
+            throw new TomcatOneJarException( "error reading internal version info: " + e.getMessage() );
         }
-        final String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) +
-                "/META-INF/MANIFEST.MF";
-        final Manifest manifest = new Manifest(new URL(manifestPath).openStream());
-        final Attributes attr = manifest.getMainAttributes();
-        return attr.getValue("Implementation-Version-Display")
-                + ", " + ServerInfo.getServerInfo();
     }
 
-    private static void purgeDirectory(final Path rootPath)
+    private static void purgeDirectory( final Path rootPath )
             throws IOException
     {
-        System.out.println("purging work directory: " + rootPath);
-        Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)
-                .sorted( Comparator.reverseOrder())
-                .map(Path::toFile)
+        System.out.println( "purging work directory: " + rootPath );
+        Files.walk( rootPath, FileVisitOption.FOLLOW_LINKS )
+                .sorted( Comparator.reverseOrder() )
+                .map( Path::toFile )
                 .filter( file -> !rootPath.toString().equals( file.getPath() ) )
-                .forEach(File::delete);
+                .forEach( File::delete );
     }
 
-    private static boolean checkIfPortInUse( final int portNumber) {
-        boolean result;
 
-        try {
-            Socket s = new Socket("localhost", portNumber);
-            s.close();
-            result = true;
-        } catch(IOException e) {
-            result = false;
-        }
-
-        return(result);
+    static void out( final String output )
+    {
+        System.out.println( output );
     }
 
-    private static File figureDefaultWorkPath(final TomcatConfig tomcatConfig) {
-        final String userHomePath = System.getProperty( "user.home" );
-        if (userHomePath != null && !userHomePath.isEmpty()) {
-            final File basePath = new File(userHomePath + File.separator
-                    + "." + DEFAULT_CONTEXT);
-            basePath.mkdir();
-            final File workPath = new File( basePath.getPath() + File.separator
-                    + "work-" + tomcatConfig.getContext() + "-" + Integer.toString( tomcatConfig.getPort() ));
-            workPath.mkdir();
-            System.out.println( "using work directory: " + workPath.getAbsolutePath() );
-            return workPath;
+
+    static void generatePwmKeystore( final TomcatConfig tomcatConfig )
+            throws IOException, ClassNotFoundException, IllegalAccessException, NoSuchMethodException, InvocationTargetException
+    {
+        final File warPath = getWarFolder( tomcatConfig );
+        final String keystoreFile = getKeystoreFile( tomcatConfig ).getAbsolutePath();
+        final File webInfPath = new File( warPath.getAbsolutePath() + File.separator + "WEB-INF" + File.separator + "lib" );
+        final File[] jarFiles = webInfPath.listFiles();
+        final List<URL> jarURLList = new ArrayList<>();
+        for ( final File jarFile : jarFiles )
+        {
+            jarURLList.add( jarFile.toURI().toURL() );
         }
+        final URLClassLoader classLoader = URLClassLoader.newInstance( jarURLList.toArray( new URL[ jarURLList.size() ] ) );
+        final Class pwmMainClass = classLoader.loadClass( "password.pwm.util.cli.MainClass" );
+        final Method mainMethod = pwmMainClass.getMethod( "main", String[].class );
+        final String[] arguments = new String[] {
+                "-applicationPath=" + tomcatConfig.getApplicationPath().getAbsolutePath(),
+                "ExportHttpsKeyStore",
+                keystoreFile,
+                KEYSTORE_ALIAS,
+                tomcatConfig.getKeystorePass(),
+        };
+
+        mainMethod.invoke( null, ( Object ) arguments );
+        classLoader.close();
+    }
 
-        System.out.println( "cant locate user home directory" );
-        System.exit( -1 );
-        return null;
+    static void setupEnv( final TomcatConfig tomcatConfig )
+    {
+        System.setProperty( "PWM_APPLICATIONPATH", tomcatConfig.getApplicationPath().getAbsolutePath() );
+        System.setProperty( "PWM_APPLICATIONFLAGS", "ManageHttps" );
+        System.setProperty( "PWM_APPLICATIONPARAMFILE", getPwmAppPropertiesFile( tomcatConfig ).getAbsolutePath() );
     }
 
-    private static Object outAndExit(final String output) {
-        System.out.println(output);
-        System.exit( -1 );
-        return null;
+    static void outputPwmAppProperties( final TomcatConfig tomcatConfig ) throws IOException
+    {
+        final Properties properties = new Properties();
+        properties.setProperty( "AutoExportHttpsKeyStoreFile", getKeystoreFile( tomcatConfig ).getAbsolutePath() );
+        properties.setProperty( "AutoExportHttpsKeyStorePassword", tomcatConfig.getKeystorePass() );
+        properties.setProperty( "AutoExportHttpsKeyStoreAlias", KEYSTORE_ALIAS );
+        final File propFile = getPwmAppPropertiesFile( tomcatConfig );
+        properties.store( new FileWriter( propFile ), "auto-generated file" );
     }
 }

+ 27 - 0
onejar/src/main/resources/password/pwm/Resource.properties

@@ -0,0 +1,27 @@
+#
+# Password Management Servlets (PWM)
+# http://www.pwm-project.org
+#
+# Copyright (c) 2006-2009 Novell, Inc.
+# Copyright (c) 2009-2018 The PWM Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+defaultContext=pwm
+defaultWorkPathName=.pwm-workpath
+defaultPort=8443
+defaultLocalAddress=
+defaultWarFileName=embed.war

+ 6 - 2
server/pom.xml

@@ -265,7 +265,7 @@
                     <dependency>
                         <groupId>com.puppycrawl.tools</groupId>
                         <artifactId>checkstyle</artifactId>
-                        <version>8.7</version>
+                        <version>8.8</version>
                     </dependency>
                 </dependencies>
                 <executions>
@@ -279,6 +279,10 @@
                             <consoleOutput>true</consoleOutput>
                             <includeTestResources>false</includeTestResources>
                             <failsOnError>true</failsOnError>
+                            <includes>**/*.java,**/*.jsp,**/*.properties,**/*.xml,**/*.css,**/*.svg</includes>
+                            <sourceDirectories>
+                                <directory>src/main</directory>
+                            </sourceDirectories>
                         </configuration>
                         <goals>
                             <goal>check</goal>
@@ -542,7 +546,7 @@
             <plugin>
                 <groupId>com.github.spotbugs</groupId>
                 <artifactId>spotbugs-maven-plugin</artifactId>
-                <version>3.1.0-RC8</version>
+                <version>3.1.1</version>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

+ 1 - 1
server/src/build/assembly/ldif-schema-zip.xml

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
server/src/build/assembly/release-bundle.xml

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

+ 1 - 1
server/src/build/assembly/source-reference.xml

@@ -3,7 +3,7 @@
   ~ http://www.pwm-project.org
   ~
   ~ Copyright (c) 2006-2009 Novell, Inc.
-  ~ Copyright (c) 2009-2017 The PWM Project
+  ~ Copyright (c) 2009-2018 The PWM Project
   ~
   ~ This program is free software; you can redistribute it and/or modify
   ~ it under the terms of the GNU General Public License as published by

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor