You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by David Barron <db...@zencos.com> on 2012/11/13 17:29:35 UTC

Re: why isn't this working?

Is there the remotest possibility that I will get some help with this?  As
far as I can tell no one has even seen my posting.

I am unable to get to the login screen no matter what I try.  Every time I
run the application it shows index.jsp, which is not what it is supposed to
do.  I understand that I'm doing something basic wrong here, but I can't see
what it might be.  Any help would be appreciated.

If nothing else is there any documentation anywhere that describes (in words
appropriate to a newbie and apparent idiot) how to setup a jdbc realm with
examples.  What I am finding by googling is all much more elaborate than
what I need.




--
View this message in context: http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577929.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: why isn't this working?

Posted by David Barron <db...@zencos.com>.
Setting /login.jsp = authc corrected the problem for me.

Thanks very much everyone for all the help.



--
View this message in context: http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577962.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: why isn't this working?

Posted by Les Hazlewood <lh...@apache.org>.
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 <db...@zencos.com> 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
> david.barron@zencos.com
> 919-459-4600 x 119 (office)
> 919-995-2356 (mobile)
>
> From: Jared Bunting-2 [via Shiro User] [mailto:
> ml-node+s582556n7577936h14@n2.nabble.com]
> 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
>

RE: why isn't this working?

Posted by David Barron <db...@zencos.com>.
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
david.barron@zencos.com
919-459-4600 x 119 (office)
919-995-2356 (mobile)

From: Jared Bunting-2 [via Shiro User] [mailto:ml-node+s582556n7577936h14@n2.nabble.com]
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
>     BR
>     ________________________________
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577930.html
>     To unsubscribe from why isn't this working?, click
>     here<
>     NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
>
>     --
>     View this message in context:
>     http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577934.html
>     Sent from the Shiro User mailing list archive at Nabble.com.
>
>



________________________________
If you reply to this email, your message will be added to the discussion below:
http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577936.html
To unsubscribe from why isn't this working?, click here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7577919&code=ZGJhcnJvbkB6ZW5jb3MuY29tfDc1Nzc5MTl8MjAwMzkxNjI5NQ==>.
NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577937.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: why isn't this working?

Posted by Jared Bunting <ja...@peachjean.com>.
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 <dbarron@zencos.com <ma...@zencos.com>>
>
>     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
>     david.barron@zencos.com <ma...@zencos.com>
>     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:ml-node+s582556n7577930h28@n2.nabble.com
>     <ma...@n2.nabble.com>]
>     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
>     BR
>     ________________________________
>     If you reply to this email, your message will be added to the
>     discussion below:
>     http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577930.html
>     To unsubscribe from why isn't this working?, click
>     here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7577919&code=ZGJhcnJvbkB6ZW5jb3MuY29tfDc1Nzc5MTl8MjAwMzkxNjI5NQ==>.
>     NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
>
>
>     --
>     View this message in context:
>     http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577934.html
>     Sent from the Shiro User mailing list archive at Nabble.com.
>
>



Re: why isn't this working?

Posted by Charlie Qiu <qc...@gmail.com>.
 If you have log4j.jar on your classpath you may configure it with
log4j.properties.

2012/11/14 David Barron <db...@zencos.com>

> 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
> david.barron@zencos.com
> 919-459-4600 x 119 (office)
> 919-995-2356 (mobile)
>
> From: charlieqiu [via Shiro User] [mailto:
> ml-node+s582556n7577930h28@n2.nabble.com]
> 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
> BR
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577930.html
> To unsubscribe from why isn't this working?, click here<
> http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7577919&code=ZGJhcnJvbkB6ZW5jb3MuY29tfDc1Nzc5MTl8MjAwMzkxNjI5NQ==
> >.
> NAML<
> http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577934.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

RE: why isn't this working?

Posted by David Barron <db...@zencos.com>.
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
david.barron@zencos.com
919-459-4600 x 119 (office)
919-995-2356 (mobile)

From: charlieqiu [via Shiro User] [mailto:ml-node+s582556n7577930h28@n2.nabble.com]
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
BR
________________________________
If you reply to this email, your message will be added to the discussion below:
http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577930.html
To unsubscribe from why isn't this working?, click here<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7577919&code=ZGJhcnJvbkB6ZW5jb3MuY29tfDc1Nzc5MTl8MjAwMzkxNjI5NQ==>.
NAML<http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577934.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: why isn't this working?

Posted by charlieqiu <qc...@gmail.com>.
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
BR



--
View this message in context: http://shiro-user.582556.n2.nabble.com/why-isn-t-this-working-tp7577919p7577930.html
Sent from the Shiro User mailing list archive at Nabble.com.