锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲女女女同性video,亚洲色精品aⅴ一区区三区,色婷婷亚洲十月十月色天http://m.tkk7.com/usherlight/category/36797.html澶╁鉤灞變笂鐧戒簯娉夛紝浜戣嚜鏃犲績姘磋嚜闂層備綍蹇呭鍐插北涓嬪幓錛屾洿娣繪嘗嫻悜浜洪棿錛?/description>zh-cnWed, 31 Aug 2011 01:01:28 GMTWed, 31 Aug 2011 01:01:28 GMT60Spring Security涓寚瀹歴ession瓚呮椂鍚庤煩杞殑欏甸潰http://m.tkk7.com/usherlight/archive/2011/08/31/357615.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Tue, 30 Aug 2011 23:25:00 GMThttp://m.tkk7.com/usherlight/archive/2011/08/31/357615.htmlhttp://m.tkk7.com/usherlight/comments/357615.htmlhttp://m.tkk7.com/usherlight/archive/2011/08/31/357615.html#Feedback0http://m.tkk7.com/usherlight/comments/commentRss/357615.htmlhttp://m.tkk7.com/usherlight/services/trackbacks/357615.htmlSpring Security涓寚瀹歴ession瓚呮椂鍚庤煩杞殑欏甸潰

鍦▁ml閰嶇疆鏂囦歡涓姞鍏ワ細<session-management invalid-session-url="/session-timeout.htm" />


]]>
Spring MVC + Spring Security + Spring JDBC涓敞鍏ataSource鎬繪槸涓篘ull鐨勫師鍥犲拰瑙e喅http://m.tkk7.com/usherlight/archive/2011/08/26/357316.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 26 Aug 2011 00:57:00 GMThttp://m.tkk7.com/usherlight/archive/2011/08/26/357316.htmlhttp://m.tkk7.com/usherlight/comments/357316.htmlhttp://m.tkk7.com/usherlight/archive/2011/08/26/357316.html#Feedback0http://m.tkk7.com/usherlight/comments/commentRss/357316.htmlhttp://m.tkk7.com/usherlight/services/trackbacks/357316.html
鍦╝pplicationContext.xml涓畾涔変簡涓涓狣ataSource錛?lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" />
浣嗘槸鍦ㄤ唬鐮佷腑錛屼嬌鐢╝notation榪涜娉ㄥ叆鐨勬椂鍊欙紝鍗存繪槸鎵句笉鍒拌繖涓猟ataSource.

    @Autowired
    public void setDataSource(DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
        jdbcInsert = new SimpleJdbcInsert(dataSource);
    }

鏈鍚庣粓浜庢兂鏄庣櫧浜嗭紝鍘熷洜澶ф鏄繖鏍風殑錛屼嬌鐢╝utowired鐨勬椂鍊欙紝榛樿鏄牴鎹被鍨嬫潵鍖歸厤鐨勶紝鍦▁ml涓畾涔夌殑綾誨瀷鏄細BasicDataSource錛岃屼笉鏄帴鍙ataSource錛屾墍浠ラ粯璁ゆ儏鍐典笅榪欐牱鏄棤娉曡嚜鍔ㄨ閰嶇殑銆傝В鍐沖姙娉曟槸鎸囦護浣跨敤鍚嶅瓧鏉ヨ繘琛宐ean鐨勫尮閰嶏紝涔熷氨鏄敤Qualifier鎸囧畾bean鐨刬d.

    @Autowired
    public void setDataSource(@Qualifier("dataSource") DataSource dataSource) {
        jdbcTemplate = new JdbcTemplate(dataSource);
        jdbcInsert = new SimpleJdbcInsert(dataSource);
    }


