use of org.wso2.carbon.idp.mgt.dao.FileBasedIdPMgtDAO in project carbon-identity-framework by wso2.
the class IdentityProviderManager method getIdPByAuthenticatorPropertyValue.
/**
* @param property IDP authenticator property (E.g.: IdPEntityId)
* @param value Value associated with given Property
* @param tenantDomain
* @param authenticator
* @return <code>IdentityProvider</code> Identity Provider information
* @throws IdentityProviderManagementException Error when getting Identity Provider
* information by authenticator property value
*/
public IdentityProvider getIdPByAuthenticatorPropertyValue(String property, String value, String tenantDomain, String authenticator, boolean ignoreFileBasedIdps) throws IdentityProviderManagementException {
int tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
if (StringUtils.isEmpty(property) || StringUtils.isEmpty(value) || StringUtils.isEmpty(authenticator)) {
String msg = "Invalid argument: Authenticator property, property value or authenticator name is empty";
throw new IdentityProviderManagementException(msg);
}
IdentityProvider identityProvider = dao.getIdPByAuthenticatorPropertyValue(null, property, value, authenticator, tenantId, tenantDomain);
if (identityProvider == null && !ignoreFileBasedIdps) {
identityProvider = new FileBasedIdPMgtDAO().getIdPByAuthenticatorPropertyValue(property, value, tenantDomain, authenticator);
}
return identityProvider;
}
use of org.wso2.carbon.idp.mgt.dao.FileBasedIdPMgtDAO in project carbon-identity-framework by wso2.
the class IdentityProviderManager method getIdPByRealmId.
/**
* Retrieves Identity provider information about a given tenant by realm identifier
*
* @param realmId Unique realm identifier of the Identity provider of whose information is
* requested
* @param tenantDomain Tenant domain whose information is requested
* @throws IdentityProviderManagementException Error when getting Identity Provider
* information by IdP home realm identifier
*/
@Override
public IdentityProvider getIdPByRealmId(String realmId, String tenantDomain) throws IdentityProviderManagementException {
int tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
if (StringUtils.isEmpty(realmId)) {
String msg = "Invalid argument: Identity Provider Home Realm Identifier value is empty";
throw new IdentityProviderManagementException(msg);
}
IdentityProvider identityProvider = dao.getIdPByRealmId(realmId, tenantId, tenantDomain);
if (identityProvider == null) {
identityProvider = new FileBasedIdPMgtDAO().getIdPByRealmId(realmId, tenantDomain);
}
return identityProvider;
}
use of org.wso2.carbon.idp.mgt.dao.FileBasedIdPMgtDAO in project carbon-identity-framework by wso2.
the class IdentityProviderManager method getMappedIdPClaims.
/**
* Retrieves Identity provider information about a given tenant
*
* @param idPName Unique Name of the IdP to which the given local claim URIs need to be mapped
* @param tenantDomain The tenant domain of whose local claim URIs to be mapped
* @param localClaimURIs Local claim URIs which need to be mapped to IdP's claim URIs
* @throws IdentityProviderManagementException Error when getting claim mappings
*/
@Override
public Set<ClaimMapping> getMappedIdPClaims(String idPName, String tenantDomain, List<String> localClaimURIs) throws IdentityProviderManagementException {
int tenantId = IdentityTenantUtil.getTenantId(tenantDomain);
if (StringUtils.isEmpty(idPName)) {
String msg = "Invalid argument: Identity Provider Name value is empty";
throw new IdentityProviderManagementException(msg);
}
IdentityProvider identityProvider = dao.getIdPByName(null, idPName, tenantId, tenantDomain);
if (identityProvider == null) {
identityProvider = new FileBasedIdPMgtDAO().getIdPByName(idPName, tenantDomain);
}
if (identityProvider == null) {
identityProvider = IdPManagementServiceComponent.getFileBasedIdPs().get(IdentityApplicationConstants.DEFAULT_IDP_CONFIG);
}
ClaimConfig claimConfiguration = identityProvider.getClaimConfig();
if (claimConfiguration != null) {
ClaimMapping[] claimMappings = claimConfiguration.getClaimMappings();
if (claimMappings != null && claimMappings.length > 0 && localClaimURIs != null) {
Set<ClaimMapping> returnSet = new HashSet<ClaimMapping>();
for (String localClaimURI : localClaimURIs) {
for (ClaimMapping claimMapping : claimMappings) {
if (claimMapping.getLocalClaim().getClaimUri().equals(localClaimURI)) {
returnSet.add(claimMapping);
break;
}
}
}
return returnSet;
}
}
return new HashSet<ClaimMapping>();
}
Aggregations