]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Misc changes to keep backward compatibility in API endpoints
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 4 Aug 2019 10:21:55 +0000 (12:21 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 14:55:28 +0000 (15:55 +0100)
12 files changed:
gui/baculum/examples/deb-template/baculum-api-apache.conf
gui/baculum/examples/deb-template/baculum-api-lighttpd.conf
gui/baculum/examples/deb/baculum-api-apache.conf
gui/baculum/examples/deb/baculum-api-lighttpd.conf
gui/baculum/examples/rpm-template/baculum-api-apache.conf
gui/baculum/examples/rpm-template/baculum-api-lighttpd.conf
gui/baculum/examples/rpm/baculum-api-apache.conf
gui/baculum/examples/rpm/baculum-api-lighttpd.conf
gui/baculum/protected/API/Pages/API/Authorize.php [new file with mode: 0644]
gui/baculum/protected/API/Pages/API/RequestToken.php [new file with mode: 0644]
gui/baculum/protected/API/Pages/API/config.xml
gui/baculum/protected/API/Pages/API/endpoints.xml

index 17b96939f1868906a167bedd3c76e5e0b2fe08b7..abb644c419e3543645c858d599e3fb896a3d28cd 100644 (file)
@@ -17,7 +17,8 @@ Listen 9096
                RewriteEngine On
 
                RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
-               RewriteCond %{REQUEST_URI} ^/$
+               RewriteCond %{REQUEST_URI} ^/$ [OR]
+               RewriteCond %{REQUEST_URI} ^/api/page
                RewriteRule ^(.+)$ /panel? [L]
 
                RewriteCond %{REQUEST_FILENAME} !-d
index 9887a634d208d10364ffa4d8d0f17ad8ce6a80b5..a74ddd8317ad5d705fed661e81311f4bc2b00a3b 100644 (file)
@@ -86,6 +86,7 @@ url.rewrite-once = (
        "^/themes/(.+)$" => "/themes/$1",
        "^/assets/(.+)$" => "/assets/$1",
        "^/((index\.php)?\?.+)?$" => "/index.php/panel/",
+       "^/api/page" => "/index.php/panel/",
        "^/(.+)$" => "/index.php/$1"
 )
 
index 8b14fd3458de0b60cf96d334011b29893232ee54..5c4e67699eca9551782776ea8bcb158049a4cd71 100644 (file)
@@ -17,7 +17,8 @@ Listen 9096
                RewriteEngine On
 
                RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
-               RewriteCond %{REQUEST_URI} ^/$
+               RewriteCond %{REQUEST_URI} ^/$ [OR]
+               RewriteCond %{REQUEST_URI} ^/api/page
                RewriteRule ^(.+)$ /panel? [L]
 
                RewriteCond %{REQUEST_FILENAME} !-d
index 422b42dd6fea1bbbcf1f0b3104340ff4f3314019..cb6ae7b99aa49608eac1894930cd5b7bca754238 100644 (file)
@@ -86,6 +86,7 @@ url.rewrite-once = (
        "^/themes/(.+)$" => "/themes/$1",
        "^/assets/(.+)$" => "/assets/$1",
        "^/((index\.php)?\?.+)?$" => "/index.php/panel/",
+       "^/api/page" => "/index.php/panel/",
        "^/(.+)$" => "/index.php/$1"
 )
 
index 17b96939f1868906a167bedd3c76e5e0b2fe08b7..abb644c419e3543645c858d599e3fb896a3d28cd 100644 (file)
@@ -17,7 +17,8 @@ Listen 9096
                RewriteEngine On
 
                RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
-               RewriteCond %{REQUEST_URI} ^/$
+               RewriteCond %{REQUEST_URI} ^/$ [OR]
+               RewriteCond %{REQUEST_URI} ^/api/page
                RewriteRule ^(.+)$ /panel? [L]
 
                RewriteCond %{REQUEST_FILENAME} !-d
index bbc7c481b8bfb4e6010b4a6d0bf1c9948da3cf48..d9df476e4b27b1c8cdf1c6f6d310460e7e423e88 100644 (file)
@@ -86,6 +86,7 @@ url.rewrite-once = (
        "^/themes/(.+)$" => "/themes/$1",
        "^/assets/(.+)$" => "/assets/$1",
        "^/((index\.php)?\?.+)?$" => "/index.php/panel/",
+       "^/api/page" => "/index.php/panel/",
        "^/(.+)$" => "/index.php/$1"
 )
 
index 65e3fb81b4f7ccc73161b1a836d8b653162c0f21..a711022e0dd4b61be9fb51a01ce87479aa63e2cb 100644 (file)
@@ -17,7 +17,8 @@ Listen 9096
                RewriteEngine On
 
                RewriteCond %{REQUEST_URI} ^/index\.php$ [OR]
-               RewriteCond %{REQUEST_URI} ^/$
+               RewriteCond %{REQUEST_URI} ^/$ [OR]
+               RewriteCond %{REQUEST_URI} ^/api/page
                RewriteRule ^(.+)$ /panel? [L]
 
                RewriteCond %{REQUEST_FILENAME} !-d
index 4c0a56f853bbe22d5a1b1a9b50ba8527cd7767e9..14c6cf2717fb0c42e0afcd28d7f5f080832653ed 100644 (file)
@@ -86,6 +86,7 @@ url.rewrite-once = (
        "^/themes/(.+)$" => "/themes/$1",
        "^/assets/(.+)$" => "/assets/$1",
        "^/((index\.php)?\?.+)?$" => "/index.php/panel/",
+       "^/api/page" => "/index.php/panel/",
        "^/(.+)$" => "/index.php/$1"
 )
 
diff --git a/gui/baculum/protected/API/Pages/API/Authorize.php b/gui/baculum/protected/API/Pages/API/Authorize.php
new file mode 100644 (file)
index 0000000..cecdcf1
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('Application.API.Pages.OAuth2.Authorize');
+?>
diff --git a/gui/baculum/protected/API/Pages/API/RequestToken.php b/gui/baculum/protected/API/Pages/API/RequestToken.php
new file mode 100644 (file)
index 0000000..b4a56fc
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 Kern Sibbald
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+Prado::using('Application.API.Pages.OAuth2.RequestToken');
+?>
index 25baaf7e803413a3a2423ddad2034aa364e6ee99..e379d70d9ae8d63079fddc78ddcd6f731b760f37 100644 (file)
@@ -3,8 +3,13 @@
                <using namespace="Application.API.Class.BaculumAPIServer" />
        </paths>
        <modules>
-               <!-- auth modules -->
+               <!-- OAuth2 - only to be compatible with old OAuth2 endpoints -->
+               <!-- Remove it in the future but keep oauth2_token (it is used in this service to remove old tokens) -->
+               <module id="oauth2" class="Application.API.Class.OAuth2.BaculumOAuth2" />
+               <module id="oauth2_config" class="Application.API.Class.OAuth2.OAuth2Config" />
+               <module id="oauth2_authid" class="Application.API.Class.OAuth2.AuthIdManager" />
                <module id="oauth2_token" class="Application.API.Class.OAuth2.TokenManager" />
+
                <!-- database modules -->
                <module id="db" class="Application.API.Class.Database" />
                <module id="client" class="Application.API.Class.ClientManager" />
index a58c4b4eb47a98b74706e64f676da26479c4ea9b..dd8109ba94d11897d1c30ff74850f6ffb2314598 100644 (file)
@@ -1,5 +1,11 @@
 <urls>
        <!-- #### NEW API version 1 #### -->
+
+       <!-- OAuth2 - only to be compatible with old OAuth2 endpoints -->
+       <!-- Remove it in the future -->
+       <url ServiceParameter="Authorize" pattern="api/auth/" />
+       <url ServiceParameter="RequestToken" pattern="api/token/" />
+
        <!-- general endpoint -->
        <url ServiceParameter="Welcome" pattern="api/v1/welcome/" />
        <!-- bconsole endpoints -->