안녕하세요 스프링 시큐리티를 적용하는중에 궁금증이 생겨서 질문을 드리게 되었습니다~~ㅠ.ㅠ
security-context.xml 소스를 그대로 복사 첨부해보겠습니다.. 길더라도 한번 봐주시면 너무 감사하겠어요
<?xml version="1.0" encoding="EUC-KR"?>
<beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<beans:bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<beans:property name="jndiName" value="java:comp/env/jdbc/myora"/>
</beans:bean>
<http pattern="/**/*.js" security="none"/>
<http pattern="/**/*.css" security="none"/>
<http pattern="/images/*" security="none"/>
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/login" access="permitAll"/>
<intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')"/>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')"/>
<access-denied-handler error-page="/denied"/>
<form-login login-page="/login"
default-target-url="/index"
always-use-default-target="true"
/>
<logout invalidate-session="true"
logout-success-url="/login"/>
<session-management>
<concurrency-control max-sessions="1"/>
</session-management>
</http>
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select id as username, pw as password, enabled from securitytest where id=?"
authorities-by-username-query="select id as username, authority from securitytest where id=? "/>
</authentication-provider>
</authentication-manager>
</beans:beans>
이렇습니다..
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select id as username, pw as password, enabled from securitytest where id=?"
authorities-by-username-query="select id as username, authority from securitytest where id=? "/>
이부분에 쿼리가아니라 user-service, user태그로 권한과 아이디 비밀번호를 수동으로 직접 넣어주면
로그인이 잘되는데 저렇게하니까 왜 로그인이 안될까요..
가장 의문인점은 구글링해서 쿼리를 넣어서 DB에 연동하는 샘플 스터디자료들을 보니까
username과 password, enabled, authority로 as해서 쿼리결과를 내던데 이것은 스프링 시큐리티에서
인지하는 예약어로 통하기때문에 이렇게 하는건가요..?
이부분은 조금 궁금했던 부분이구요..
결론은 제가 왜 디비로 로그인이 안되는지 모르겠네요ㅠㅠ 다른문제는 없는것 같은데..