카테고리 없음

security-context.xml

별초롱언니 2025. 6. 12. 19:50
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans
	xmlns="http://www.springframework.org/schema/security"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/security
 http://www.springframework.org/schema/security/spring-security.xsd">
	<!-- Root Context: defines shared resources visible to all other web components -->
	
	
	<http use-expressions="true">
       <intercept-url pattern="/books/add" access="hasAuthority('ROLE_ADMIN')" />
       <form-login login-page="/login"
       			   default-target-url="/books/add"
       			   authentication-failure-url="/loginfailed"
       			   username-parameter="username"
       			   password-parameter="password" />
       <csrf />
       <logout logout-success-url="/logout"/>
    </http>
    
    
    <authentication-manager>
    	<authentication-provider>
        	<user-service>
        		<user name="admin"  password="{noop}1234" authorities="ROLE_ADMIN"/> 
        	 </user-service>
    	</authentication-provider>
	</authentication-manager>

</beans:beans>