2

ログイン後にユーザーを個人ページにリダイレクトしたいですか? . たとえば、3人のユーザーがいます

  1. 管理者はすべてのページにアクセスできます
  2. 学生は学生ディレクトリの下のページにアクセスできます
  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
4

1 に答える 1