Skip to content
Snippets Groups Projects
Commit fc406f72 authored by William Enright's avatar William Enright
Browse files

fixed login endpoint being possibly filtered

Change-Id: Iec3570e94cb03f8a5a646f385907f499bec3022a
parent 98409397
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
/*
* 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
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment