Setting up a custom principal

We have created our own custom principal class by implementing the java.security.Principal interface. It's a very simple class in which we take in the username through a constructor and then use that to return in the getName method:

public class JaasPrincipal implements Principal, Serializable {
private String username;
public JaasPrincipal(String username) {
this.username = username;
}
@Override
public String getName() {
return "Authenticated_"+this.username;
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.118.245