鍙﹀涓鐐癸紝鍦ㄧ綉涓婃悳绱㈢殑榪囩▼涓彂鐜版湁涓嶅皯浜洪兘鏈夌被浼肩殑闂錛屼絾鏄粬浠殑鍘熷洜鏄病鏈夋紜嬌鐢╯pring鐨勬敞鍏ワ紝鑰屾槸鑷繁鍦ㄤ唬鐮佷腑new浜嗕竴涓狣ao鐨勫疄渚嬶紝榪欐牱鐨勮瘽錛宻pring鏄棤娉曞皢dataSource娉ㄥ叆鍒癲ao鐨勫疄渚嬩腑鐨?/div>


]]>
Spring Security - Using custom Authentication Processing Filterhttp://m.tkk7.com/usherlight/archive/2010/06/11/323293.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 11 Jun 2010 00:12:00 GMThttp://m.tkk7.com/usherlight/archive/2010/06/11/323293.htmlhttp://m.tkk7.com/usherlight/comments/323293.htmlhttp://m.tkk7.com/usherlight/archive/2010/06/11/323293.html#Feedback0http://m.tkk7.com/usherlight/comments/commentRss/323293.htmlhttp://m.tkk7.com/usherlight/services/trackbacks/323293.html springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* REQUEST INCLUDE FORWARD If you want to externalize all of your security related configuration into a separate file, you can do so and add that to your context location param. contextConfigLocation /WEB-INF/beans.xml , /WEB-INF/springSecurity.xml Now comes the part of security configuration for your application, Adding the URL security patterns is pretty simple and straight forward. Add all the URL patterns which you want to secure and add the wild card pattern at the end. You need to have some default principal and role even for non logged in users as you need to give access to pages like log in, register and forgot password kind of functionality even to non logged in users. I tried to add comments to pretty much every element which I am using here. As an example I added just a wild card intercept url which make every page of my application secure. You need to exclude different urls based on the roles. Following is my custom implementation of AuthenticationEntryPoint, which currently is not doing any thing except leveraging the commence to its super class which is the spring implementation of AuthenticationProcessingFilterEntryPoint. I hooked it to add any custom logic. public class CustomAuthenticationEntryPoint extends AuthenticationProcessingFilterEntryPoint { private static final Log logger = LogFactory.getLog(CustomAuthenticationEntryPoint.class); @Override public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException) throws IOException, ServletException { super.commence(request, response, authException); } } This is my custom authentication manager which actually does the custom login of the user. It will throw an BadCredentialsException in case of invalid credentials or thorws a AuthenticationServiceException in case of a service error (Database error, SQL error or any other error). public class CustomAuthunticationManager implements AuthenticationManager { @Autowired UserManagerService userManagerService; public Authentication authenticate(Authentication authentication) throws AuthenticationException { if(StringUtils.isBlank((String) authentication.getPrincipal()) || StringUtils.isBlank((String) authentication.getCredentials())){ throw new BadCredentialsException("Invalid username/password"); } User user = null; GrantedAuthority[] grantedAuthorities = null; try{ user = userManagerService.getUser((String) authentication.getPrincipal(), (String) authentication.getCredentials()); } catch(InvalidCredentialsException ex){ throw new BadCredentialsException(ex.getMessage()); } catch(Exception e){ throw new AuthenticationServiceException("Currently we are unable to process your request. Kindly try again later."); } if (user != null) { List roles = user.getAssociatedRoles(); grantedAuthorities = new GrantedAuthority[roles.size()]; for (int i = 0; i < roles.size(); i++) { Role role = roles.get(i); GrantedAuthority authority = new GrantedAuthorityImpl(role.getRoleCode()); grantedAuthorities[i] = authority; } } else{ throw new BadCredentialsException("Invalid username/password"); } return new UsernamePasswordAuthenticationToken(user, authentication.getCredentials(), grantedAuthorities); } } At the client side (jsp), the simple configuration you need to do is post the request to"/j_spring_security_check" with parameters "j_username" and "j_password". That's pretty much all you need to do for enabling spring security to your existing web application. I will try to explain about doing the method security using ACL's and configuring the view using spring security tags in another post.

]]>
濡備綍浣跨敤spring鐨刟utowire涓簊ervlet娉ㄥ叆Beanhttp://m.tkk7.com/usherlight/archive/2009/09/04/293864.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 04 Sep 2009 06:19:00 GMThttp://m.tkk7.com/usherlight/archive/2009/09/04/293864.htmlhttp://m.tkk7.com/usherlight/comments/293864.htmlhttp://m.tkk7.com/usherlight/archive/2009/09/04/293864.html#Feedback2http://m.tkk7.com/usherlight/comments/commentRss/293864.htmlhttp://m.tkk7.com/usherlight/services/trackbacks/293864.html 瀵逛簬Filter錛孲pring鎻愪緵浜咲elegatingFilterProxy錛屾墍浠ユ湰鏂囦富瑕佽榪癝ervlet鐨勮В鍐熾?br /> 1銆佹瘮杈冪洿瑙備絾鏄笉澶т紭闆呯殑鍋氭硶鏄噸鍐檌nit()鏂規硶錛屽湪閲岄潰浣跨敤AutowireCapableBeanFactory鏉ユ墜宸ュ憡璇塖pring錛氭垜榪欎釜Servlet鏄渶瑕佽繖鏍風殑涓涓狟ean鐨勩傚叿浣撳啓娉曪細
public void init(ServletConfig servletConfig) throws ServletException {
    ServletContext servletContext = servletConfig.getServletContext();
    WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
    AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext.getAutowireCapableBeanFactory();
    autowireCapableBeanFactory.configureBean(this, BEAN_NAME);
}
鍏朵腑錛孊EAN_NAME灝辨槸闇瑕佹敞鍏ョ殑Bean鍦╯pring涓敞鍐岀殑鍚嶅瓧.
榪欐牱鍐欑殑涓昏闂鏄氨鏄偅涓狟EAN_NAME,榪欐牱鍐欐湁鐐逛富鍔ㄦ煡鎵撅紝鑰屼笉鏄緷璧栨敞鍏ョ殑鎰熻銆?br />
2銆佸垱寤轟竴涓被浼間簬DelegatingFilterProxy閭f牱鐨勪唬鐞嗭紝閫氳繃浠g悊鏍規嵁閰嶇疆鏉ユ壘鍒板疄闄呯殑Servlet錛屽畬鎴愪笟鍔¢昏緫鍔熻兘銆?br /> 鍋囧畾鎴戜滑鏈変竴涓猄ervlet鍚嶅瓧鍙玌serServlet錛岄渶瑕佹敞鍏ヤ竴涓猆serManager錛屼吉浠g爜濡備笅錛?br /> public class UserServlet extends HttpServlet {
    @Autowired(required = true)
    private UserManager userManager;
}
絎竴姝?
public class DelegatingServletProxy extends GenericServlet {
    private String targetBean;
    private Servlet proxy;

    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        proxy.service(req, res);
    }

    @Override
    public void init() throws ServletException {
        this.targetBean = getServletName();
        getServletBean();
        proxy.init(getServletConfig());
    }

    private void getServletBean() {
        WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
        this.proxy = (Servlet) wac.getBean(targetBean);
    }
}
絎簩姝ワ細
閰嶇疆web.xml鏂囦歡錛屽師鏉serServlet鐨勯厤緗ぇ鑷存槸榪欐牱鐨勶細
    <servlet>
        <servlet-name>userServlet</servlet-name>
        <servlet-class>com.sample.UserServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>userServlet</servlet-name>
        <url-pattern>/userServlet</url-pattern>
    </servlet-mapping>
