Examples of UserService


Examples of com.google.appengine.api.users.UserService

        assertFalse(gaeUser.isAdmin());
    }

    /** Test doFilter() when the user is logged in and is an admin user. */
    @Test public void testDoFilterAdmin() throws Exception {
        UserService userService = mock(UserService.class);
        AuthenticationManager authenticationManager = mock(AuthenticationManager.class);
        StubbedGaeAuthenticationFilter filter = new StubbedGaeAuthenticationFilter();

        filter.setUserService(userService);
        filter.setAuthenticationManager(authenticationManager);
        filter.afterPropertiesSet();

        User user = new User("email", "authDomain", "userId", "federatedIdentity");
        when(authenticationManager.authenticate(isA(GaeUserAuthenticationToken.class))).thenAnswer(new AuthenticationAnswer());
        when(userService.isUserLoggedIn()).thenReturn(true);      // user is logged in
        when(userService.isUserAdmin()).thenReturn(true);         // user is an admin
        when(userService.getCurrentUser()).thenReturn(user);      // this is the logged in user

        GaeUser gaeUser = callDoFilter(filter)// no client roles
        assertEquals(user.getAuthDomain(), gaeUser.getAuthDomain());
        assertEquals(user.getFederatedIdentity(), gaeUser.getFederatedIdentity());
        assertEquals(user.getEmail(), gaeUser.getEmail());
View Full Code Here

Examples of com.google.gdata.client.appsforyourdomain.UserService

    List script = new ArrayList(3);
    script.add(firstList);
    script.add(null);
    script.add(thirdList);
   
    UserService service = new ScriptedUserService(script);
   
    AfydBackedUserList abul = new AfydBackedUserList("example.com",
                                                     "admin@example.com",
                                                     "secret",
                                                     service);
View Full Code Here

Examples of com.hamidh.azad92.flash.account.UserService

@ImportResource(value = "classpath:spring-security-context.xml")
class SecurityConfig {
 
  @Bean
  public UserService userService() {
    return new UserService();
  }
View Full Code Here

Examples of com.inspiresoftware.lib.dto.geda.examples.blog.service.UserService

    @Test
    public void testBlogExample() {

        final UserDAO dao = new UserDAOImpl();
        final BeanFactory bf = new BlogBeanFactory();
        final UserService srv = new UserServiceImpl(dao, bf);

        final BlogRun run = new BlogRun(dao, srv);

        run.assembleUsersAndBlogEntries();
View Full Code Here

Examples of com.porterhead.rest.user.UserService

        when(applicationConfig.getAuthorizationExpiryTimeInSeconds()).thenReturn(60 * 60);
    }

    @Test
    public void firstTimeConnected() {
        UserService userService = new UserServiceImpl(usersConnectionRepository, validator, applicationConfig);
        ((UserServiceImpl)userService).setUserRepository(userRepository);
        List<String> userIds = usersConnectionRepository.findUserIdsWithConnection(connection);
        assertThat(userIds.size(), is(1));
        assertThat(userIds.get(0), is(user.getUuid().toString()));
        verify(userRepository, times(2)).save(any(User.class));
View Full Code Here

Examples of com.porterhead.rest.user.UserService

    }

    @Test
    public void validSocialLogin() {
        UserService userService = new UserServiceImpl(usersConnectionRepository, validator, applicationConfig);
        ((UserServiceImpl)userService).setUserRepository(userRepository);
        UserProfileBuilder builder = new UserProfileBuilder();
        UserProfile profile = builder.setFirstName("Tom").setLastName("Tucker").setEmail("tt@example.com").setUsername("ttucker").build();
        when(connection.fetchUserProfile()).thenReturn(profile);
        AuthenticatedUserToken token = userService.socialLogin(connection);
        ExternalUser user = userService.getUser(new ExternalUser(token.getUserId()), token.getUserId());
        assertThat(user, is(notNullValue()));
        assertThat(user.getEmailAddress(), is("tt@example.com"));
        assertThat(user.getFirstName(), is("Tom"));
        assertThat(user.getLastName(), is("Tucker"));
        assertThat(user.isVerified(), is(true));
View Full Code Here

Examples of com.porterhead.rest.user.UserService

    }


    @Bean
    public UserService userService() {
        UserService userService = mock(UserService.class);
        return userService;
    }
View Full Code Here

Examples of com.porterhead.rest.user.UserService

        assertThat(user.getRole().equalsIgnoreCase(Role.authenticated.toString()), is(true));
    }

     @Test
    public void updateFromSocialLogin() {
        UserService userService = new UserServiceImpl(usersConnectionRepository, validator, applicationConfig);
        ((UserServiceImpl)userService).setUserRepository(userRepository);
        UserProfileBuilder builder = new UserProfileBuilder();
        UserProfile profile = builder.setFirstName("Tom").setLastName("Tucker").setEmail("tt@example.com").setUsername("ttucker").build();
        when(connection.fetchUserProfile()).thenReturn(profile);
        userService.socialLogin(connection);
        //login again and update
        profile = builder.setFirstName("Foo").setLastName("Bar").setEmail("foobar@example.com").setUsername("foobar").build();
        when(connection.fetchUserProfile()).thenReturn(profile);
        AuthenticatedUserToken token = userService.socialLogin(connection);
        ExternalUser user = userService.getUser(new ExternalUser(token.getUserId()), token.getUserId());
        assertThat(user, is(notNullValue()));
        assertThat(user.getEmailAddress(), is("foobar@example.com"));
        assertThat(user.getFirstName(), is("Foo"));
        assertThat(user.getLastName(), is("Bar"));
        assertThat(user.isVerified(), is(true));
View Full Code Here

Examples of com.porterhead.rest.user.UserService

     *
     */
    @Test
    public void loginWithEmailAddressThenSocialLogin() {
        //set up services
        UserService userService = new UserServiceImpl(usersConnectionRepository, validator, applicationConfig);
        ((UserServiceImpl) userService).setUserRepository(userRepository);
        //create email account
        CreateUserRequest request = getCreateUserRequest(RandomStringUtils.randomAlphabetic(8) + "@example.com");
        AuthenticatedUserToken token = userService.createUser(request, Role.authenticated);

        UserProfileBuilder builder = new UserProfileBuilder();
        UserProfile profile = builder.setFirstName(user.getFirstName()).setLastName(user.getLastName()).setEmail(user.getEmailAddress()).setUsername("jsmith.12").build();
        when(connection.fetchUserProfile()).thenReturn(profile);
        when(userRepository.findByEmailAddress(any(String.class))).thenReturn(new User(UUID.fromString(token.getUserId())));
        when(userRepository.findByUuid(any(String.class))).thenReturn(new User(UUID.fromString(token.getUserId())));
        AuthenticatedUserToken loginToken = userService.socialLogin(connection);
        ExternalUser user = userService.getUser(new ExternalUser(token.getUserId()), token.getUserId());
        assertThat(token.getUserId(), is(loginToken.getUserId()));
    }
View Full Code Here

Examples of com.puppetlabs.geppetto.forge.v2.service.UserService

*/
public class UserTests extends ForgeAPITestBase {

  @Test
  public void testListUsers() throws IOException {
    UserService service = getTestUserForge().createUserService();
    List<User> Users = service.list(null);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
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.