@Test public void testMissingHeader() { assertNull(decoder.fromRequest(new DummyHttpServletRequestUser())); }
@Override public User fromRequest(HttpServletRequest request) { if (request.getUserPrincipal() == null) { return null; } String username = request.getUserPrincipal().getName(); if (username == null || username.isEmpty()) { LOGGER.log(Level.WARNING, "Can not construct User object: cannot get user principal from: {0}", request); return null; } return new User(username); }
UserPrincipalDecoder implements IUserDecoder { @Override public User fromRequest(HttpServletRequest request) { if (request.getUserPrincipal() == null) { return null; } String username = request.getUserPrincipal().getName(); if (username == null || username.isEmpty()) { LOGGER.log(Level.WARNING, "Can not construct User object: cannot get user principal from: {0}", request); return null; } return new User(username); } }
UserPrincipalDecoder implements IUserDecoder { @Override public User fromRequest(HttpServletRequest request) { if (request.getUserPrincipal() == null) { return null; } String username = request.getUserPrincipal().getName(); if (username == null || username.isEmpty()) { LOGGER.log(Level.WARNING, "Can not construct User object: cannot get user principal from: {0}", request); return null; } return new User(username); }  }
UserPrincipalDecoder implements IUserDecoder { @Override public User fromRequest(HttpServletRequest request) { if (request.getUserPrincipal() == null) { return null; } String username = request.getUserPrincipal().getName(); if (username == null || username.isEmpty()) { LOGGER.log(Level.WARNING, "Can not construct User object: cannot get user principal from: {0}", request); return null; } return new User(username); }  @Override User fromRequest(HttpServletRequest request); }
UserPrincipalDecoder implements IUserDecoder { @Override public User fromRequest(HttpServletRequest request) { if (request.getUserPrincipal() == null) { return null; } String username = request.getUserPrincipal().getName(); if (username == null || username.isEmpty()) { LOGGER.log(Level.WARNING, "Can not construct User object: cannot get user principal from: {0}", request); return null; } return new User(username); }  @Override User fromRequest(HttpServletRequest request);  }