@Test void helloShiro() { String username = "admin"; String password = "admin"; IniRealmDemo iniRealmDemo = new IniRealmDemo(); Assert.assertEquals(true, iniRealmDemo.helloShiro(username, password)); }
public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log.debug("currentUser.isAuthenticated()'s value : {}", currentUser.isAuthenticated()); } catch (Exception e) { log.error("usernamePasswordToken's value : {}", usernamePasswordToken); } return currentUser.isAuthenticated(); }
IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log.debug("currentUser.isAuthenticated()'s value : {}", currentUser.isAuthenticated()); } catch (Exception e) { log.error("usernamePasswordToken's value : {}", usernamePasswordToken); } return currentUser.isAuthenticated(); } }
IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log.debug("currentUser.isAuthenticated()'s value : {}", currentUser.isAuthenticated()); } catch (Exception e) { log.error("usernamePasswordToken's value : {}", usernamePasswordToken); } return currentUser.isAuthenticated(); }  }
IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log.debug("currentUser.isAuthenticated()'s value : {}", currentUser.isAuthenticated()); } catch (Exception e) { log.error("usernamePasswordToken's value : {}", usernamePasswordToken); } return currentUser.isAuthenticated(); }  boolean helloShiro(String username, String password); }
IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log.debug("currentUser.isAuthenticated()'s value : {}", currentUser.isAuthenticated()); } catch (Exception e) { log.error("usernamePasswordToken's value : {}", usernamePasswordToken); } return currentUser.isAuthenticated(); }  boolean helloShiro(String username, String password);  }