달력

10

« 2017/10 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
  •  
  •  

'Security'에 해당되는 글 1

  1. 2011.07.12 spring security + sitemesh 적용시 filter 순위
2011.07.12 15:35

spring security + sitemesh 적용시 filter 순위 Tips2011.07.12 15:35

spring security + sitemesh 적용시 filter 순위에 따라, security tag가 먹힐수도 아닐수도 있다.

아래와 같이 하면 보통 문제 없다. security filter가 먼저 나오면 된다.

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
    </filter>    
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>        
    <filter>
        <filter-name>CharacterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CharacterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>   



layout 예시는 아래와 같이....

<spring:url value="/static/j_spring_security_logout?spring-security-redirect=/xxxx_login" var="logout"/>
<div id="head">
<h1><img src="<spring:url value="/resources"/>/images/admin/logo.gif" /></h1>
<div class="toputil">
<p><b><sec:authorize access="hasRole('ROLE_ADMIN')">+</sec:authorize><sec:authentication property="principal.username"/></b>님 접속하셨습니다.</p>
<ul>
<li class="fir"><a href="${logout}">로그아웃</a></li>
</ul>
</div>

 
신고
Posted by summerwars


티스토리 툴바