僅需要在 shiro.ini 增加幾行資料
#Setting JdbcRealm
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
#取得帳號密碼
jdbcRealm.authenticationQuery = select user_pass from users where user_name = ?
#取得Roles資料
jdbcRealm.userRolesQuery = select role_name from user_roles where user_name = ?
#使用JNDI DataSource
dataSource = org.apache.shiro.jndi.JndiObjectFactory
dataSource.resourceName = java:/comp/env/jdbc/EmployeeDB
jdbcRealm.dataSource = $dataSource
securityManager.realms = $jdbcRealm
#-----------------------------------------------------------------------------------------
#Setting RememberMe
rememberMeManager = org.apache.shiro.web.mgt.CookieRememberMeManager
securityManager.rememberMeManager = $rememberMeManager
securityManager.rememberMeManager.cookie.name = remember_me
#設定cookie.maxAge = blah , cookie會無法正常寫入
#securityManager.rememberMeManager.cookie.maxAge = blah
securityManager.rememberMeManager.cookie.domain = testdomain.com