How to setup JDBC authentication with Spring Security from scratch - Java Brains

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024

ความคิดเห็น • 143

  • @najisolayman
    @najisolayman ปีที่แล้ว +11

    I recently watched your playlist on Spring Security, and I must say, it was one of the best educational resources I've come across on the topic. Your explanations were clear, concise, and easy to understand, and I appreciated the way you broke down the concepts into bite-sized pieces.
    I just wanted to take a moment to thank you for creating such an informative and well-structured playlist. It's evident that you put a lot of time and effort into producing these videos, and it's greatly appreciated. Keep up the fantastic work!

  • @sivanov23
    @sivanov23 3 หลายเดือนก่อน +2

    Great tutorial, with it and the use of Chat GPT I was able to generate and run the app you created on Spring Boot 3.3.0. There, we don't extend the WebSecurityConfigurerAdapter, but rather add each configuration as a separate Bean to make it available for the Spring container to recognize and include in the app.

  • @piters101
    @piters101 5 ปีที่แล้ว +52

    It will be great if you will talk about authentication using jwt for rest, and oauth

  • @apoorvnigam2282
    @apoorvnigam2282 5 ปีที่แล้ว +3

    Yes , we always wait for Koushik's video..... Thanks for your wonderful teaching

  • @bekirus1
    @bekirus1 3 ปีที่แล้ว

    One of the best java teachers on world wide web :) Your explantations are easy to understand ! Awesome!

  • @togax5
    @togax5 3 ปีที่แล้ว +1

    Thank you so much for these amazing tutorials. You are one of my favorite teachers!

  • @narimo2773
    @narimo2773 5 ปีที่แล้ว +27

    Why in the configuration we have roles `ADMIN` & `USER`.
    However, in `data.sql` we have `ROLE_USER` & `ROLE_ADMIN`?
    And everything keeps working fine.

    • @andrei-un3yr
      @andrei-un3yr 4 ปีที่แล้ว +14

      It's because spring adds a "ROLE_" prefix to the role you specify in configuration
      stackoverflow.com/questions/33205236/spring-security-added-prefix-role-to-all-roles-name

    • @rizkyjayusman9567
      @rizkyjayusman9567 4 ปีที่แล้ว

      @@andrei-un3yr could i customize a default role's prefix?

    • @arunkumarjaiswal4562
      @arunkumarjaiswal4562 4 ปีที่แล้ว

      @@andrei-un3yr thankyou

    • @arunkumarjaiswal4562
      @arunkumarjaiswal4562 4 ปีที่แล้ว +4

      good question , I was also confused

    • @aneckumar5701
      @aneckumar5701 3 ปีที่แล้ว

      so since spring adds ROLE as prefix so we add in database with field as ROLE_USER etc , however we check without prefix?

  • @ebenjs228
    @ebenjs228 2 ปีที่แล้ว +1

    Simple, clean and concise.

  • @maheshdhavalshankh5974
    @maheshdhavalshankh5974 4 ปีที่แล้ว

    You explain very well sir!!!
    Thanks for being on TH-cam 🙏🏻🙏🏻🙏🏻

  • @seanduignan294
    @seanduignan294 5 ปีที่แล้ว +10

    Hi Koushik, by any chance could you do a mini tutorial on integrating Spring Boot, Spring Security and Angular 7+ with typical real-world login, logout authentication flows and maybe some commentary about session\cookie management between the front-end and back-end?

    • @mycasper9000
      @mycasper9000 5 ปีที่แล้ว +1

      That will be super amazing !

  • @indranilgoswami1500
    @indranilgoswami1500 4 ปีที่แล้ว

    Thanks Kuashik sir ..You are outstanding Teacher .. Thanks a lot .

  • @gigel008
    @gigel008 5 ปีที่แล้ว +3

    Hello Koushik. Maybe you already planned this, but could you show us how to get rid of the default html templates that spring security provides? Especially if you're building a rest service and don't want to use html at all.

  • @jackbenimble999
    @jackbenimble999 5 หลายเดือนก่อน

    Great videos so far!

  • @gormatikyan9663
    @gormatikyan9663 4 ปีที่แล้ว +2

    it is a very good tutorial but I have 2 questions.
    1)In my example there is no difference between lowercase and uppercase for username
    2)and there is authentication for url localhost:8080/user but there is not needed authentication for url localhost:8080/user/

  • @thannasip8001
    @thannasip8001 4 ปีที่แล้ว +2

    "Role means group of authorities" this is what I understood from your previous one,but here authorities table holds roles(admin, user) so authority means role right?

  • @lewispil3529
    @lewispil3529 2 ปีที่แล้ว

    thanks for the video, i'm watching video by video, well explained 🤗

  • @ChristianAltamiranoAyala
    @ChristianAltamiranoAyala 5 ปีที่แล้ว

    Great video Koushik greetings from peru.

  • @Daxbedivlogs
    @Daxbedivlogs 4 ปีที่แล้ว +1

    can any of u help me resolve this error ??
    Field dataSource in com.bedi.springsecurityjdbch2.SecurityConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
    The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)
    The following candidates were found but could not be injected:
    - Bean method 'dataSource' in 'JndiDataSourceAutoConfiguration' not loaded because @ConditionalOnClass did not find required class 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
    - Bean method 'dataSource' in 'XADataSourceAutoConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager'
    Action:
    Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.

  • @tirupatirao7521
    @tirupatirao7521 ปีที่แล้ว

    By default jdbc implementation will have h2 data source implemented/initialised?

  • @shridharhmujumdar3568
    @shridharhmujumdar3568 ปีที่แล้ว

    Hi Koushik Sir.. Why are you able to access the "/" api without any authentication ? Ideally, permitAll() shud permit all the authenticated users, but what i see is it is permitting everyone without any authentication.. please explain

  • @Alessandro281991
    @Alessandro281991 ปีที่แล้ว

    How can i do it without a formlogin? I need to expose only a login api without a form login .

  • @SuperWhatusername
    @SuperWhatusername ปีที่แล้ว

    Thank you for this tutorial

  • @varuntandon4465
    @varuntandon4465 2 ปีที่แล้ว

    @Java Brains, why do we need to insert roles in authorities table like "ROLE_USER" or "ROLE_ADMIN", why can't we store it like "USER" and "ADMIN"?

  • @ambersingh1493
    @ambersingh1493 3 ปีที่แล้ว

    How can we check the h2-console and what will be the default url and credentials if we want to see the tables practically in h2-db?

  • @JeisonOliveira1986
    @JeisonOliveira1986 5 ปีที่แล้ว +1

    Nice video, I just think it isn't good the default way that spring security create the tables. Using the column name with the same value is not good, should use Id to do that

  • @cedhyuga91
    @cedhyuga91 2 ปีที่แล้ว

    Thank you so muuuch !!! You the best !!

  • @content_Tube74
    @content_Tube74 2 ปีที่แล้ว

    hello how can i solve this? Parameter 0 of constructor in com.spring.security.SecurityConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.

  • @umeshchoubey
    @umeshchoubey 5 ปีที่แล้ว

    It's really great vedio. Can you upload video recording microservice transaction management

  • @deryamilas2593
    @deryamilas2593 2 ปีที่แล้ว

    how can i get user's username without hard coding it in config method?

  • @yatri6329
    @yatri6329 3 ปีที่แล้ว

    Can we see in the h2 dabase those created table

  • @mostafaalsabagh1660
    @mostafaalsabagh1660 4 ปีที่แล้ว

    thank you so much , great work

  • @mamoonalshamali8922
    @mamoonalshamali8922 2 ปีที่แล้ว

    thank you very much

  • @thomassun3046
    @thomassun3046 4 ปีที่แล้ว +1

    one question here: why that place is ROLE_USER, ROLE_ADMIN, instead of USER,ADMIN,it is straightforwad!

    • @arunkumarjaiswal4562
      @arunkumarjaiswal4562 4 ปีที่แล้ว

      It's because spring adds a "ROLE_" prefix to the role you specify in configuration
      stackoverflow.com/questions/33205236/spring-security-added-prefix-role-to-all-roles-name

  • @amanrai8010
    @amanrai8010 3 ปีที่แล้ว

    The Saviour of Century Kuashik

  • @biswajitmondal7807
    @biswajitmondal7807 4 ปีที่แล้ว

    Hi kaushik thanks for this tutorial.I have one question is it possible to Change the query fields...like we querying on username,enabled,authority...if i want to make my custom login using email,password only?

  • @tomknud
    @tomknud 2 ปีที่แล้ว

    Neat video, thanks

  • @parvezahmed5287
    @parvezahmed5287 ปีที่แล้ว

    after ruuning this app the server stoped beacusw there is no bean found for datasource but why i have let spring to use defaultschema but still it show
    Field dataSource in security.jdbc.SecurityConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
    why this error?? will i make a bean for datasource

    • @olo1045
      @olo1045 ปีที่แล้ว +1

      I had the same problem, for me the solution was to add in application.properties the following lines:
      spring.datasource.url=jdbc:h2:mem:testdb
      spring.datasource.driverClassName=org.h2.Driver
      spring.datasource.username=sa
      spring.datasource.password=
      spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
      spring.h2.console.enabled=true
      spring.h2.console.path=/h2
      and also in the pom.xml file add
      com.h2database
      h2
      1.4.200
      compile
      Without it wouldnt want to initiate the h2 driver xD

  • @ajaydhiman2368
    @ajaydhiman2368 3 ปีที่แล้ว

    how we will pass userid in this method to configure() ?

  • @SagirAnsari-bn7oj
    @SagirAnsari-bn7oj 5 ปีที่แล้ว

    Super make it weekend while see notification bell...

    • @SagirAnsari-bn7oj
      @SagirAnsari-bn7oj 5 ปีที่แล้ว

      @revking
      You can simply create a data.sql file in your src/main/resources folder and it will be automatically executed on startup. In this file you just add some insert statements,...Similarly, you can create a schema.sql file (or schema-h2.sql) as well to create your schema

    • @SagirAnsari-bn7oj
      @SagirAnsari-bn7oj 5 ปีที่แล้ว

      @revking Yup

  • @snowdenfu
    @snowdenfu 4 ปีที่แล้ว

    thanks so much about security with database, but do u have code samples for this?

  • @runindiatraveller6634
    @runindiatraveller6634 ปีที่แล้ว

    Hi sir this was wonderful tutorial,but i don't know why but my antmatcher is not working it is throwing error ,idk
    is it because i am using java se 17

  • @nithinvarghese7765
    @nithinvarghese7765 5 ปีที่แล้ว

    Wow..superb

  • @thomassun3046
    @thomassun3046 4 ปีที่แล้ว +3

    IDEA shows me that:No data sources are configured to run this SQL

    • @sourabhsharma6113
      @sourabhsharma6113 3 ปีที่แล้ว

      You might have missed to add "JDBC API" dependency.
      Or if you're referring to the other case where "Spring Boot" configuration of IDE is failing to start the application, I am also facing the same. Please let know if you're able to find the solution to it.
      Though, the application runs fine from command line with the mvn cli - mvn spring-boot:run

  • @Emanuel-kl2dt
    @Emanuel-kl2dt 4 ปีที่แล้ว

    For my first app, would you recommend to use the jdbc approach shown in this video or to use JPA?

    • @MI982
      @MI982 4 ปีที่แล้ว

      For your first app whatever you now how to implement is perfect. If you think you can use JPA - go for it!

  • @ek19751
    @ek19751 5 ปีที่แล้ว

    @Java Brains, do you have a video explaining OOP concepts in Java with examples? This is one subject that's hard to get some solid examples

    • @Java.Brains
      @Java.Brains  5 ปีที่แล้ว +2

      No OOP videos yet. I'll add that to the list :)

    • @ek19751
      @ek19751 5 ปีที่แล้ว +2

      @@Java.Brains Thank you again. Normally I'd find inheritance or polymorphism explained using an 'Animal' class, but I'd also like to see examples of stuff that I do on a daily basis. Input data could be from a database, webservice or flat file - I could create an interface and implement it, and then bring polymorphism into play... stuff like that. Thank you again!

  • @SamChaneyProductions
    @SamChaneyProductions 4 ปีที่แล้ว

    Thanks for this tutorial. Mine is almost working but for some reason it only displays "Welcome" regardless of which user I login as. It never displays the "Welcome User" or "Welcome Admin" strings we defined in HomeResource.

    • @kamalale7976
      @kamalale7976 4 ปีที่แล้ว

      i also got the same issue :S

  • @jackbenimble999
    @jackbenimble999 5 หลายเดือนก่อน

    Any code base?

  • @ajaydhiman2368
    @ajaydhiman2368 5 ปีที่แล้ว

    how to pass value for '?' in this example

  • @coffecoding
    @coffecoding 4 ปีที่แล้ว

    I am getting an error for DataSource
    Action:
    Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.

    • @coffecoding
      @coffecoding 4 ปีที่แล้ว

      Oh god It was my bad, I forgot to add the jdbc-api, anyway I understood why it is added.

    • @Daxbedivlogs
      @Daxbedivlogs 4 ปีที่แล้ว

      i have same error
      Field dataSource in com.bedi.springsecurityjdbch2.SecurityConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.
      The injection point has the following annotations:
      - @org.springframework.beans.factory.annotation.Autowired(required=true)
      The following candidates were found but could not be injected:
      - Bean method 'dataSource' in 'JndiDataSourceAutoConfiguration' not loaded because @ConditionalOnClass did not find required class 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
      - Bean method 'dataSource' in 'XADataSourceAutoConfiguration' not loaded because @ConditionalOnClass did not find required class 'javax.transaction.TransactionManager'
      Action:
      Consider revisiting the entries above or defining a bean of type 'javax.sql.DataSource' in your configuration.

  • @kulashaker30
    @kulashaker30 3 ปีที่แล้ว

    Who the hell are these 20 haters that didn't like this in detail approach of Spring Security authentication via JDBC?????

  • @kose25
    @kose25 4 ปีที่แล้ว

    You really helped me, thank you

  • @myharsh271
    @myharsh271 4 ปีที่แล้ว

    u didnt specified the github link for code

  • @andrelong7230
    @andrelong7230 7 หลายเดือนก่อน

    Where is your source code?

  • @anil2009
    @anil2009 4 ปีที่แล้ว

    please upload password hashing videos sir🙏🙏🙏🙏

  • @digitopotato1653
    @digitopotato1653 4 ปีที่แล้ว +1

    tutorial is great but the theme is dark im having hard time to view clearly

  • @Pyta321
    @Pyta321 4 ปีที่แล้ว

  • @AbhishekAnandDas
    @AbhishekAnandDas ปีที่แล้ว +3

    WebSecurityConfigurerAdapter has been deprecated in latest version of spring security. Can you make a video on latest version?

  • @waheedkhan5337
    @waheedkhan5337 5 ปีที่แล้ว +4

    Hi Koushik, by any chance could you do a mini tutorial on integrating Spring Boot, Spring Security and Angular 7+ with typical real-world login, logout authentication flows and maybe some commentary about session\cookie management between the front-end and back-end?

    • @gautamtyagi8846
      @gautamtyagi8846 4 ปีที่แล้ว

      @waheed khan try this url, I found this helpful.
      www.javainuse.com/spring/ang7-jwt

  • @kumarsaroj18
    @kumarsaroj18 4 ปีที่แล้ว +18

    Well, the tutorial is very clear and explained with very simple examples which make even complicated concepts very easy to grasp. However, you didn't mention/explained following 2 things:
    1. schema.sql and data.sql are standard file names, and are automatically picked by springboot from resources folder.
    2. From above two sql files, we can get our custom schema (instead of default one). You kept the table and column name same as present in the default schema. So table and columns with different name are allowed ?
    a. If not allowed, why did you mention that we can create our own schema?
    b. If allowed, how do we tell springboot, which column to look into for username and which column for password, and same
    goes to authorities/roles as well.

    • @tanko.spirit7754
      @tanko.spirit7754 4 ปีที่แล้ว +5

      he actually explained to you that you can use a custom schema and later on clarified that you would
      specify the columns/table name etc. in the.usersByUsernameQuery() and .authoritiesByUsernameQuery() queries!
      and i suppose the column names have to be "username", "password", "authority" and "enabled"..
      if your custom schema has different names for these columns, lets say, instead of "password" you have "pass", then all you would do in the query is:
      "select username, pass as 'password', ...."
      etc. i.e. using aliases
      if you don't know about it, check this out: www.w3schools.com/sql/sql_alias.asp

    • @biswajitmondal7807
      @biswajitmondal7807 4 ปีที่แล้ว

      @@tanko.spirit7754 is it mandatory to keep the fields authority,username password...if i want to change it to email column and password column and also delete the authority and enabled columns then?

  • @stevegathara8885
    @stevegathara8885 ปีที่แล้ว +1

    Do you have a tutorial for this specific using the latest spring security documentation? i.e using version 3.1 and above

  • @sparaseth
    @sparaseth 4 ปีที่แล้ว +4

    Thanks Koushik!
    Just wanted to know, how the username parameter being passed to the select query and the password equality being checked?

    • @mikecmw8492
      @mikecmw8492 3 ปีที่แล้ว

      Yes! How do you actually use this code?

  • @vihangakanchana1211
    @vihangakanchana1211 3 ปีที่แล้ว +1

    Hi,
    Usually SecurityConfiguration we are doing like
    .antMatchers("/api/public/test1").hasAuthority("ACCESS_TEST1")
    .antMatchers("/api/public/test2").hasAuthority("ACCESS_TEST2")
    But I want to get this endpoints and required authority to property file or DB.
    can I do it? and how can I do it?

  • @anshumandas1062
    @anshumandas1062 5 ปีที่แล้ว +2

    Please create the next video on Spring Boot jwt JPA authentication

  • @MrNSundar
    @MrNSundar 5 ปีที่แล้ว +3

    Thank you..it would be great if you can come up with a tutorial for ldap authentication.

  • @rajendrakumarsahoo5479
    @rajendrakumarsahoo5479 4 ปีที่แล้ว +2

    First of all tons of thanks for these wonderful tutorials.But is it mandatory to have user and authority table relation as per spring boot standard ?

  • @PramodKumar-hu7mt
    @PramodKumar-hu7mt 4 ปีที่แล้ว +2

    Please do tutorials on Docker and Kubernetes

  • @PerpetualLearner8934
    @PerpetualLearner8934 3 ปีที่แล้ว +1

    User Schema :
    create table users(
    username varchar_ignorecase(50) not null primary key,
    password varchar_ignorecase(500) not null,
    enabled boolean not null
    );
    create table authorities (
    username varchar_ignorecase(50) not null,
    authority varchar_ignorecase(50) not null,
    constraint fk_authorities_users foreign key(username) references users(username)
    );
    create unique index ix_auth_username on authorities (username,authority);

  • @merajsyed6987
    @merajsyed6987 2 หลายเดือนก่อน

    Sir could you please make a series on migrating spring security code to latest spring boot. As a lot of things have been updated in the latest spring security. Same code will break with latest spring boot.

  • @CaracalServal
    @CaracalServal 5 ปีที่แล้ว +2

    This series is awesome!

  • @arsalalam5998
    @arsalalam5998 ปีที่แล้ว

    the authority has string 'ROLE_USER' but in configure method we say 'USER' . Did not get that ?

  • @ek19751
    @ek19751 5 ปีที่แล้ว +2

    I would second the request for LDAP - a real quick one at least if you could please. Thanks again Koushik

    • @Java.Brains
      @Java.Brains  5 ปีที่แล้ว +2

      LDAP video coming after the JPA one that I'm working on

    • @ek19751
      @ek19751 5 ปีที่แล้ว +1

      @@Java.Brains Thank you so much Koushik! The quality of your lessons is of a different caliber than what I'd generally find on the internet, so that's why :-)

    • @seanduignan294
      @seanduignan294 5 ปีที่แล้ว

      @@Java.Brains Yes please :)

  • @theotp3505
    @theotp3505 หลายเดือนก่อน

    when will you provide video on spring security 6

  • @friendaanil
    @friendaanil 5 ปีที่แล้ว +3

    amazing content everytime

    • @YouTuber-lb9ot
      @YouTuber-lb9ot 4 ปีที่แล้ว

      hope you have gone through each of them..

  • @francogb
    @francogb 5 ปีที่แล้ว +1

    Thank you, but would be great if you can explain the usage with JWT. Keep it up!

  • @adityamaurya8092
    @adityamaurya8092 3 ปีที่แล้ว

    In query why there is no matching of pass word

  • @monsterhuntergo
    @monsterhuntergo 2 ปีที่แล้ว

    small caps on my data.sql worked for me. I think should be case sensitive though im using Spring Tool Suite 4 as IDE:
    insert into users (username, password, enabled)
    values ('user', 'pass', true);
    insert into users (username, password, enabled)
    values ('admin', 'pass', true);
    insert into authorities (username, authority)
    values ('user', 'ROLE_USER');
    insert into authorities (username, authority)
    values ('admin', 'ROLE_ADMIN');

  • @sandeeptengale7021
    @sandeeptengale7021 5 ปีที่แล้ว +1

    Thank you sir, one question in data.sql, the roles are ROLE_USER and ROLE_ADMIN. But in authorization antMatchers() it is just USER and ADMIN. How mapping is done here?

  • @shabarishkumarelluru6214
    @shabarishkumarelluru6214 4 ปีที่แล้ว

    Hi Koushik, I have one doubt. Is it possible to give permit all access to the post method?
    I am trying as shown below
    protected void configure(HttpSecurity http) throws Exception {
    http
    .authorizeRequests()
    .antMatchers("/CreateOrder","/").hasRole("admin")
    .antMatchers("/getOrderById").hasAnyRole("clerk","admin","supervisor")
    .antMatchers("/createMyUser","/getMyUserByID","/",
    "/getAllOrders","/*").permitAll()
    .and().formLogin();// @formatter:off

    // @formatter:on
    // more lines
    }
    here createMyUser is a post method,as shown below
    @RequestMapping(value = "/createMyUser", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
    public MyUser createMyUser(MyUser MyUser) throws Exception {
    MyUserRepository.save(MyUser);
    return MyUser;
    }
    Its working fie for getMethods, but not for post Methods. Please help me to clarify this query. Thanks!

  • @gpr1983
    @gpr1983 3 ปีที่แล้ว

    is anybody getting the below? I tried the same as in the video, not getting how to fix the error.
    PreparedStatementCallback; SQL [select username, authority from authorities where username = ?]; Invalid value "3" for parameter "columnIndex" [90008-200]; nested exception is org.h2.jdbc.JdbcSQLDataException

  • @amsfuy
    @amsfuy 4 ปีที่แล้ว

    I always get the error: "Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "USERS" already exists; SQL statement" when starting the application.
    Does anybody know why or how to solve it?

    • @amsfuy
      @amsfuy 4 ปีที่แล้ว

      I was able to solve it the following way:
      User only a data.sql which contains the schema and data. Before creating the tables, I preprended the statements
      DROP TABLE IF EXISTS AUTHORITIES;
      DROP TABLE IF EXISTS USERS;
      In my application.properties file I added the lines
      spring.datasource.url=jdbc:h2:mem:testdb
      spring.datasource.driverClassName=org.h2.Driver
      spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
      Maybe that helps anyone having the same problem (maybe my future self?!).

  • @piyushbhatnagar2543
    @piyushbhatnagar2543 3 ปีที่แล้ว

    Thanks for the above video. In my scenario I want to change the user roles based on the kind of data user is checking. The user has a search bar from which he can search different data. In that case are these queries dynamic in changing roles everytime? Or should I follow someother approach towards above problem

  • @kunaldas9284
    @kunaldas9284 3 ปีที่แล้ว

    @Kaushik - I have a question after going through this video.
    Is it possible that we could have different external databases, one which stores the authentication and authorisation data and other one which stores the business/application data.
    If it is possible, then how can we configure these two different datasources to be used separately by spring security and our business logic.

  • @bhabanishankarjena9990
    @bhabanishankarjena9990 4 ปีที่แล้ว

    Nice video , jdbc authentication program has not included in git hub. Would you please add that.

  • @DevPlayGame
    @DevPlayGame 2 ปีที่แล้ว

    How to use Security without Spring boot? Thanks.

    • @sug_madic7683
      @sug_madic7683 2 ปีที่แล้ว

      use spring for security and use nodejs for mvc simple as that you ass

  • @ajaydhiman2368
    @ajaydhiman2368 5 ปีที่แล้ว

    How we can use our own form instead of default one because if we need to modify then we can't do in this case

  • @108vicky
    @108vicky 5 ปีที่แล้ว

    Nice.. please make vdo on spring spring oauth2 with jwt token

  • @bunthaideng2492
    @bunthaideng2492 5 ปีที่แล้ว

    Hello sir, I really appreciate with your tutorials.
    I have 2 questions.
    1) what if I add and().httpBasic()? What does it mean here?
    2) if user has different table, what is this design called?

  • @sreyasaha151
    @sreyasaha151 5 ปีที่แล้ว

    please upload videos spring security using oAuth2 ,okta,ldap etc.

  • @hyperborean72
    @hyperborean72 3 ปีที่แล้ว

    rather complicate still amazing tutorial

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 3 ปีที่แล้ว

    Thank You.. Well Explained..

  • @ilhamAhmedzada
    @ilhamAhmedzada 4 ปีที่แล้ว

    thanks for all videos ,they are really gereat (y)

  • @bhabanishankarjena9990
    @bhabanishankarjena9990 4 ปีที่แล้ว

    data.sql ,how getting stored to DB.

  • @OlexiyNas
    @OlexiyNas 2 ปีที่แล้ว

    Greate video, thanks!

  • @birdofhermes6152
    @birdofhermes6152 3 ปีที่แล้ว

    Thanks a lot for the video

  • @user-0987-a
    @user-0987-a 3 ปีที่แล้ว

    Can someone help me I am stuck with below error;
    Referential integrity constraint violation: "FK_AUTHORITIES_USERS: PUBLIC.AUTHORITIES FOREIGN KEY(USERNAME) REFERENCES PUBLIC.USERS(USERNAME) (CAST('user' AS VARCHAR_IGNORECASE))"; SQL statement:
    INSERT INTO authorities (username, authority) values ('user', 'ROLE_USER') [23506-200]

  • @henrymart6102
    @henrymart6102 2 ปีที่แล้ว

    Hello. Instead of creating new project in SpringBoot, I've just tried include in previous project Dependency "h2" (did synchro and update), and the program did not accepted expression ".dataSource(dataSource)" Why so? and how to correct it?

    • @henrymart6102
      @henrymart6102 2 ปีที่แล้ว

      Ok. fixed by replacing "import javax.activation.DataSource;" with "import javax.sql.DataSource;" , but received another problem with table creation: "You have an error in your SQL syntax" (on video it is 11:30 launch)

  • @mediss3720
    @mediss3720 4 ปีที่แล้ว

    Very nice tutorial

  • @HimanshuSingh2009
    @HimanshuSingh2009 4 ปีที่แล้ว

    Getting error : Field dataSource in com.security.jdbc.SecurityConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.

    • @balaifarara
      @balaifarara 4 ปีที่แล้ว

      At pom.xml check if scope of h2database is runtime or not

  • @okwuchukwuokwara1522
    @okwuchukwuokwara1522 2 ปีที่แล้ว

    Great tutorials

  • @varunraj1862
    @varunraj1862 3 ปีที่แล้ว

    In data.sql role is having prefix as Role_User but in Authorize method of Configure role used is only user.
    How is it getting matched to be authorised.
    Kindly clarify.

    • @1309CV
      @1309CV 3 ปีที่แล้ว +1

      Hi varun raj,
      Spring Security expects you to specify roles as "ROLE_", where "" can be: ' ADMIN', 'USER', etc.
      The reason you don't explicitly have to do this when manually creating (and configuring) users with the #roles(), #hasRoles(), #hasAnyRole(), etc methods, is because Spring Security is 'smart' enough to do this for you.
      The method #hasRole() calls an underlying method:
      public ExpressionInterceptUrlRegistry hasRole(String role) {
      return access(ExpressionUrlAuthorizationConfigurer.hasRole(role));
      }
      The call to "hasRole(role)" checks if the String role starts with "ROLE_".
      private static String hasRole(String role) {
      Assert.notNull(role, "role cannot be null");
      Assert.isTrue(!role.startsWith("ROLE_"),
      () -> "role should not start with 'ROLE_' since it is automatically inserted. Got '" + role + "'");
      return "hasRole('ROLE_" + role + "')";
      }
      If it doesn't, it just returns the String with that "ROLE_" prefix. This way, Spring Security can continue to do its job.
      However, when creating users through schema (.sql) files, this type of behavior is not supported. I'm not 100% sure what methods are called instead.
      The other 'role' type methods have similar characteristics, in that they call to check if the role starts with "ROLE_". They do this differently in their own respective ways.
      Hopefully, this helped answer your question.
      Cheers,
      Ares.

    • @varunraj1862
      @varunraj1862 3 ปีที่แล้ว

      @@1309CV Thanks for your detailed explanation.