锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲女女女同性video,亚洲色精品aⅴ一区区三区,色婷婷亚洲十月十月色天http://www.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://www.tkk7.com/usherlight/archive/2011/08/31/357615.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Tue, 30 Aug 2011 23:25:00 GMThttp://www.tkk7.com/usherlight/archive/2011/08/31/357615.htmlhttp://www.tkk7.com/usherlight/comments/357615.htmlhttp://www.tkk7.com/usherlight/archive/2011/08/31/357615.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/357615.htmlhttp://www.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://www.tkk7.com/usherlight/archive/2011/08/26/357316.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 26 Aug 2011 00:57:00 GMThttp://www.tkk7.com/usherlight/archive/2011/08/26/357316.htmlhttp://www.tkk7.com/usherlight/comments/357316.htmlhttp://www.tkk7.com/usherlight/archive/2011/08/26/357316.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/357316.htmlhttp://www.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://www.tkk7.com/usherlight/archive/2010/06/11/323293.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 11 Jun 2010 00:12:00 GMThttp://www.tkk7.com/usherlight/archive/2010/06/11/323293.htmlhttp://www.tkk7.com/usherlight/comments/323293.htmlhttp://www.tkk7.com/usherlight/archive/2010/06/11/323293.html#Feedback0http://www.tkk7.com/usherlight/comments/commentRss/323293.htmlhttp://www.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://www.tkk7.com/usherlight/archive/2009/09/04/293864.html浜戣嚜鏃犲績姘磋嚜闂?/dc:creator>浜戣嚜鏃犲績姘磋嚜闂?/author>Fri, 04 Sep 2009 06:19:00 GMThttp://www.tkk7.com/usherlight/archive/2009/09/04/293864.htmlhttp://www.tkk7.com/usherlight/comments/293864.htmlhttp://www.tkk7.com/usherlight/archive/2009/09/04/293864.html#Feedback2http://www.tkk7.com/usherlight/comments/commentRss/293864.htmlhttp://www.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")




]]>
主站蜘蛛池模板: 女性自慰aⅴ片高清免费| 男性gay黄免费网站| 色吊丝永久在线观看最新免费| 亚洲综合精品第一页| 成年人免费观看视频网站| 91情国产l精品国产亚洲区| 亚洲人成电影网站免费| 五月婷婷免费视频| 亚洲免费视频播放| 国产h视频在线观看免费| 特a级免费高清黄色片| 亚洲视频免费播放| 亚洲av中文无码| 黄页网站免费观看| 久久er国产精品免费观看8| 亚洲伊人久久大香线蕉结合| 国产亚洲大尺度无码无码专线| 99视频在线精品免费观看6| 美女无遮挡拍拍拍免费视频| 亚洲欧洲无码一区二区三区| 亚洲成人激情在线| 免费人成视频x8x8入口| 免免费国产AAAAA片| 中文字幕在线免费观看视频| 亚洲人成自拍网站在线观看| 久久亚洲AV无码精品色午夜麻| 亚洲av午夜成人片精品电影| 亚洲人成电影网站免费| 99re视频精品全部免费| 免费看黄网站在线看 | 99久久免费观看| sss在线观看免费高清| 亚洲国产欧美一区二区三区| 亚洲综合激情九月婷婷| 亚洲精品午夜国产VA久久成人| 日韩电影免费在线| 久久久久久久91精品免费观看| 最新国产乱人伦偷精品免费网站| 四虎精品成人免费视频| 日韩色视频一区二区三区亚洲| 亚洲综合激情五月色一区|