Hi,
I have worked on my Spring Social login (without Spring Security) and now it works great.
Now I have migrated my test- application into my real application which works with Spring Security.
I'am sure that some work has to be done in order to get Spring Social work with Spring Security.
In the class MyProviderSignAdapter#signin(...) I have to authenticate the user which has logged in over e.g. twitter. I' am not sure where to get the email and the password.
Currently I have this config above in my Spring- Security- Config- file (authenticationDao).
This means in my database I have 2 tables tuser and tauthority.
In order to authenticate the user in MyProviderSignAdapter#signin(...) I have to store the "twitter"- user in this 2 tables.
I' am not sure whether I'am right?
Thanks for your help in advance!
Generic
HTML Code:<bean id="authenticationDao" class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl"> <property name="dataSource" ref="dataSource" /> <property name="usersByUsernameQuery"> <value> SELECT email as username, password, enabled FROM tuser WHERE email = ?; </value> </property> <property name="authoritiesByUsernameQuery"> <value> SELECT u.email as username, authority FROM tauthority as a, tuser u WHERE a.pk_signedinauthority=u.pk_signedinuser AND u.email = ?; </value> </property> </bean>Code:final UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(email, password); HttpServletRequest req = request.getNativeRequest(HttpServletRequest.class); token.setDetails(new WebAuthenticationDetails(req)); final Authentication authentication = providerManager.authenticate(token); SecurityContextHolder.getContext().setAuthentication(authentication);


Reply With Quote