Examples of Guest


Examples of org.fluxtream.core.domain.Guest

    if (auth==null)
      return null;
        final Object authPrincipal = auth.getPrincipal();
        if (authPrincipal instanceof FlxUserDetails) {
            final FlxUserDetails principal = (FlxUserDetails) authPrincipal;
            Guest guest = principal.getGuest();
            // set the guest's ID in case we got an instance that was deserialized from
            // disk (in which case it will be null)
            guest.setId(principal.guestId);
            return guest;
        } else return null;
  }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

            javax.servlet.http.HttpServletRequest request,
            javax.servlet.http.HttpServletResponse response)
            throws AuthenticationException {
        final String autoLoginToken = request.getParameter("autoLoginToken");
        if (autoLoginToken !=null) {
            final Guest one = jpaDaoService.findOne("guest.byAutoLoginToken", Guest.class, autoLoginToken);

            if (one!=null) {
                if ((System.currentTimeMillis()-one.autoLoginTokenTimestamp)>60000) {
                    throw new RuntimeException("Token is too old!");
                }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    public Authentication attemptAuthenticationWithEmailAddress(HttpServletRequest request) throws AuthenticationException {

        String email = obtainUsername(request);
        String password = obtainPassword(request);

        final Guest guest = guestService.getGuestByEmail(email);
        String username = null;
        if (guest!=null) {
            username = guest.username;
        }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

        try {
            String tokenValue = parseToken(request);
            if (tokenValue!=null) {
                AuthorizationToken authToken = oAuth2MgmtService.getTokenFromAccessToken(tokenValue);
                if (authToken!=null&&authToken.getExpirationIn()>0) {
                    final Guest guest = guestService.getGuestById(authToken.guestId);
                    final FlxUserDetails userDetails = new FlxUserDetails(guest);
                    PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(userDetails, authToken,
                            getAuthorities(guest));
                    authentication.setDetails(userDetails);
                    authentication.setAuthenticated(true);
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

            @ApiResponse(code=401, message="The user is no longer logged in"),
            @ApiResponse(code=403, message="Buddy-to-access authorization has been revoked")
    })
    @ApiOperation(value = "Retrieve the avatar (gravatar) of the currently logged in's guest", response = AvatarImageModel.class)
    public Response getAvatarImage(@ApiParam(value="Buddy to access username parameter (" + BuddiesService.BUDDY_TO_ACCESS_PARAM + ")", required=false) @QueryParam(BuddiesService.BUDDY_TO_ACCESS_PARAM) String buddyToAccessParameter) {
        Guest guest = AuthHelper.getGuest();
        AvatarImageModel avatarImage = getAvatarImageModel(buddyToAccessParameter, guest);
        return Response.ok(avatarImage).build();
    }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @Path("/coachees")
    @Produces({MediaType.APPLICATION_JSON})
    @ApiOperation(value = "Retrieve the currently logged in guest's list of coachees", responseContainer = "Array",
            response = GuestModel.class)
    public List<GuestModel> getCoachees() {
        Guest guest = AuthHelper.getGuest();
        final List<Guest> coachees = buddiesService.getTrustedBuddies(guest.getId());
        final List<GuestModel> coacheeModels = new ArrayList<GuestModel>();
        for (Guest coachee : coachees)
            coacheeModels.add(new GuestModel(coachee, true));
        return coacheeModels;
    }
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

public class TestsUtils {

  @SuppressWarnings("serial")
  public static void asGuest(String username) {
    Guest guest = new Guest();
    guest.username = username;
    final FlxUserDetails loggedUser = new FlxUserDetails(guest);
//    loggedUser.setDaylightSaving(false);
//    loggedUser.setTzOffset(1.0f);
    Authentication authToken = new Authentication() {
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

* Time: 12:05
*/
public class ApiHelper {

    static Guest getBuddyToAccess(GuestService guestService, CoachingBuddy coachee) {
        Guest guest = AuthHelper.getGuest();
        if (guest==null)
            return null;
        if (coachee!=null)
            return guestService.getGuestById(coachee.guestId);
        return guest;
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

    @GET
    @Path(value = "/model")
    @Produces({ MediaType.APPLICATION_JSON } )
    public String getModel(@QueryParam("state") String state) throws IOException {
        long guestId;
        Guest guest = AuthHelper.getGuest();
        guestId = guest.getId();
        StringBuilder sb = new StringBuilder("module=API component=calendarController action=getModel")
                .append(" guestId=").append(guestId);
        logger.info(sb.toString());
        CalendarModel calendarModel = CalendarModel.fromState(guestId, metadataService, state);
        return calendarModel.toJSONString(env);
View Full Code Here

Examples of org.fluxtream.core.domain.Guest

        return weather;
    }

    @Override
    public void rebuildMetadata(final String username) {
        Guest guest = null;
        // Accept guest ID as well as username
        try {
            guest = guestService.getGuest(username);
            if(guest==null) {
                // Try to treat arg as guestId
                Long guestId = Long.valueOf(username);
                if(guestId!=null) {
                    guest = guestService.getGuestById(guestId);
                }
            }
        }
        catch (Exception e) {
            // Might get exception if username doesn't exist and non-numeric
            guest=null;
        }
        // Check if we succeeded, return.  This isn't really right because we don't get
        // error reporting, but would take to long to fix error reporting right now.
        // TODO: fix error reporting
        if(guest==null) {
            return;
        }

        String entityName = JPAUtils.getEntityName(LocationFacet.class);
        final Query nativeQuery = em.createNativeQuery(String.format("SELECT DISTINCT apiKeyId FROM %s WHERE guestId=%s", entityName, guest.getId()));
        final List<BigInteger> resultList = nativeQuery.getResultList();
        for (BigInteger apiKeyId : resultList) {
            if(apiKeyId!=null && apiKeyId.longValue()>0) {
                rebuildMetadata(guest.username, apiKeyId.longValue());
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.