<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Writing custom UserDetailsService for spring security</title>
	<atom:link href="http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html</link>
	<description>Everything java</description>
	<lastBuildDate>Wed, 28 Jul 2010 18:37:29 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: TUKsubaru</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-632</link>
		<dc:creator>TUKsubaru</dc:creator>
		<pubDate>Mon, 19 Jul 2010 08:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-632</guid>
		<description>Thank very much...
Code is works.</description>
		<content:encoded><![CDATA[<p>Thank very much&#8230;<br />
Code is works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mr. Kudos</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-628</link>
		<dc:creator>Mr. Kudos</dc:creator>
		<pubDate>Wed, 23 Jun 2010 02:56:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-628</guid>
		<description>Kudos for the simplicity and objetctiviy. Saved me a lot of time.</description>
		<content:encoded><![CDATA[<p>Kudos for the simplicity and objetctiviy. Saved me a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Screamy</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-627</link>
		<dc:creator>Screamy</dc:creator>
		<pubDate>Tue, 15 Jun 2010 18:37:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-627</guid>
		<description>Concise, to-the-point and _exactly_ what I was looking for.  Thanks!</description>
		<content:encoded><![CDATA[<p>Concise, to-the-point and _exactly_ what I was looking for.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-512</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 14 Sep 2009 15:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-512</guid>
		<description>Thanks for the tutorial, I&#039;m new to Spring Security and it really helped me out!

I want to return my own user Object (with extra parameters ), so I created a custom UserDetailsService and extended org.springframework.security.userdetails.User.

However in my client side application (on successful login) an Object with two parameters is returned:
 - authorites
 - name (which is the username)

Below is a snippet of my custom UserDetailsService:

    public MyUser loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {

        String sql = &quot;select * from user where emailAddress like :username&quot;;
        MapSqlParameterSource source = new MapSqlParameterSource();
        source.addValue(&quot;username&quot;, username);
 
       SimpleJdbcTemplate sjt = new SimpleJdbcTemplate(getDataSource());
        MyUser user = sjt.queryForObject(sql, RowMapperUtil.getUserRowMapper(), source);
        return user;
    }

I&#039;m a bit lost here! I am returning an  Object of type MyUser and mapping all the fields correctly, so I am not sure where I am going wrong.

Your help is greatly appreciated,
Daniel</description>
		<content:encoded><![CDATA[<p>Thanks for the tutorial, I&#8217;m new to Spring Security and it really helped me out!</p>
<p>I want to return my own user Object (with extra parameters ), so I created a custom UserDetailsService and extended org.springframework.security.userdetails.User.</p>
<p>However in my client side application (on successful login) an Object with two parameters is returned:<br />
 &#8211; authorites<br />
 &#8211; name (which is the username)</p>
<p>Below is a snippet of my custom UserDetailsService:</p>
<p>    public MyUser loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {</p>
<p>        String sql = &#8220;select * from user where emailAddress like :username&#8221;;<br />
        MapSqlParameterSource source = new MapSqlParameterSource();<br />
        source.addValue(&#8221;username&#8221;, username);</p>
<p>       SimpleJdbcTemplate sjt = new SimpleJdbcTemplate(getDataSource());<br />
        MyUser user = sjt.queryForObject(sql, RowMapperUtil.getUserRowMapper(), source);<br />
        return user;<br />
    }</p>
<p>I&#8217;m a bit lost here! I am returning an  Object of type MyUser and mapping all the fields correctly, so I am not sure where I am going wrong.</p>
<p>Your help is greatly appreciated,<br />
Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sajitha</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-484</link>
		<dc:creator>Sajitha</dc:creator>
		<pubDate>Mon, 15 Jun 2009 06:35:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-484</guid>
		<description>Hi,

This was a very useful article :)
I have a requirement, which is the user account has to be locked after 5 consecutive failed attempts. How can this be acheived. I have to store the details like &quot;First Failed Try Time&quot; and &quot;Locked Flag&quot; in the database.
So basically, I have to customize something after the passwords mismatch. Iam not sure how this is done. Given that iam using Spring&#039;s Form based authentication. Where should i write this Logic?? 
If any one has got any idea PLEASE..E share.

Regards,
Sajitha</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>This was a very useful article <img src='http://www.codercorp.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I have a requirement, which is the user account has to be locked after 5 consecutive failed attempts. How can this be acheived. I have to store the details like &#8220;First Failed Try Time&#8221; and &#8220;Locked Flag&#8221; in the database.<br />
So basically, I have to customize something after the passwords mismatch. Iam not sure how this is done. Given that iam using Spring&#8217;s Form based authentication. Where should i write this Logic??<br />
If any one has got any idea PLEASE..E share.</p>
<p>Regards,<br />
Sajitha</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manoj</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-469</link>
		<dc:creator>manoj</dc:creator>
		<pubDate>Tue, 12 May 2009 07:50:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-469</guid>
		<description>Hi,
While I have been able to customize the JasperServer to use existing iBatis/Struts infrastructure and integrate authentication using existing app, there is one thorn. How can I change the login page to accept another field? Say I want user to enter Domain in addition to username and password. And use the three to authenticate and eventually show reports. I have been able to write my custom Dao that validates jasper user from my DB, but how do I get new attribute - domain to reach my Dao, so that it can be used to authenticate the user? While customizing the login page to accept additional fields is straightforward - you just need to modify login.jsp and make it your login page - making the new values reach \&#039;some Java handler\&#039; is an issue.

Appreciate inputs on this.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
While I have been able to customize the JasperServer to use existing iBatis/Struts infrastructure and integrate authentication using existing app, there is one thorn. How can I change the login page to accept another field? Say I want user to enter Domain in addition to username and password. And use the three to authenticate and eventually show reports. I have been able to write my custom Dao that validates jasper user from my DB, but how do I get new attribute &#8211; domain to reach my Dao, so that it can be used to authenticate the user? While customizing the login page to accept additional fields is straightforward &#8211; you just need to modify login.jsp and make it your login page &#8211; making the new values reach \&#8217;some Java handler\&#8217; is an issue.</p>
<p>Appreciate inputs on this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gaurav Arora</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-448</link>
		<dc:creator>Gaurav Arora</dc:creator>
		<pubDate>Wed, 22 Apr 2009 10:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-448</guid>
		<description>You can get the user object itself on the next page using SecurityContextHolder.getContext().getAuthentication().getPrincipal(). But you really shouldn&#039;t have to access the user&#039;s ID on the jsp page. All that should be done in the controller.</description>
		<content:encoded><![CDATA[<p>You can get the user object itself on the next page using SecurityContextHolder.getContext().getAuthentication().getPrincipal(). But you really shouldn&#8217;t have to access the user&#8217;s ID on the jsp page. All that should be done in the controller.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leithold</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-446</link>
		<dc:creator>leithold</dc:creator>
		<pubDate>Wed, 22 Apr 2009 10:13:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-446</guid>
		<description>Hey its me again. i have a question. i have a user table similar to yours. the thing is, i need to pass the id of the user to the next page when the log-in is successfull. i was wondering how to do this.

(i have a hunch that maybe it has something to do with the form-login 
default-target-url but i could be dead wrong)

thanks so much.</description>
		<content:encoded><![CDATA[<p>Hey its me again. i have a question. i have a user table similar to yours. the thing is, i need to pass the id of the user to the next page when the log-in is successfull. i was wondering how to do this.</p>
<p>(i have a hunch that maybe it has something to do with the form-login<br />
default-target-url but i could be dead wrong)</p>
<p>thanks so much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: leithold</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-444</link>
		<dc:creator>leithold</dc:creator>
		<pubDate>Wed, 22 Apr 2009 09:12:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-444</guid>
		<description>wow thanks so much for this man. ill try it out. hope it works for me.</description>
		<content:encoded><![CDATA[<p>wow thanks so much for this man. ill try it out. hope it works for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anton</title>
		<link>http://www.codercorp.com/blog/spring/security-spring/writing-custom-userdetailsservice-for-spring-security.html/comment-page-1#comment-356</link>
		<dc:creator>anton</dc:creator>
		<pubDate>Fri, 06 Mar 2009 15:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.codercorp.com/blog/?p=118#comment-356</guid>
		<description>By just adding something like the following to the configuration file it works too (but I&#039;m using an Oracle database)

    
        
    </description>
		<content:encoded><![CDATA[<p>By just adding something like the following to the configuration file it works too (but I&#8217;m using an Oracle database)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
