Search code examples
javashiro

Issue with shiro page redirection


ini file is like

[main]
authc.loginUrl = /login.html
authc.successUrl = /index.html
authc.usernameParam = j_username
authc.passwordParam = j_password

[users]
root = secret, admin

[roles]
admin = *

[urls]
/login.html = anon, roles[admin]
/index.html = authc, roles[admin]

when i try to hit the index.html I am getting the below error

HTTP ERROR 404

Problem accessing /shiro-example/login.jsp. Reason:

    /shiro-example/login.jsp
Powered by Jetty://

my login.html file is like

<form name="loginform" action="" method="post" >

        <p>
            <label>Username</label>
            <input id="username" type="text" name="j_username">
        </p>
        <p>
            <label>Password</label>
            <input type="password" name="j_password">
        </p>
        <input type="submit" value="Log In">
</form>

Please help me to resolve the issue.


Solution

  • Edited: https://shiro.apache.org/web.html#Web-FormbasedLogin

    Sorry I didn't look close enough at your config. use:

    [main] shiro.loginUrl = /login.html

    This way the loginUrl is set on any filter that is attempting to issue the redirect