mirror of
https://e.coding.net/circlecloud/AuthMe.git
synced 2024-12-22 06:48:55 +00:00
clean up class..
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
e1af61efa4
commit
b5f5afe770
@ -16,73 +16,53 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result filter(LogEvent record) {
|
public Result filter(final LogEvent record) {
|
||||||
try {
|
try {
|
||||||
if (record == null || record.getMessage() == null)
|
if (record == null || record.getMessage() == null) {
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
String logM = record.getMessage().getFormattedMessage().toLowerCase();
|
}
|
||||||
if (!logM.contains("issued server command:"))
|
final String logM = record.getMessage().getFormattedMessage().toLowerCase();
|
||||||
return Result.NEUTRAL;
|
return isLogger(logM);
|
||||||
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
} catch (final NullPointerException npe) {
|
||||||
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ")
|
|
||||||
&& !logM.contains("/register "))
|
|
||||||
return Result.NEUTRAL;
|
|
||||||
return Result.DENY;
|
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result filter(Logger arg0, Level arg1, Marker arg2, Message message, Throwable arg4) {
|
public Result filter(final Logger arg0, final Level arg1, final Marker arg2, final Message message, final Throwable arg4) {
|
||||||
try {
|
try {
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
String logM = message.getFormattedMessage().toLowerCase();
|
}
|
||||||
if (!logM.contains("issued server command:"))
|
final String logM = message.getFormattedMessage().toLowerCase();
|
||||||
return Result.NEUTRAL;
|
return isLogger(logM);
|
||||||
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
} catch (final NullPointerException npe) {
|
||||||
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ")
|
|
||||||
&& !logM.contains("/register "))
|
|
||||||
return Result.NEUTRAL;
|
|
||||||
return Result.DENY;
|
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result filter(Logger arg0, Level arg1, Marker arg2, Object message, Throwable arg4) {
|
public Result filter(final Logger arg0, final Level arg1, final Marker arg2, final Object message, final Throwable arg4) {
|
||||||
try {
|
try {
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
String logM = message.toString().toLowerCase();
|
}
|
||||||
if (!logM.contains("issued server command:"))
|
final String logM = message.toString().toLowerCase();
|
||||||
return Result.NEUTRAL;
|
return isLogger(logM);
|
||||||
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
} catch (final NullPointerException npe) {
|
||||||
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ")
|
|
||||||
&& !logM.contains("/register "))
|
|
||||||
return Result.NEUTRAL;
|
|
||||||
return Result.DENY;
|
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object... arg4) {
|
public Result filter(final Logger arg0, final Level arg1, final Marker arg2, final String message, final Object... arg4) {
|
||||||
try {
|
try {
|
||||||
if (message == null)
|
if (message == null) {
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
String logM = message.toLowerCase();
|
}
|
||||||
if (!logM.contains("issued server command:"))
|
final String logM = message.toLowerCase();
|
||||||
return Result.NEUTRAL;
|
return isLogger(logM);
|
||||||
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ")
|
} catch (final NullPointerException npe) {
|
||||||
&& !logM.contains("/authme register ") && !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ")
|
|
||||||
&& !logM.contains("/register "))
|
|
||||||
return Result.NEUTRAL;
|
|
||||||
return Result.DENY;
|
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,4 +77,15 @@ public class Log4JFilter implements org.apache.logging.log4j.core.Filter {
|
|||||||
return Result.NEUTRAL;
|
return Result.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Result isLogger(final String logM) {
|
||||||
|
if (!logM.contains("issued server command:")) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
if (!logM.contains("/login ") && !logM.contains("/l ") && !logM.contains("/reg ") && !logM.contains("/changepassword ") && !logM.contains("/unregister ") && !logM.contains("/authme register ")
|
||||||
|
&& !logM.contains("/authme changepassword ") && !logM.contains("/authme reg ") && !logM.contains("/authme cp ") && !logM.contains("/register ")) {
|
||||||
|
return Result.NEUTRAL;
|
||||||
|
}
|
||||||
|
return Result.DENY;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user