Exemplo n.º 1
0
  public static String showSecurity(HttpServletRequest req, String role) {
    StringBuilder sbuff = new StringBuilder();

    sbuff.append("Security Info\n");
    sbuff.append(" req.getRemoteUser(): ").append(req.getRemoteUser()).append("\n");
    sbuff.append(" req.getUserPrincipal(): ").append(req.getUserPrincipal()).append("\n");
    sbuff
        .append(" req.isUserInRole(")
        .append(role)
        .append("):")
        .append(req.isUserInRole(role))
        .append("\n");
    sbuff.append(" ------------------\n");

    return sbuff.toString();
  }
 public Principal getUserPrincipal() {
   return request.getUserPrincipal();
 }
Exemplo n.º 3
0
 // user predicates
 String getUsername() {
   Principal user = req.getUserPrincipal();
   return user != null ? user.toString() : null;
 }