Forum

Spring Security basic authentication  

  RSS

vijay2344
New Member
Joined:1 year  ago
Posts: 1
25/10/2017 10:52 pm  

Having trouble adding basic spring security using JDBC or hibernate, below is the code sample which is using hard coded username and password but I want to authenticate by database users :

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xsi:schemaLocation="
         http://www.springframework.org/schema/security  
         http://www.springframework.org/schema/security/spring-security-3.1.xsd 
         http://www.springframework.org/schema/beans  
         http://www.springframework.org/schema/beans/spring-beans-3.2.xs d">
 
    <http pattern="/home" security="none"/>
    <http use-expressions="true">
        <intercept-url pattern="/**" access="isAuthenticated()" />
        <http-basic />
    </http>
 
    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="admin" password="admin" authorities="ROLE_USER" />
            </user-service>
        </authentication-provider>
    </authentication-manager>
 
</beans:beans>

 

Can you provide some example on it.

 

Thanks


ReplyQuote
admin
Member Admin
Joined:2 years  ago
Posts: 7
25/10/2017 10:56 pm  

Hi,

I would suggest to go through this tutorial which will provide you the details :

https://www.ashtpoint.com/spring-security-tutorial/spring-security-role-based-custom-user-authentication-example.html


ReplyQuote
  
Working

Please Login or Register