diff --git a/datastore/pom.xml b/datastore/pom.xml index d197f3ec6979c7d5c33abc75f3b90035e1ec7208..cc897acf7850415563990bc6c826c981e0393e51 100644 --- a/datastore/pom.xml +++ b/datastore/pom.xml @@ -22,6 +22,12 @@ <artifactId>derby</artifactId> <version>${debry.version}</version> </dependency> + <dependency> + <groupId>net.jami</groupId> + <artifactId>jams-common</artifactId> + <version>2.0</version> + <scope>compile</scope> + </dependency> </dependencies> <build> diff --git a/jams-ca/pom.xml b/jams-ca/pom.xml index d600364032aeabbc5b502227ed3bddc84630b169..8e98f3c984d83019a4d4c28233289341884a08cd 100644 --- a/jams-ca/pom.xml +++ b/jams-ca/pom.xml @@ -17,6 +17,12 @@ <version>${revision}</version> <scope>compile</scope> </dependency> + <dependency> + <groupId>net.jami</groupId> + <artifactId>jams-common</artifactId> + <version>2.0</version> + <scope>compile</scope> + </dependency> </dependencies> <build> diff --git a/jams-server/pom.xml b/jams-server/pom.xml index 279ea341417a2c2a29a674371fd49d8f9db0741e..258eaeccda6cd161d151a9dea2a4a33991d02217 100644 --- a/jams-server/pom.xml +++ b/jams-server/pom.xml @@ -61,6 +61,18 @@ <artifactId>asm</artifactId> <version>${asm.version}</version> </dependency> + <dependency> + <groupId>net.jami</groupId> + <artifactId>datastore</artifactId> + <version>2.0</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>net.jami</groupId> + <artifactId>jami-nameserver</artifactId> + <version>2.0</version> + <scope>compile</scope> + </dependency> </dependencies> <build> diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/LoginServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/LoginServlet.java index df1b56b4a8a63c15e210b51ff1a113fde90b6e98..6e905abe515961a6323efb5500161adf6da12920 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/LoginServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/LoginServlet.java @@ -1,25 +1,25 @@ /* -* Copyright (C) 2020 by Savoir-faire Linux -* Authors: William Enright <william.enright@savoirfairelinux.com> -* Ndeye Anna Ndiaye <anna.ndiaye@savoirfairelinux.com> -* Johnny Flores <johnny.flores@savoirfairelinux.com> -* Mohammed Raza <mohammed.raza@savoirfairelinux.com> -* Felix Sidokhine <felix.sidokhine@savoirfairelinux.com> -* -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <https://www.gnu.org/licenses/>. -*/ + * Copyright (C) 2020 by Savoir-faire Linux + * Authors: William Enright <william.enright@savoirfairelinux.com> + * Ndeye Anna Ndiaye <anna.ndiaye@savoirfairelinux.com> + * Johnny Flores <johnny.flores@savoirfairelinux.com> + * Mohammed Raza <mohammed.raza@savoirfairelinux.com> + * Felix Sidokhine <felix.sidokhine@savoirfairelinux.com> + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ package net.jami.jams.server.servlets; import com.jsoniter.JsonIterator; @@ -51,14 +51,6 @@ public class LoginServlet extends HttpServlet { * @apiParam {body} [LoginRequest] username/password sent to server as JSON object * * @apiSuccess (200) {body} AuthTokenResponse the 0Auth authentication token - * @apiSuccessExample {json} Success-Response: - * { - * "token_type":"Bearer", - * "access_token":"JWT representation of the token", - * "expires_in":180000, - * "scope":"USER" - * } - * * @apiError (403) {null} null The user is unauthorized */ @Override diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateServerSettingsServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateServerSettingsServlet.java index 9c55af402669b67553d9173b67768828113ebf13..a67fc61fc6b192bf5ab69d075a684a2ed73acb1f 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateServerSettingsServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/install/CreateServerSettingsServlet.java @@ -44,7 +44,7 @@ public class CreateServerSettingsServlet extends HttpServlet { } @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { CertificateAuthorityConfig config = JsonIterator.deserialize( req.getInputStream().readAllBytes(),CertificateAuthorityConfig.class); CachedObjects.certificateAuthorityConfig = config; diff --git a/jams-server/src/main/resources/webapp/js/api.js b/jams-server/src/main/resources/webapp/js/api.js index 029b730212667d10ca0a6665be44b412e2b22013..6e0977a67e82f49b35e890f1f16c3e731fc2beb7 100644 --- a/jams-server/src/main/resources/webapp/js/api.js +++ b/jams-server/src/main/resources/webapp/js/api.js @@ -37,7 +37,7 @@ var ca_setup_page = 'ca-setup.html'; var identity_management_page = 'identity-management.html'; var server_parameters_page = 'server-parameters.html'; var api_path_post_install_admin = '/api/install/start'; -var api_path_post_auth_login = '/api/auth/login'; +var api_path_post_auth_login = '/api/login'; var api_path_post_install_ca = '/api/install/ca'; var api_path_post_install_auth = '/api/install/auth'; var api_path_post_install_server = '/api/install/settings'; @@ -54,15 +54,16 @@ var api_path_get_logout = '/api/auth/logout'; var api_path_get_post_configuration_auth_service = '/api/configuration/authservice'; var api_path_get_post_configuration_global_settings = '/api/configuration/globalsettings'; var api_path_post_configuration_change_password = '/api/configuration/changepassword'; -var api_path_post_configuration_register_license = '/api/configuration/registerlicense'; +var api_path_post_configuration_register_license = '/api/subscription'; var api_path_get_auth_license = '/api/auth/license'; -var api_path_get_auth_services = '/api/auth/authservices'; -var api_path_get_needs_update = '/api/checkupdate'; -var api_path_get_start_update = '/api/startupdate'; +var api_path_get_directories = '/api/auth/directories'; +var api_path_get_needs_update = '/api/update'; +var api_path_get_start_update = '/api/update'; var api_path_post_create_user = '/api/user/create'; var api_path_post_update_user = '/api/user/update'; var api_path_post_exists_user = '/api/user/exists'; -var api_path_get_user_extended_data ='/api/auth/user/extendeddata'; +var api_path_get_user_directory_search ='/api/auth/directory/search'; +var api_path_get_user_directory_entry ='/api/auth/directory/entry'; var api_path_get_user_needs_reset ='/api/user/needsreset'; @@ -90,8 +91,6 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction if (window.localStorage.getItem('access_token')) { var jwt = localStorage.getItem('access_token'); - console.log(jwt); - console.log(data); ajax['headers'] = { "Bearer": jwt, @@ -100,7 +99,7 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction // pass data in the header if (data) { - if (api_path == api_path_get_user_extended_data || api_path == api_path_get_auth_user_search || api_path == api_path_get_user_needs_reset) + if (api_path == api_path_get_user_directory_search || api_path == api_path_get_auth_user_search || api_path == api_path_get_user_needs_reset) isSearch = true; // search dataType @@ -110,7 +109,6 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction else { if (window.localStorage.getItem('access_token')) { - var jwt = localStorage.getItem('access_token'); console.log(jwt); diff --git a/jams-server/src/main/resources/webapp/js/cookies-manager.js b/jams-server/src/main/resources/webapp/js/cookies-manager.js index e3e23f662cc4f60f64cef1373ba4ec0bf9a75e14..98580988b9fcb452806fdb35ef44e41bb72cdfea 100644 --- a/jams-server/src/main/resources/webapp/js/cookies-manager.js +++ b/jams-server/src/main/resources/webapp/js/cookies-manager.js @@ -25,6 +25,7 @@ function setCookie(key, value, expiry) { } function setJWT(value) { + window.localStorage.removeItem('access_token'); window.localStorage.setItem('access_token', value.access_token); } diff --git a/jams-server/src/main/resources/webapp/js/identity-management.js b/jams-server/src/main/resources/webapp/js/identity-management.js index 53e5e2e61e03f02b54ffc84415622e8c3d7898f1..7416c09cd978ad85439d4b0017a7e53ad8e2aa87 100644 --- a/jams-server/src/main/resources/webapp/js/identity-management.js +++ b/jams-server/src/main/resources/webapp/js/identity-management.js @@ -72,6 +72,7 @@ function setLDAPParametersData(form) { settings['fieldMappings']['facsimileTelephoneNumber'] = "FaxNumber"; settings['fieldMappings']['extensionName'] = "PhoneNumberExtension"; settings['fieldMappings']['o'] = "Organization"; + settings['fieldMappings']['uid'] = "Username"; authSource['type'] = 'LDAP'; authSource['ldapSettings'] = settings; diff --git a/jams-server/src/main/resources/webapp/js/search.js b/jams-server/src/main/resources/webapp/js/search.js index 0053d32c545c7feb61f39bf2cb935b680cfd0376..2fd27c79cbee7bdd8f6142cce16dedbbdc0aae21 100644 --- a/jams-server/src/main/resources/webapp/js/search.js +++ b/jams-server/src/main/resources/webapp/js/search.js @@ -25,8 +25,13 @@ var userEdit = ''; var userRevoke = ''; $(document).ready(function() { + + var data = { + 'queryString': "*" + } + // load all users - ajaxApiCall(api_path_get_user_extended_data, 'GET', null, null, listAllUsers); + ajaxApiCall(api_path_get_user_directory_search, 'GET', data, null, listAllUsers); setTimeout(function() { ajaxApiCall(api_path_get_needs_update, 'GET', null, null, handleUpdate, false); @@ -118,7 +123,6 @@ function listAllUsers(data, statusCode, jqXHR) for (i = 0; i < resultSet.length; i++) { var firstName = ''; var lastName = ''; - console.log("listAllUsers"); console.log(resultSet[i]); if (resultSet[i].firstName) @@ -154,7 +158,7 @@ function listAllUsers(data, statusCode, jqXHR) }); setTimeout(function() { - ajaxApiCall(api_path_get_auth_services, 'GET', null, null, ishsqlConfig); + ajaxApiCall(api_path_get_directories, 'GET', null, null, ishsqlConfig); }, 100); addListenersForActions(); } @@ -317,13 +321,13 @@ function handleUpdate(data, statusCode, jqXHR) { var resultSet = data; if (resultSet.updateAvailable == true) { $('#update-title-div').show(); - $('#update-title').text("UPGRADE TO JAMS " + resultSet.newVersions.substring(resultSet.newVersions.indexOf("=") + 1, resultSet.newVersions.length - 1)); + $('#update-title').text("UPGRADE TO JAMS " + resultSet.remoteVersions.substring(resultSet.remoteVersions.indexOf("=") + 1, resultSet.remoteVersions.length - 1)); document.getElementsByClassName("update-title")[0].addEventListener('click', function(){ if (isActive == true) { $('#downloadUpdateModalCenter').modal('show'); document.getElementsByClassName("auto-update")[0].addEventListener('click', function() { - ajaxApiCall(api_path_get_start_update, 'GET', null, null, handleUpdateStart, false); + ajaxApiCall(api_path_get_start_update, 'POST', null, null, handleUpdateStart, false); }); } else diff --git a/jams-server/src/main/resources/webapp/js/user.js b/jams-server/src/main/resources/webapp/js/user.js index 12b31d2b9c3dca7633a18be8ced869d89831ef83..3749ae937024927b2e6469d90c8061607051ce7d 100644 --- a/jams-server/src/main/resources/webapp/js/user.js +++ b/jams-server/src/main/resources/webapp/js/user.js @@ -160,7 +160,7 @@ $(document).ready(function() { if (searchAccess) { // set User information fields setTimeout(function() { - ajaxApiCall(api_path_get_auth_services, 'GET', null, null, ishsqlConfig); + ajaxApiCall(api_path_get_directories, 'GET', null, null, ishsqlConfig); ajaxApiCall(api_path_get_auth_user_search, 'GET', searchData, null, setUserInfoDataSource); ajaxApiCall(api_path_get_user_extended_data, 'GET', searchData, null, setUserExtendedData); }, 300);