/** @see org.eclipse.jetty.security.LoginService#login(java.lang.String, java.lang.Object) */ public UserIdentity login(String username, Object credentials) { UserIdentity user = _users.get(username); if (user == null) user = loadUser(username); if (user != null) { UserPrincipal principal = (UserPrincipal) user.getUserPrincipal(); if (principal.authenticate(credentials)) return user; } return null; }
@Path("/") @GET @Produces({"application/thought-list+json", "application/thought-list+xml"}) public TimelineResult findInTimeline( @DefaultValue("0") @QueryParam("since_id") long sinceId, @QueryParam("max_id") long maxId, @DefaultValue("25") @QueryParam("limit") int limit) { UserPrincipal principal = (UserPrincipal) securityContext.getUserPrincipal(); List<Long> thoughtIdList = thoughtService.findInTimeline(principal.getUser().getId(), sinceId, maxId, limit); final List<Thought> result = new ArrayList<Thought>(thoughtIdList.size()); for (long id : thoughtIdList) { result.add(thoughtService.findById(id)); } return new TimelineResult(result); }