java - Authentication/Authorization in Spring Interceptor and web services -


i have managed make web services worked spring. need add authentication not can use web services. there many classes , interfaces not sure 1 use.

what best approach it? have example see? appreciate it.

if intend have simple basicauth authentication (just username , password), following xml enough secure services, don't need extend/implement anything:

    <http auto-config="true">         <intercept-url pattern="/description*" access="role_admin" />         <logout logout-success-url="/wherever" />     </http>      <authentication-manager>         <authentication-provider>             <user-service>                 <user name="user1" password="password" authorities="role_user" />                 <user name="user2" password="password" authorities="role_admin" />             </user-service>         </authentication-provider>     </authentication-manager> 

note: need add appropriate maven dependencies well:

    <dependency>         <groupid>org.springframework.security</groupid>         <artifactid>spring-security-web</artifactid>         <version>3.2.3.release</version>     </dependency>     <dependency>         <groupid>org.springframework.security</groupid>         <artifactid>spring-security-config</artifactid>         <version>3.2.3.release</version>     </dependency> 

you can play around actual roles, user , passwords want use.

edit: in case don't use maven, have manually download jar files , add them classpath wherever keep libraries. these links can download jar, download (jar) button:

in file, should copy , paste simple basic auth made me?

you paste them in spring-config.xml file


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -