|
|
@ -29,9 +29,9 @@ import java.util.Scanner; |
|
|
|
@Rule(key = "SessionDateChecker") |
|
|
|
@Rule(key = "SessionDateChecker") |
|
|
|
public class SessionDateChecker implements ConfigCheck { |
|
|
|
public class SessionDateChecker implements ConfigCheck { |
|
|
|
|
|
|
|
|
|
|
|
private boolean boo = true; |
|
|
|
private boolean boo = false; |
|
|
|
public void execute(SensorContext context, InputFile inputFile, RuleKey ruleKey){ |
|
|
|
public void execute(SensorContext context, InputFile inputFile, RuleKey ruleKey){ |
|
|
|
if(boo){ |
|
|
|
if(!boo){ |
|
|
|
//文件名称
|
|
|
|
//文件名称
|
|
|
|
String filename = inputFile.filename(); |
|
|
|
String filename = inputFile.filename(); |
|
|
|
//校验文件后缀
|
|
|
|
//校验文件后缀
|
|
|
@ -41,8 +41,8 @@ public class SessionDateChecker implements ConfigCheck { |
|
|
|
try (Scanner scanner = new Scanner(file)) { |
|
|
|
try (Scanner scanner = new Scanner(file)) { |
|
|
|
while (scanner.hasNextLine()) { |
|
|
|
while (scanner.hasNextLine()) { |
|
|
|
String line = scanner.nextLine(); |
|
|
|
String line = scanner.nextLine(); |
|
|
|
if (line.contains("server.servlet.session.timeout")) { |
|
|
|
if (!line.contains("server.servlet.session.timeout")) { |
|
|
|
boo = false; |
|
|
|
boo = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -62,8 +62,8 @@ public class SessionDateChecker implements ConfigCheck { |
|
|
|
Map<String, Object> obj = yaml.load(fis); |
|
|
|
Map<String, Object> obj = yaml.load(fis); |
|
|
|
if (obj != null){ |
|
|
|
if (obj != null){ |
|
|
|
String sessionTimeout = searchForSessionTimeout(obj, "server", "servlet", "session", "timeout"); |
|
|
|
String sessionTimeout = searchForSessionTimeout(obj, "server", "servlet", "session", "timeout"); |
|
|
|
if (sessionTimeout != null) { |
|
|
|
if (sessionTimeout == null) { |
|
|
|
boo = false; |
|
|
|
boo = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|