鐜板湪淇敼涓?br />     <servlet>
        <servlet-name>userServlet</servlet-name>
        <servlet-class>com.sample.DelegatingServletProxy</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>userServlet</servlet-name>
        <url-pattern>/userServlet</url-pattern>
    </servlet-mapping>
娉ㄦ剰,spring鏄牴鎹甋ervlet鐨勫悕瀛楁潵鏌ユ壘琚唬鐞嗙殑Servlet鐨勶紝鎵浠ワ紝棣栧厛鎴戜滑瑕佸湪UserServlet綾誨墠闈㈠姞涓夽Component,鏉ュ憡璇塖rping錛氭垜涔熸槸涓涓狟ean銆傚鏋滃悕縐板拰Web.xml閲岄潰瀹氫箟鐨勪笉涓鏍風殑璇濓紝鍙互鍦ㄨ繖閲屾寚瀹欱ean鐨勫悕瀛楋紝姣斿錛?@Component("userServlet")




]]>
主站蜘蛛池模板: www在线观看免费视频| 亚洲精品无码久久久久APP| a一级毛片免费高清在线| 四虎影院永久免费观看| 另类专区另类专区亚洲| 国产三级免费观看| japanese色国产在线看免费| 亚洲国产精品一区二区第四页| 深夜特黄a级毛片免费播放| 久99精品视频在线观看婷亚洲片国产一区一级在线 | 亚洲一区二区三区在线网站| 免费不卡视频一卡二卡| 亚洲 欧洲 自拍 另类 校园| 国产免费无遮挡精品视频| 无套内谢孕妇毛片免费看看| 国产亚洲av片在线观看18女人| 四虎国产精品免费永久在线| 亚洲五月六月丁香激情| 最近免费最新高清中文字幕韩国| 亚洲avav天堂av在线网爱情| 国产福利免费在线观看| 国产精品免费在线播放| 亚洲精品永久www忘忧草| 成年丰满熟妇午夜免费视频 | 曰韩无码AV片免费播放不卡| 337p日本欧洲亚洲大胆裸体艺术| 国产羞羞的视频在线观看免费| 亚洲欧洲校园自拍都市| 日韩免费一区二区三区| a级毛片免费完整视频| 亚洲免费在线观看视频| 亚洲成人一区二区| 久久精品人成免费| mm1313亚洲国产精品无码试看| 国产午夜亚洲精品午夜鲁丝片 | 国产小视频在线观看免费| 久久久久久国产a免费观看不卡| 亚洲精品国产免费| 亚洲AV中文无码乱人伦| 2021精品国产品免费观看| 亚洲爆乳无码专区www|