update
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Wildfire Chat package.
|
||||
* (c) Heavyrain2012 <[email protected]>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
package cn.wildfirechat.server;
|
||||
|
||||
import win.liyufan.im.Utility;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public class MechineCode {
|
||||
public static void main(String[] args) throws Exception {
|
||||
for (String arg: args
|
||||
) {
|
||||
System.out.println(arg);
|
||||
}
|
||||
|
||||
if (args.length != 2) {
|
||||
System.out.println("Usage: ip port");
|
||||
System.exit(-1);
|
||||
}
|
||||
String mac = Utility.getMacAddress();
|
||||
mac += "|";
|
||||
mac += args[0];
|
||||
mac += "|";
|
||||
mac += args[1];
|
||||
mac = Base64.getEncoder().encodeToString(mac.getBytes());
|
||||
System.out.println(mac);
|
||||
}
|
||||
}
|
||||
@@ -101,6 +101,7 @@ public final class BrokerConstants {
|
||||
public static final String HZ_Cluster_Node_ID = "node_id";
|
||||
public static final String HTTP_SERVER_SECRET_KEY = "http.admin.secret_key";
|
||||
public static final String CLIENT_PROTO_SECRET_KEY = "client.proto.secret_key";
|
||||
public static final String TOKEN_SECRET_KEY = "token.key ";
|
||||
|
||||
public static final String EMBED_DB_PROPERTY_NAME = "embed.db";
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import io.moquette.spi.impl.security.AES;
|
||||
import io.moquette.spi.security.IAuthenticator;
|
||||
import io.moquette.spi.security.IAuthorizator;
|
||||
import io.moquette.spi.security.ISslContextCreator;
|
||||
import io.moquette.spi.security.Tokenor;
|
||||
import io.netty.util.ResourceLeakDetector;
|
||||
import win.liyufan.im.DBUtil;
|
||||
|
||||
@@ -379,6 +380,7 @@ public class Server {
|
||||
hazelcastInstance.getCluster().getLocalMember().setStringAttribute(HZ_Cluster_Node_External_Short_Port, shortPort);
|
||||
hazelcastInstance.getCluster().getLocalMember().setIntAttribute(HZ_Cluster_Node_ID, nodeId);
|
||||
hazelcastInstance.getCluster().getLocalMember().setStringAttribute(HZ_Cluster_Node_External_IP, serverIp);
|
||||
Tokenor.setKey(config.getProperty(BrokerConstants.TOKEN_SECRET_KEY));
|
||||
RPCCenter.getInstance().init(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package io.moquette.spi.security;
|
||||
|
||||
|
||||
import com.hazelcast.util.StringUtil;
|
||||
import io.moquette.spi.impl.security.AES;
|
||||
|
||||
public class Tokenor {
|
||||
private static final String KEY = "testim";
|
||||
private static String KEY = "testim";
|
||||
|
||||
public static void setKey(String key) {
|
||||
if (!StringUtil.isNullOrEmpty(key)) {
|
||||
KEY = key;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUserId(byte[] password) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user