Examples of CurrentUserDto


Examples of com.changestuffs.scrum.shared.dto.CurrentUserDto

    }

    private CurrentUserDto getCurrentUserDto() {
        Boolean isLoggedIn = userService.isUserLoggedIn();

        CurrentUserDto currentUser = new CurrentUserDto(isLoggedIn, getUser());
        currentUser.setLogoutUrl(userService.createLogoutURL("/"));
        currentUser.setLoginUrl(userService.createLoginURL("/"));

        if (isLoggedIn) {
            currentUser.setIsAdmin(userService.isUserAdmin());
            currentUser.setNickname(userService.getCurrentUser().getNickname());
        }

        return currentUser;
    }
View Full Code Here

Examples of com.changestuffs.scrum.shared.dto.CurrentUserDto

    this.currentUserDtoProvider = currentUserDtoProvider;
  }

  @GET
  public Response currentUser() {
    CurrentUserDto currentUser = currentUserDtoProvider.get();

    return Response.ok(currentUser).build();
  }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

            userDto = getUserFromCookie(action.getLoggedInCookie());
        } else {
            userDto = getUserFromCredentials(action.getUsername(), action.getPassword());
        }

        CurrentUserDto currentUserDto = new CurrentUserDto(isLoggedIn, userDto);

        String loggedInCookie = "";
        if (isLoggedIn) {
            loggedInCookie = loginCookieDao.createSessionCookie(userDto);
        }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

    public void logoutShouldDestroyTheSession(UserSessionDao userSessionDao) {
        // Given
        UserDto userDto = mock(UserDto.class);
        given(userDto.getId()).willReturn(0l);

        CurrentUserDto currentUserDto = mock(CurrentUserDto.class);
        given(currentUserDto.getUser()).willReturn(userDto);
        given(currentUserDtoProvider.get()).willReturn(currentUserDto);

        // When
        authenticator.logout();
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

        return userId != null;
    }

    private void removeCurrentUserLoginCookie() {
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();
        UserDto userDto = currentUserDto.getUser();
        userSessionDao.removeLoggedInCookie(userDto);
    }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

            userDto = User.createDto(userDao.get(currentUserId));
        }

        boolean isLoggedIn = userDto != null;

        return new CurrentUserDto(isLoggedIn, userDto);
    }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

        given(httpSession.getAttribute(SecurityParameters.getUserSessionKey())).willReturn(A_USER_ID);
        given(userDao.get(A_USER_ID)).willReturn(user);
        UserDto userDto = User.createDto(user);

        // When
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();

        // Then
        assertTrue(currentUserDto.isLoggedIn());
        assertEquals(userDto, currentUserDto.getUser());
    }
View Full Code Here

Examples of com.gwtplatform.carstore.shared.dto.CurrentUserDto

        // Given
        given(httpSession.getAttribute(SecurityParameters.getUserSessionKey())).willReturn(null);
        given(userDao.get(anyLong())).willReturn(null);

        // When
        CurrentUserDto currentUserDto = currentUserDtoProvider.get();

        // Then
        assertFalse(currentUserDto.isLoggedIn());
        assertNull(currentUserDto.getUser());
    }
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.