use of org.wso2.carbon.identity.user.profile.mgt.association.federation.model.AssociatedIdentityProvider in project carbon-identity-framework by wso2.
the class FederatedAssociationManagerImpl method getFederatedAssociationsOfUser.
@Override
public FederatedAssociation[] getFederatedAssociationsOfUser(User user) throws FederatedAssociationManagerException {
validateUserObject(user);
int tenantId = getValidatedTenantId(user);
validateUserExistence(user, tenantId);
try {
List<FederatedAssociation> federatedAssociations = new ArrayList<>();
List<AssociatedAccountDTO> associatedAccountDTOS = UserProfileMgtDAO.getInstance().getAssociatedFederatedAccountsForUser(tenantId, user.getUserStoreDomain(), user.getUserName());
for (AssociatedAccountDTO associatedAccount : associatedAccountDTOS) {
AssociatedIdentityProvider idp = getAssociatedIdentityProvider(user.getTenantDomain(), associatedAccount.getIdentityProviderName());
federatedAssociations.add(new FederatedAssociation(associatedAccount.getId(), idp, associatedAccount.getUsername()));
}
return federatedAssociations.toArray(new FederatedAssociation[0]);
} catch (UserProfileException e) {
if (log.isDebugEnabled()) {
String msg = "Error while retrieving federated account associations of user: " + user.toFullQualifiedUsername();
log.debug(msg);
}
throw handleFederatedAssociationManagerServerException(ERROR_WHILE_RETRIEVING_FEDERATED_ASSOCIATION_OF_USER, e, true);
}
}
Aggregations