Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Use Spring Security with JPA -


i new spring.

we using spring security feature. database connectivity: eclipselink implementation of jpa. database: mysql

while using spring security, configuration of authentication provider follows,-

<authentication-provider>      <jdbc-user-service id="userdetailsservice" data-source-ref="datasource" />      </authentication-provider> 

but in jpa not define datasource, use persistence unit provider jpa.persistenceprovider.

so how configure authentication provider use jpa database connectivity?

what should data-source-ref field contain use database authentication?

thank in advance.

basically need implement userdetailsservice yourself.

so example have user entity, , userdetailsservice implementation user , convert userdetails object (or entity have implement userdetails).

sample implementation:

public class myuserdetailsservice implements userdetailsservice{      private entitymanager entitymanager;     @persistencecontext     public void setentitymanager(entitymanager newem){         this.entitymanager = newem;     }      public userdetails loaduserbyusername(string username){          // assuming have user class implements userdetails         return entitymanager.createquery("from user username = :username", user.class)                             .setparameter("username", username)                             .getsingleresult();      } } 

and add user spring-security.xml

<authentication-manager>    <authentication-provider user-service-ref="myuserdetailsservice" /> </authentication-manager> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -