You may need to re implement the 'getPasswordForUser()' method and set an
additional parameter `ps.setString(2, username);`
https://github.com/apache/shiro/blob/1.3.x/core/src/main/java/org/apache/shiro/realm/jdbc/JdbcRealm.java#L281

This is probably something we could add back into the JdbcRealm, as this is
a pretty common technique (it would need to be disabled by default to stay
backwards compatible)  If you are interested, send us a pull request!


On Fri, Sep 23, 2016 at 11:02 AM, llagerlof <[email protected]> wrote:

> Hi. I am new to java (but not to programming in general, like php and
> javascript).
>
> Let me explain my issue:
>
> I have a web application written in java. The LOGIN, HASHED PASSWORD and
> EMAIL are in the database.
>
> Everything is working until now because the user could only access using
> LOGIN and PASSWORD.
>
> This is my authenticationQuery in my shiro.ini:
>
>
>
> Now I need to allow the user to login with LOGIN or EMAIL. I tried change
> the query to:
>
>
>
> But this generate a runtime error on login, because, I think, only the
> first
> "?" on query is set.
>
>
> I don't know if this helps, but I have a JdbcRealm "CustomJdbcRealm":
>
>
>
>
> Do you have some idea what I could do to achieve my objective? If you need,
> I can provide more information about the system.
>
> Thank you.
>
>
>
> --
> View this message in context: http://shiro-user.582556.n2.
> nabble.com/Can-I-use-both-USER-and-EMAIL-as-login-auth-
> in-the-query-shiro-ini-s-authenticationQuery-parameter-tp7581286.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Reply via email to