我想在登录后重定向用户到他的个人页面?. 我有 3 个用户,例如
- 管理员可以访问所有页面
- 学生可以访问学生目录下的页面
- 教师可以访问教师目录下的页面
这个怎么做?
任何帮助或想法?
更新 这里是我的 shiro.ini
[main]
ds = org.apache.shiro.jndi.JndiObjectFactory
ds.requiredType = javax.sql.DataSource
ds.resourceName = jdbc/myDataSource
ds.resourceRef = true
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
# password hashing specification
sha256Matcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
sha256Matcher.hashAlgorithmName=SHA-256
jdbcRealm.credentialsMatcher = $sha256Matcher
jdbcRealm.permissionsLookupEnabled = true
jdbcRealm.authenticationQuery = SELECT password FROM users WHERE username = ?
jdbcRealm.userRolesQuery = SELECT role_name FROM user_roles WHERE username = ?
jdbcRealm.permissionsQuery = SELECT roleper FROM roles_permissions WHERE role_name = ?
jdbcRealm.dataSource = $ds
authc = com.java.MyFilter
jdbcRealm.authorizationCachingEnabled = false
# specify login page
authc.loginUrl = /login.jsp
# redirect after successful login
authc.successUrl = /home.jsp
# roles filter: redirect to error page if user does not have access rights
roles.unauthorizedUrl = /accessdenied.jsp
# request parameter with login error information; if not present filter assumes 'shiroLoginFailure'
authc.failureKeyAttribute = simpleShiroApplicationLoginFailure
[urls]
/login.jsp = authc
# only users with some roles are allowed to use role-specific pages
/admin/** = authc,roles[admin]
/stu/** = authc,roles[student]
/teach/** = authc,roles[teacher]
# enable authc filter for all application pages
/ApacheShiroDemo/** = authc