Change this:

/login.jsp = anon

to this:

/login.jsp = authc

That ensures that the 'authc' filter will process the authentication
request.  Because in the [main] section you specified this:

authc.loginUrl = /login.jsp

the authc filter will understand that a request to /login.jsp is a login
request and process it accordingly.

In other words, 2 things have to occur:

1) In [main] you have to tell the 'authc' filter what the login URL will be
so it knows to process requests to that URL.
2) In [urls] you have to define a filter chain that says "when a request
comes to /login.jsp, I want the 'authc' filter to process it".

The first configures the filter, the second ensures the filter is actually
used to handle a request.

Also, sorry on the email reply thing - apparently Nabble isn't too
intuitive about this.  Apparently you have to subscribe to the Shiro
mailing list of choice first yourself (manually), and only after you've
done that can you use Nabble to post to the list.  If you don't do this
first, messages from Nabble won't appear on the list and we wont' see them.

HTH,

--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
Stormpath wins GigaOM Structure Launchpad Award! http://bit.ly/MvZkMk

On Wed, Nov 14, 2012 at 9:35 AM, David Barron <[email protected]> wrote:

> Jared,
> I appreciate your jumping into this.  I have made some progress in that
> the login screen is showing now, but I am unable to login and I am not
> getting any indication of what is failing.  I have tried adding log4j but
> there isn't anything helpful in it.
>
> Here is my shiro.ini:
>
> [main]
> cm = org.apache.shiro.authc.credential.Md5CredentialsMatcher
> jdbcRealm=org.apache.shiro.realm.jdbc.JdbcRealm
> jdbcRealm.permissionsLookupEnabled=true
> jdbcRealm.authenticationQuery = select password from user_info where
> lower(email) = lower(?)
> jdbcRealm.userRolesQuery = select role from users_info where lower(email)
> = lower(?)
> ds = org.postgresql.ds.PGSimpleDataSource
> ds.user = ptracker
> ds.password = Admin123
> ds.databaseName = ptracker
> ds.portNumber = 5432
> ds.serverName = localhost
> jdbcRealm.dataSource = $ds
> jdbcRealm.credentialsMatcher = $cm
>
> authc.loginUrl = /login.jsp
> authc.usernameParam = user
> authc.passwordParam = pass
> authc.successUrl = /index.jsp
>
>
> [roles]
> admin=*
>
> [urls]
> /login.jsp = anon
> /** = authc
>
> And here is my web.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
> http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
>     <listener>
>
> <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
>     </listener>
>
>     <filter>
>         <filter-name>ShiroFilter</filter-name>
>
> <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
>     </filter>
>
>     <filter-mapping>
>         <filter-name>ShiroFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>         <dispatcher>REQUEST</dispatcher>
>         <dispatcher>FORWARD</dispatcher>
>         <dispatcher>INCLUDE</dispatcher>
>         <dispatcher>ERROR</dispatcher>
>     </filter-mapping>
>     <session-config>
>         <session-timeout>
>             30
>         </session-timeout>
>     </session-config>
>     <welcome-file-list>
>         <welcome-file>index.jsp</welcome-file>
>     </welcome-file-list>
> </web-app>
>
> David Barron
> Zencos Consulting LLC
> [email protected]
> 919-459-4600 x 119 (office)
> 919-995-2356 (mobile)
>
> From: Jared Bunting-2 [via Shiro User] [mailto:
> [email protected]]
> Sent: Wednesday, November 14, 2012 9:47 AM
> To: David Barron
> Subject: Re: why isn't this working?
>
> David,
>
> I think you didn't get a response because your email was never sent to
> the list.  I'm not sure why that is, but I've raised a question on the
> dev list to see if we can address it.
>
> Anyways, on to your problem.
>
> I see one issue that isn't causing the problem you describe, but will
> cause other problems when you get further.  In the [urls] section, your
> paths that map to authc should also include /login.jsp (don't worry,
> it's smart enough to realize that that's the same as loginUrl and let
> you at it, but the filter needs to operate on that url in order to
> process login info.)
>
> Can you share your web.xml?  I think that's going to be the other piece
> to this puzzle.
>
> -Jared
>
> On Tue 13 Nov 2012 11:18:46 PM CST, Charlie Qiu wrote:
>
> >  If you have log4j.jar on your classpath you may configure it with
> > log4j.properties.
> >
> > 2012/11/14 David Barron <[hidden
> email]</user/SendEmail.jtp?type=node&node=7577936&i=0> <mailto:[hidden
> email]</user/SendEmail.jtp?type=node&node=7577936&i=1>>>
> >
> >     Charlie,
> >     How do I do set the log to trace?  I haven't seen that anywhere in
> >     the docs.
> >
> >     Thanks
> >
> >
> >     David Barron
> >     Zencos Consulting LLC
> >     [hidden email]</user/SendEmail.jtp?type=node&node=7577936&i=2>
> <mailto:[hidden email]</user/SendEmail.jtp?type=node&node=7577936&i=3>>
> >     919-459-4600 x 119 <tel:919-459-4600%20x%20119> (office)
> >     919-995-2356 <tel:919-995-2356> (mobile)
> >
> >     From: charlieqiu [via Shiro User]
> >     [mailto:[hidden
> email]</user/SendEmail.jtp?type=node&node=7577936&i=4>
> >     <mailto:ml-node%[hidden
> email]</user/SendEmail.jtp?type=node&node=7577936&i=5>>]
> >     Sent: Tuesday, November 13, 2012 9:16 PM
> >     To: David Barron
> >     Subject: Re: why isn't this working?
> >
> >     Dude,
> >     I have been waiting an answer for 2 days, glad to meet you on the
> >     same boat. I am not familiar with IniSecurityManager , I have only
> >     used spring integrated DefaultSecurityManager. But one thing may
> >     help you is that you can enable 'Trace' in your log config. Shiro
> >     logs all its authentication steps with logger.Trace. It may give
> >     you information why you cann't see your login page.
> >
> >     Charlie
>

Reply via email to