Solution Review: Use Form-based Authentication With PrimeFaces
Learn how to implement form-based authentication with PrimeFaces in this challenge.
We'll cover the following...
We'll cover the following...
package be.rubus.workshop.security.challenge2.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "users")
public class User {
@Id
@Column(length = 64)
private String name;
@Column
private String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
User user = (User) o;
return name.equals(user.name);
}
@Override
public int hashCode() {
return name.hashCode();
}
}
Solution: Use form-based authentication with PrimeFaces
Enter the username and password educative/educative in the browser popup.
Explanation
ApplicationConfiguration.java
-
Lines 8–11: We define the ...