Search code examples
javasecuritytapestryshiro

Role-specific login: override getUnauthorizedURL() in shiro / tapestry-security


How would one redirect a user to a specific login page depending on the role with shiro / tapestry-security?

I've tried to override the getUnauthorizedURL method in order to achieve that, some things along the lines of this, but obviously, there seems more to it than I understand:

@RequiresRoles("foo")
public class foobar {

  public String getUnauthorizedURL() {
    return "foobar_login_url";
  }
}

Solution

  • If the user needs to login it means the user is still unauthenticated and thus there is no user-specific role yet. To the best of my understanding there is no practical way to have role-specific login pages.