简体   繁体   English

MySQL登录指导? 春季启动安全性

[英]MySQL login Guidance? Spring boot security

Looking for some guidance on how to implement a login system. 寻找有关如何实施登录系统的指导。 So I'm currently using this project: https://www.codebyamir.com/blog/user-account-registration-with-spring-boot for my registration, since it comes with a lot by default. 因此,我目前正在使用此项目: https : //www.codebyamir.com/blog/user-account-registration-with-spring-boot进行注册,因为默认情况下它附带很多内容。 Got everything working fine, so next step is a login system. 一切正常,因此下一步是登录系统。

But my question is, what does "logging in" actually do to the MySQL db? 但是我的问题是,“登录”实际上对MySQL数据库有什么作用? I get the basic user+pass verification but I'm curious how it knows you are still logged in or how it persistently keeps you as the user you logged into? 我得到了基本的用户+通过验证,但是我很好奇它如何知道您仍在登录,或者它如何持续保持您作为登录用户的身份? Wouldn't this be something with cookies? 这不是饼干吗?

Regardless, I thought I'd try to implement this example: https://medium.com/@gustavo.ponce.ch/spring-boot-spring-mvc-spring-security-mysql-a5d8545d837d 无论如何,我认为我会尝试实现此示例: https : //medium.com/@gustavo.ponce.ch/spring-boot-spring-mvc-spring-security-mysql-a5d8545d837d

This confuses me. 这使我感到困惑。 Following the code it looks like you do a GET request to /login to see the login page, then on login.html it does a POST request to the /login, but on the controller /login is only set to map get requests? 遵循该代码,看起来您向/ login进行了GET请求以查看登录页面,然后在login.html上对/ login进行了POST请求,但是在控制器上/ login仅设置为映射get请求? Then somehow SecurityConfiguration.java does something to log you in? 然后,SecurityConfiguration.java如何以某种方式使您登录?

TL;DR: I've been looking around for a while and can't make sense of this? TL; DR:我已经看了一段时间,无法理解吗? Could someone please explain how logging in works or post some relevant tutorials how spring security works? 有人可以解释一下登录的工作原理,或者发布一些相关的教程来介绍Spring Security的工作原理吗? Any advice is greatly appreciated! 任何意见是极大的赞赏!

The spring samples are always a good place to start. 春季样品始终是一个很好的起点。 https://spring.io/guides/gs/securing-web/ https://spring.io/guides/gs/securing-web/

Although that doesn't include mysql. 虽然那不包括mysql。

You could try DZone they have good tutorials. 您可以尝试DZone他们有很好的教程。 eg https://dzone.com/articles/spring-security-4-authenticate-and-authorize-users 例如https://dzone.com/articles/spring-security-4-authenticate-and-authorize-users

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM