コード例 #1
0
  @Override
  public void clearSessionCache(Context context) {
    try {
      if (session != null) {

        UserProviderCredentialsMap userProviderCredentialsMap =
            session.getUserProviderCredentials();

        if (userProviderCredentialsMap != null) {
          Collection<UserProviderCredentials> values = userProviderCredentialsMap.values();
          for (UserProviderCredentials userProviderCredentials : values) {
            AuthProviderInfo authProviderInfo = userProviderCredentials.getAuthProviderInfo();
            if (authProviderInfo != null) {
              clear3rdPartySession(context, authProviderInfo.getType());
            }
          }
        }

        session = null;
      }
    } finally {
      if (userSystem != null) {
        userSystem.clearSession();
      }
    }
  }
コード例 #2
0
  /*
   * (non-Javadoc)
   * @see com.socialize.SocializeService#isAuthenticated(com.socialize.auth.AuthProviderType)
   */
  @Override
  public boolean isAuthenticated(AuthProviderType providerType) {
    if (isAuthenticated()) {

      if (providerType.equals(AuthProviderType.SOCIALIZE)) {
        return true;
      }

      UserProviderCredentials userProviderCredentials =
          session.getUserProviderCredentials(providerType);

      if (userProviderCredentials != null) {
        // Validate the credentials
        AuthProviderInfo authProviderInfo = userProviderCredentials.getAuthProviderInfo();

        if (authProviderInfo != null) {
          AuthProvider<AuthProviderInfo> provider = authProviders.getProvider(providerType);

          boolean valid = provider.validate(authProviderInfo);

          return valid;
        }

        return false;
      }
    }

    return false;
  }
コード例 #3
0
  @Override
  public void clear3rdPartySession(Context context, AuthProviderType type) {
    try {
      if (session != null) {
        AuthProvider<AuthProviderInfo> provider = authProviders.getProvider(type);

        if (provider != null) {
          UserProviderCredentials userProviderCredentials =
              session.getUserProviderCredentials(type);

          if (userProviderCredentials != null) {
            AuthProviderInfo authProviderInfo = userProviderCredentials.getAuthProviderInfo();
            if (authProviderInfo != null) {
              provider.clearCache(context, authProviderInfo);
            }
          }
        }

        session.clear(type);
      }
    } finally {
      if (userSystem != null) {
        userSystem.clearSession(type);
      }
    }
  }
コード例 #4
0
 public boolean validateSessionAuthData(SocializeSession loaded, AuthProviderInfo info) {
   UserProviderCredentialsMap userProviderCredentialsMap = loaded.getUserProviderCredentials();
   if (userProviderCredentialsMap != null) {
     UserProviderCredentials userProviderCredentials =
         userProviderCredentialsMap.get(info.getType());
     if (userProviderCredentials != null
         && userProviderCredentials.getAuthProviderInfo().matches(info)) {
       return true;
     }
   }
   return false;
 }