mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-06-03 14:13:44 +00:00
del[gateway]: delete AuthUidToGatewayCheck/AuthUidAsk/AuthUidToGatewayConfirm
This commit is contained in:
@@ -56,9 +56,6 @@ public class GraalvmNetHints implements RuntimeHintsRegistrar {
|
||||
classes.add(UdpAttachment.class);
|
||||
classes.add(HttpAttachment.class);
|
||||
classes.add(NoAnswerAttachment.class);
|
||||
classes.add(AuthUidToGatewayCheck.class);
|
||||
classes.add(AuthUidToGatewayConfirm.class);
|
||||
classes.add(AuthUidAsk.class);
|
||||
classes.add(GatewaySessionInactiveAsk.class);
|
||||
classes.add(GatewaySynchronizeSidAsk.class);
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 22)
|
||||
public class AuthUidAsk {
|
||||
|
||||
private String gatewayHostAndPort;
|
||||
|
||||
private long sid;
|
||||
private long uid;
|
||||
|
||||
public static AuthUidAsk valueOf(String gatewayHostAndPort, long sid, long uid) {
|
||||
var ask = new AuthUidAsk();
|
||||
ask.gatewayHostAndPort = gatewayHostAndPort;
|
||||
ask.sid = sid;
|
||||
ask.uid = uid;
|
||||
return ask;
|
||||
}
|
||||
|
||||
public String getGatewayHostAndPort() {
|
||||
return gatewayHostAndPort;
|
||||
}
|
||||
|
||||
public void setGatewayHostAndPort(String gatewayHostAndPort) {
|
||||
this.gatewayHostAndPort = gatewayHostAndPort;
|
||||
}
|
||||
|
||||
public long getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(long sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 网关登录成功过后,将uid授权给网关
|
||||
*
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 20)
|
||||
public class AuthUidToGatewayCheck {
|
||||
|
||||
private long uid;
|
||||
|
||||
public static AuthUidToGatewayCheck valueOf(long uid) {
|
||||
var authUidToGateway = new AuthUidToGatewayCheck();
|
||||
authUidToGateway.uid = uid;
|
||||
return authUidToGateway;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* 网关登录成功过后,将uid授权给网关的返回
|
||||
*
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 21)
|
||||
public class AuthUidToGatewayConfirm {
|
||||
|
||||
private long uid;
|
||||
|
||||
public static AuthUidToGatewayConfirm valueOf(long uid) {
|
||||
var authUidToGateway = new AuthUidToGatewayConfirm();
|
||||
authUidToGateway.uid = uid;
|
||||
return authUidToGateway;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.zfoo.net.core.gateway.model;
|
||||
|
||||
import com.zfoo.event.model.IEvent;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
public class AuthUidToGatewayEvent implements IEvent {
|
||||
|
||||
private long sid;
|
||||
private long uid;
|
||||
|
||||
public static AuthUidToGatewayEvent valueOf(long sid, long uid) {
|
||||
var event = new AuthUidToGatewayEvent();
|
||||
event.sid = sid;
|
||||
event.uid = uid;
|
||||
return event;
|
||||
}
|
||||
|
||||
public long getSid() {
|
||||
return sid;
|
||||
}
|
||||
|
||||
public void setSid(long sid) {
|
||||
this.sid = sid;
|
||||
}
|
||||
|
||||
public long getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(long uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,6 @@ import com.zfoo.net.NetContext;
|
||||
import com.zfoo.net.anno.PacketReceiver;
|
||||
import com.zfoo.net.anno.Task;
|
||||
import com.zfoo.net.core.event.ServerExceptionEvent;
|
||||
import com.zfoo.net.core.gateway.model.AuthUidToGatewayCheck;
|
||||
import com.zfoo.net.core.gateway.model.AuthUidToGatewayConfirm;
|
||||
import com.zfoo.net.core.gateway.model.AuthUidToGatewayEvent;
|
||||
import com.zfoo.net.packet.EncodedPacketInfo;
|
||||
import com.zfoo.net.packet.PacketService;
|
||||
import com.zfoo.net.packet.common.Error;
|
||||
@@ -135,21 +132,6 @@ public class Router implements IRouter {
|
||||
logger.warn("gateway receives packet:[{}] and attachment:[{}] from server" + ", but serverSessionMap has no session[id:{}], perhaps client disconnected from gateway.", JsonUtils.object2String(packet), JsonUtils.object2String(attachment), gatewayAttachment.getSid());
|
||||
return;
|
||||
}
|
||||
|
||||
// 网关授权,授权完成直接返回
|
||||
// 注意:这个 AuthUidToGatewayCheck 是在home的LoginController中处理完登录后,把消息发给网关进行授权
|
||||
if (AuthUidToGatewayCheck.class == packet.getClass()) {
|
||||
var uid = ((AuthUidToGatewayCheck) packet).getUid();
|
||||
if (uid <= 0) {
|
||||
logger.error("错误的网关授权信息,uid必须大于0");
|
||||
return;
|
||||
}
|
||||
gatewaySession.setUid(uid);
|
||||
EventBus.post(AuthUidToGatewayEvent.valueOf(gatewaySession.getSid(), uid));
|
||||
|
||||
NetContext.getRouter().send(session, AuthUidToGatewayConfirm.valueOf(uid), new GatewayAttachment(gatewaySession));
|
||||
return;
|
||||
}
|
||||
send(gatewaySession, packet, gatewayAttachment.getSignalAttachment());
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
<protocol location="com.zfoo.net.router.attachment.NoAnswerAttachment"/>
|
||||
|
||||
|
||||
<protocol location="com.zfoo.net.core.gateway.model.AuthUidToGatewayCheck"/>
|
||||
<protocol location="com.zfoo.net.core.gateway.model.AuthUidToGatewayConfirm"/>
|
||||
<protocol location="com.zfoo.net.core.gateway.model.AuthUidAsk"/>
|
||||
<protocol location="com.zfoo.net.core.gateway.model.GatewaySessionInactiveAsk"/>
|
||||
<protocol location="com.zfoo.net.core.gateway.model.GatewaySynchronizeSidAsk"/>
|
||||
</module>
|
||||
|
||||
Reference in New Issue
Block a user