복붙노트

[SPRING] Spring 보안 지원되지 않는 구성 속성

SPRING

Spring 보안 지원되지 않는 구성 속성

나는 다음과 같은 발췌 문장을 가지고있다.

<http use-expressions="true" auto-config="false"
        entry-point-ref="loginUrlAuthenticationEntryPoint"
        access-decision-manager-ref="accessDecisionManager" disable-url-rewriting="false">
        <!--<custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter"
            /> -->
        <custom-filter position="FORM_LOGIN_FILTER"
            ref="usernamePasswordAuthenticationFilter" />
        <custom-filter position="LOGOUT_FILTER" ref="tapLockFilter" />

        <intercept-url pattern="/session/**" access="permitAll" />
        <intercept-url pattern="/deviceregistration/**" access="permitAll" />
        <intercept-url pattern="/session/lock" access="hasRole('ROLE_MEMBER')" />
        <intercept-url pattern="/app/resources/admin*" access="hasRole('ROLE_ADMIN')" />
        <intercept-url pattern="/app/SuperAppdashboard*" access="hasRole('ROLE_ADMIN')" />
        <intercept-url pattern="/app/*" access="hasRole('ROLE_MEMBER')" />


        <!--<session-management invalid-session-url="/tizelytics/session/invalidSession"
            session-authentication-error-url="/tizelytics/session/accessDenied" session-authentication-strategy-ref="sas">
            </session-management> -->

        <session-management invalid-session-url="/session/invalidSession"
            session-authentication-error-url="/session/accessDenied"
            session-fixation-protection="none">
            <concurrency-control max-sessions="1"
                expired-url="/session/accessExpired" />
        </session-management>
</http>

내가 서버에서 실행할 때 예외를 던집니다.

다음은 동일한 xml 내의 내 액세스 의사 결정 관리자 bean입니다.

<beans:bean id="accessDecisionManager"
        class="org.springframework.security.access.vote.AffirmativeBased">
        <beans:constructor-arg>
            <beans:list>
                <beans:bean
                    class="org.springframework.security.access.vote.AuthenticatedVoter" />
                <beans:bean class="org.springframework.security.access.vote.RoleVoter" />
            </beans:list>
        </beans:constructor-arg>
</beans:bean>

access-decision-manager-ref를 제거해도 아무런 예외도 발생하지 않습니다. 아무도 조언을 부탁 할 수 있습니까?

해결법

  1. ==============================

    1.고유 한 accessDecisionManager를 정의하고 있으므로 WebExpressionVoter가 해당 목록의 빈 중 하나로 표시되지 않습니다. WebExpressionVoter는 permitAll (), hasRole (), hasAuthority () 등의 문자열을 확인합니다. 따라서 accessDecisionManager bean은 다음과 같아야합니다.

    고유 한 accessDecisionManager를 정의하고 있으므로 WebExpressionVoter가 해당 목록의 빈 중 하나로 표시되지 않습니다. WebExpressionVoter는 permitAll (), hasRole (), hasAuthority () 등의 문자열을 확인합니다. 따라서 accessDecisionManager bean은 다음과 같아야합니다.

    <beans:bean id="accessDecisionManager"
            class="org.springframework.security.access.vote.AffirmativeBased">
            <beans:constructor-arg>
                <beans:list>
                    <beans:bean
                        class="org.springframework.security.access.vote.AuthenticatedVoter" />
                    <beans:bean class="org.springframework.security.access.vote.RoleVoter" />
                    <beans:bean class="org.springframework.security.web.access.expression.WebExpressionVoter" />
                </beans:list>
            </beans:constructor-arg>
    </beans:bean>
    
  2. from https://stackoverflow.com/questions/31100558/spring-security-unsupported-configuration-attributes by cc-by-sa and MIT license