为什么 每次执行到subject.login(token) 程序就steped呢
public static void main(String[] args) {
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
druidDataSource.setUrl("jdbc:mysql://localhost:3306/test?Unicode=true&characterEncoding=UTF-8&allowMultiQueries=true");
druidDataSource.setUsername("root");
druidDataSource.setPassword("root");
JdbcRealm jdbcRealm = new JdbcRealm();
jdbcRealm.setDataSource(druidDataSource);
jdbcRealm.setPermissionsLookupEnabled(true);
String userQuerySql = "select user_pwd from t_users where user_name = ?";
jdbcRealm.setAuthenticationQuery(userQuerySql);
DefaultSecurityManager securityManager = new DefaultSecurityManager();
securityManager.setRealm(jdbcRealm);
SecurityUtils.setSecurityManager(securityManager);
Subject subject = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken("23","123456");
try {
System.out.println("---------");
subject.login(token);
} catch (Exception e) {
System.out.println(e.getMessage());
}
System.out.println(subject.isAuthenticated());
}