use of com.generallycloud.baseio.protocol.ParametersFuture in project baseio by generallycloud.
the class AuthorityFilter method accept.
@Override
protected void accept(SocketSession session, NamedFuture future) throws Exception {
AuthorityContext authorityContext = AuthorityContext.getInstance();
AuthoritySessionAttachment attachment = authorityContext.getSessionAttachment(session);
AuthorityManager authorityManager = attachment.getAuthorityManager();
if (authorityManager == null) {
RoleManager roleManager = authorityContext.getRoleManager();
authorityManager = roleManager.getAuthorityManager(Authority.GUEST);
attachment.setAuthorityManager(authorityManager);
}
if (!authorityManager.isInvokeApproved(future.getFutureName())) {
future.write(RESMessage.UNAUTH.toString());
session.flush(future);
String futureName = future.getFutureName();
String remoteAddr = session.getRemoteAddr();
String readText = future.getReadText();
if (!StringUtil.isNullOrBlank(readText)) {
logger.info("refuse connection, ip:{}, service name:{}, content: {}", new String[] { remoteAddr, futureName, readText });
return;
}
if (future instanceof ParametersFuture) {
Parameters parameters = ((ParametersFuture) future).getParameters();
if (parameters.size() > 0) {
logger.info("refuse connection, ip:{}, service name:{}, content: {}", new String[] { remoteAddr, futureName, parameters.toString() });
return;
}
}
logger.info("refuse connection, ip:{}, service name:{}", remoteAddr, futureName);
}
}
use of com.generallycloud.baseio.protocol.ParametersFuture in project baseio by generallycloud.
the class LoggerFilter method accept.
@Override
protected void accept(SocketSession session, NamedFuture future) throws Exception {
String futureName = future.getFutureName();
if (noneLoggerUrlSet.contains(futureName) || endContains(futureName)) {
return;
}
String remoteAddr = session.getRemoteAddr();
String readText = future.getReadText();
if (!StringUtil.isNullOrBlank(readText)) {
logger.info("request ip:{}, service name:{}, content: {}", new String[] { remoteAddr, futureName, readText });
return;
}
if (future instanceof ParametersFuture) {
Parameters parameters = ((ParametersFuture) future).getParameters();
if (parameters.size() > 0) {
logger.info("request ip:{}, service name:{}, content: {}", new String[] { remoteAddr, futureName, parameters.toString() });
return;
}
}
logger.info("request ip:{}, service name:{}", remoteAddr, futureName);
}
use of com.generallycloud.baseio.protocol.ParametersFuture in project baseio by generallycloud.
the class SystemAuthorityServlet method accept.
@Override
public void accept(SocketSession session, Future future) throws Exception {
LoginCenter loginCenter = AuthorityContext.getInstance().getLoginCenter();
ParametersFuture f = (ParametersFuture) future;
boolean login = loginCenter.login(session, f.getParameters());
RESMessage message = RESMessage.UNAUTH;
if (login) {
Authority authority = ApplicationContextUtil.getAuthority(session);
message = new RESMessage(0, authority, null);
}
future.write(message.toString());
session.flush(future);
}
Aggregations