课程: Hands-On Introduction: Java
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Create Authenticator
- [Instructor] When building real world applications, security should be a major concern. For our project, the bank accounts should be secured by a username and password. This information is stored in the customer's table of our database. Normally, passwords are encrypted and not stored in plain text but since this is a toy application, we are okay. Just remember not to store your user's passwords like this when building real world apps. Okay, let's create a method to authenticate the user before allowing them access to any customer data. First, we'll need to create a new class under the bank package. So let's click the plus sign here and we'll name this class authenticator. Inside of this class, let's create two methods: login and logout. The login method needs to accept the username and the password for a giving customer and then return a customer object representing that user. So let's say public static customer…