Hi Chris,

There is a 'web' sample application that shows form-based authentication here:

https://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.0/samples/web/

Here are the web.xml, shiro.ini and login.jsp files respectively:

https://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.0/samples/web/src/main/webapp/WEB-INF/web.xml
https://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.0/samples/web/src/main/webapp/WEB-INF/shiro.ini
https://svn.apache.org/repos/asf/shiro/tags/shiro-root-1.2.0/samples/web/src/main/webapp/login.jsp

You'll notice in shiro.ini, the following [main] config:

shiro.loginUrl = /index.jsp

Anything property with a 'shiro.' prefix means that the value should
be applied on _any_ object with that property.  For example, the above
line will call setLoginUrl("/index.jsp") on the authc filter, the
authcBasic filter, etc.

If this is confusing, it might be better to just set the properties
directly, for example:

[main]
# tell the 'authc' (FormAuthenticationFilter) that it should react to
requests to /index.jsp:
authc.loginUrl = /index.jsp

An odd bit of this configuration is that, although it feels like
you're 'done', you still have to tell shiro to use that filter for
those requests.  So in [urls], you'll need to also specify:

[urls]
/index.jsp = authc

On a final note, if the documentation can be updated to make this
easier to understand, please let us know your thoughts and we can see
about making that better.

Thanks,

Les

On Wed, Jan 25, 2012 at 12:26 AM, Chris Richmond
<[email protected]> wrote:
> Hello,
>
> In embedded Jetty setting, with web.xml I have successfully gotten basic
> auth to prompt the user and send credentials to my cusom auhtorizing realm
> configured through web.xml and now I want to convert it to forms auth
> instead of browser basic auth.
>
> I can get shiro to redirect to my login page, but it does not seem to submit
> the params to shiro, instead simply posting back and doing nothing with my
> realm.  The Shiro site has this as an example for login.jsp:
>
> <form ...>
>
>    Username: <input type="text" name="username"/> <br/>
>    Password: <input type="password" name="password"/>
>    ...
>    <input type="checkbox" name="rememberMe" value="true"/>Remember Me?
>    ...
> </form>
>
> I have this type of section in my form, but what else is needed.  Are
> imports or other declarations needed in order to make this JSP page wire up
> to Shiro?
>
> Is there a complete, basic example of a login.jsp for doing this.  Can plain
> .html page with this form element work?
>
> Thanks,
> Chris

Reply via email to