SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 112 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"


Chapter 4
[ 87 ]
package com.packtpub.celebrities.model;
public class User
{
private String firstName;
private String lastName;
public User()
{
}
public User(String firstName, String lastName)
{
this.setFirstName(firstName);
this.setLastName(lastName);
}
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
}
package com.packtpub.celebrities.util;
import com.packtpub.celebrities.model.User;
public class Security
{
private static final String USERNAME = "user";
private static final String PASSWORD = "secret";
public static User authenticate(String userName,
String password)
{
Simple Components
[ 88 ]
if (USERNAME.equals(userName) && PASSWORD.equals(password))
{
return new User("John", "Smith");
}
return null;
}
}
You can see that the Security class has a single version for both username and
password hard-coded into it. Normally, these two would be retrieved from some
kind of storage, and perhaps in an encrypted form. For now, however, the username
and password submitted by the user are compared to the fixed values, "user" and
"secret".


Pages:
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6