Authorization setting
Configuration example
"auth": {
"std": {
"core": {
"type": "mysql",
"mySQLHolder": {
"address": "localhost",
"port": 3306,
"username": "launchserver",
"password": "password",
"database": "db?serverTimezone=UTC",
"timezone": "UTC",
"useHikari": true
},
"passwordVerifier": {
"algo": "SHA256",
"type": "digest"
},
"expireSeconds": 7200,
"table": "users",
"tableHwid": "hwids",
"uuidColumn": "uuid",
"usernameColumn": "username",
"passwordColumn": "password",
"accessTokenColumn": "accessToken",
"hardwareIdColumn": "hwidId",
"serverIDColumn": "serverID"
},
"textureProvider": {
"skinURL": "http://example.com/skins/%username%.png",
"cloakURL": "http://example.com/cloaks/%username%.png",
"type": "request"
},
"isDefault": true,
"displayName": "Default"
}
}
Description of the configuration
address
- Address MySQL serverport
- Port MySQL serverusername
- Usernamepassword
- User passworddatabase
- Database (before?), After the installation of server timezone is locatedtimezone
- Installation of client timezonesuseHikari
- whether to use HikaricppasswordVerifier
- your passwordverifier view more inPasswordVerifiertextureProvider
- is responsible for the issuance of skins and cloaks TextureProviderexpireSeconds
- Opening hours AcceStoken (sec)table
- tabletableHwid
- Table with HWIDuuidColumn
- Column name with uuidusernameColumn
-Column name with user namespasswordColumn
-Column name with user passwordaccessTokenColumn
- Column name with accestokenhardwareIdColumn
- Column name with ID record in the Hwids tableserverIDColumn
- Column name with serverid
Skins and cloak system(TextureProvider)
Method Void
Skins and raincoats are completely disconnected.Example configuration:
"textureProvider": {
"type": "void"
},
Method Request
In this method, skins and raincoats are configured by only two parameters - the URL mask on the PNG file.Example configuration:
"textureProvider": {
"skinURL": "http://example.com/skins/%username%.png",
"cloakURL": "http://example.com/cloaks/%username%.png",
"type": "request"
},
This method has a significant minus - there is no support for Slim skins
Method Json
Ready implementation of the issuance of skins, cloaks, Slim skins php-script
"textureProvider": {
"url": "https://example.com/TextureProvider.php?login=%uuid%",
"type": "json"
},
Configuration PasswordVerifier
"passwordVerifier": {
"algo": "SHA256",
"type": "digest"
}
"passwordVerifier": {
"algo": "SHA256",
"toHexMode": true,
"type": "doubleDigest"
}
"passwordVerifier": {
"type": "bcrypt"
}
"passwordVerifier": {
"type": "phpass"
}
digest
- Heshs the password with the selected algorithm.Any algorithms implemented in Java or BouncyCastle are supporteddoubleDigest
- Heshs the password with the selected algorithm twice. toHexMode
Before the second round of the hash, the hash will transfer to HEX format.Any algorithms implemented in Java or BouncyCastle are supportedbcrypt
(Module AddionalHash
) - checks the password by algorithm BCrypt(password_verify in PHP)phpass
(Module AddionalHash
) - checks the password by algorithm phpass(WordPress)
Authorization methods
Method reject
Takes any pair of login-paralle for infidels.This method can be used during technical work.Example configuration:
"auth": {
"std": {
"core": {
"type": "reject",
},
"isDefault": true,
"displayName": "Default"
}
}
Method Memory
Suitable for testing. It does not require a password to enter.
"auth": {
"std": {
"core": {
"type": "memory",
},
"isDefault": true,
"displayName": "Default"
}
}
Method MySQL
This handler stores all the data on the authorization in the MySQL database, uses UUID ready.This handler is recommended to use all projects as far as possible.Example configuration:
"auth": {
"std": {
"core": {
"type": "mysql",
"mySQLHolder": {
"address": "localhost",
"port": 3306,
"username": "launchserver",
"password": "password",
"database": "db?serverTimezone=UTC",
"timezone": "UTC",
"useHikari": true
},
"passwordVerifier": {
"algo": "SHA256",
"type": "digest"
},
"expireSeconds": 7200,
"table": "users",
"tableHwid": "hwids",
"uuidColumn": "uuid",
"usernameColumn": "username",
"passwordColumn": "password",
"accessTokenColumn": "accessToken",
"serverIDColumn": "serverID"
},
"isDefault": true,
"displayName": "Default"
}
}
In order to add the missing fields and cogereene UUID, you can use the SQL request:
-- Adds the missing fields to the table
ALTER TABLE users
ADD COLUMN uuid CHAR(36) UNIQUE DEFAULT NULL,
ADD COLUMN accessToken CHAR(32) DEFAULT NULL,
ADD COLUMN serverID VARCHAR(41) DEFAULT NULL,
ADD COLUMN hwidId BIGINT DEFAULT NULL;
-- Creates a trigger for UUID generation for new users
DELIMITER //
CREATE TRIGGER setUUID BEFORE INSERT ON users
FOR EACH ROW BEGIN
IF NEW.uuid IS NULL THEN
SET NEW.uuid = UUID();
END IF;
END; //
DELIMITER ;
-- Generates UUID for existing users
UPDATE users SET uuid=(SELECT UUID()) WHERE uuid IS NULL;
CREATE TABLE `hwids` (
`id` bigint(20) NOT NULL,
`publickey` blob,
`hwDiskId` varchar(255) DEFAULT NULL,
`baseboardSerialNumber` varchar(255) DEFAULT NULL,
`graphicCard` varchar(255) DEFAULT NULL,
`displayId` blob,
`bitness` int(11) DEFAULT NULL,
`totalMemory` bigint(20) DEFAULT NULL,
`logicalProcessors` int(11) DEFAULT NULL,
`physicalProcessors` int(11) DEFAULT NULL,
`processorMaxFreq` bigint(11) DEFAULT NULL,
`battery` tinyint(1) NOT NULL DEFAULT "0",
`banned` tinyint(1) NOT NULL DEFAULT "0"
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `hwids`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `publickey` (`publickey`(255));
ALTER TABLE `hwids`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
ADD CONSTRAINT `users_hwidfk` FOREIGN KEY (`hwidId`) REFERENCES `hwids` (`id`);
Method PostgreSQL
This handler stores all the data on the authorization in the PostgreSQL database, uses UUID ready. An example of configuration:
"auth": {
"std": {
"core": {
"type": "postgresql",
"postgresSQLHolder": {
"addresses": ["localhost"],
"ports": [5432],
"username": "username",
"password": "password",
"database": "database",
"timezone": "UTC",
"useHikari": true
},
"passwordVerifier": {
"algo": "SHA256",
"type": "digest"
},
"expireSeconds": 7200,
"table": "users",
"tableHwid": "hwids",
"uuidColumn": "uuid",
"usernameColumn": "username",
"passwordColumn": "password",
"accessTokenColumn": "accessToken",
"serverIDColumn": "serverID"
},
"isDefault": true,
"displayName": "Default"
}
}
In order to add the missing fields and cogereene UUID, you can use the SQL request:
-- Adds the missing fields to the table
ALTER TABLE users
ADD COLUMN uuid CHAR(36) UNIQUE DEFAULT NULL,
ADD COLUMN accessToken CHAR(32) DEFAULT NULL,
ADD COLUMN serverID VARCHAR(41) DEFAULT NULL;
-- Adds expansion for UUID generation
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Adds trigger to generate uuid
CREATE OR REPLACE FUNCTION public.users_uuid_trigger_func()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
new.uuid = (SELECT uuid_generate_v4());
return new;
END;
$function$
CREATE trigger users_uuid_trigger
BEFORE INSERT ON users
FOR EACH ROW
EXECUTE PROCEDURE users_uuid_trigger_func();
-- Generates UUID for existing users
UPDATE users SET uuid=(SELECT uuid_generate_v4()) WHERE uuid IS NULL;
Method FileAuthSystem
Data storage system system in the file .json
Installation of the module
- Copy the module FileAuthSystem_module.jar in the folder /LaunchServer/modules/
- Launch launchserver and register the command
fileauthsystem install
- Register users with a commandm
config auth.std.core register [username] email [password]
- Everything!
Commands
Enter config auth.std.core
and click Tab to view available commands
Configuration
- autoSave - automatically save the database to the file when stopping Launchserver
{
"autoSave": true
}
- Type authCoreProvider
fileauthsystem
, configuration:
{
"type": "fileauthsystem"
}
- When installing through
FileauthSystem Install
AuthCoreProvider will be installed automatically