Package com.porterhead.rest.user.domain

Examples of com.porterhead.rest.user.domain.SocialUser


    try {
      ConnectionData data = connection.createData();
             //TODO: currently only support 1 connection per user per provider (rank = 1)
            int rank = 1;
            //create a SocialUser and call save
            SocialUser socialUser = SocialUserBuilder.create().withUser(user).withProviderId(data.getProviderId())
                    .withProviderUserId(data.getProviderUserId()).withRank(rank).withDisplayName(data.getDisplayName())
                    .withProfileUrl(data.getProfileUrl()).withImageUrl(data.getImageUrl()).withAccessToken(encrypt(data.getAccessToken()))
                            .withSecret(encrypt(data.getSecret())).withRefreshToken(encrypt(data.getRefreshToken()))
                            .withExpireTime(data.getExpireTime()).build();
      socialUserRepository.save(socialUser);
View Full Code Here


  }

  public void updateConnection(Connection<?> connection) {
    ConnectionData data = connection.createData();

    SocialUser socialUser = socialUserRepository.findByUserAndProviderIdAndProviderUserId(user, data.getProviderId(), data.getProviderUserId());
    if(socialUser != null){
      socialUser.setDisplayName(data.getDisplayName());
      socialUser.setProfileUrl(data.getProfileUrl());
      socialUser.setImageUrl(data.getImageUrl());
      socialUser.setAccessToken(encrypt(data.getAccessToken()));
      socialUser.setSecret(encrypt(data.getSecret()));
      socialUser.setRefreshToken(encrypt(data.getRefreshToken()));
      socialUser.setExpireTime(data.getExpireTime());

      socialUser = socialUserRepository.save(socialUser);
    }
  }
View Full Code Here

        List<SocialUser> users = socialUserRepository.findByUserAndProviderId(user, providerId);
    socialUserRepository.delete(users);
  }

  public void removeConnection(ConnectionKey connectionKey) {
        SocialUser socialUser = socialUserRepository.findByUserAndProviderIdAndProviderUserId(user, connectionKey.getProviderId(), connectionKey.getProviderUserId());
        socialUserRepository.delete(socialUser);
  }
View Full Code Here

        userRepository = mock(UserRepository.class);
        when(userRepository.findByUuid(any(String.class))).thenReturn(user);
    }

    private void mockSocialUsers() {
        socialUser = new SocialUser();
        socialUser.setUser(user);
        socialUser.setAccessToken(ACCESS_TOKEN);
        socialUser.setProviderId(PROVIDER_ID);
        socialUser.setProviderUserId(PROVIDER_USER_ID);
        socialUser.setDisplayName("Test User");
View Full Code Here

TOP

Related Classes of com.porterhead.rest.user.domain.SocialUser

Copyright © 2018 www.massapicom. 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.