use of org.wso2.carbon.identity.api.server.idp.v1.model.MetaFederatedAuthenticator in project identity-api-server by wso2.
the class ServerIdpManagementService method createMetaFederatedAuthenticatorListItem.
private MetaFederatedAuthenticatorListItem createMetaFederatedAuthenticatorListItem(FederatedAuthenticatorConfig authenticatorConfig) {
MetaFederatedAuthenticatorListItem metaFederatedAuthenticator = new MetaFederatedAuthenticatorListItem();
String authenticatorId = base64URLEncode(authenticatorConfig.getName());
metaFederatedAuthenticator.setName(authenticatorConfig.getName());
metaFederatedAuthenticator.setAuthenticatorId(authenticatorId);
FederatedAuthenticatorConfig federatedAuthenticatorConfig = ApplicationAuthenticatorService.getInstance().getFederatedAuthenticatorByName(authenticatorConfig.getName());
if (federatedAuthenticatorConfig != null) {
String[] tags = federatedAuthenticatorConfig.getTags();
if (ArrayUtils.isNotEmpty(tags)) {
metaFederatedAuthenticator.setTags(Arrays.asList(tags));
}
}
metaFederatedAuthenticator.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT + "/meta/federated-authenticators/%s", authenticatorId)).toString());
return metaFederatedAuthenticator;
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.MetaFederatedAuthenticator in project identity-api-server by wso2.
the class ServerIdpManagementService method createMetaFederatedAuthenticator.
private MetaFederatedAuthenticator createMetaFederatedAuthenticator(FederatedAuthenticatorConfig authenticatorConfig) {
MetaFederatedAuthenticator metaFederatedAuthenticator = new MetaFederatedAuthenticator();
metaFederatedAuthenticator.setName(authenticatorConfig.getName());
metaFederatedAuthenticator.setAuthenticatorId(base64URLEncode(authenticatorConfig.getName()));
metaFederatedAuthenticator.setDisplayName(authenticatorConfig.getDisplayName());
FederatedAuthenticatorConfig federatedAuthenticatorConfig = ApplicationAuthenticatorService.getInstance().getFederatedAuthenticatorByName(authenticatorConfig.getName());
if (federatedAuthenticatorConfig != null) {
String[] tags = federatedAuthenticatorConfig.getTags();
if (ArrayUtils.isNotEmpty(tags)) {
metaFederatedAuthenticator.setTags(Arrays.asList(tags));
}
}
Property[] properties = authenticatorConfig.getProperties();
List<MetaProperty> metaProperties = Arrays.stream(properties).map(propertyToExternalMeta).collect(Collectors.toList());
metaFederatedAuthenticator.setProperties(metaProperties);
return metaFederatedAuthenticator;
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.MetaFederatedAuthenticator in project identity-api-server by wso2.
the class ServerIdpManagementService method getMetaFederatedAuthenticators.
/**
* Get meta information about Identity Provider's federated authenticators.
*
* @return list of meta federated authenticators.
*/
public List<MetaFederatedAuthenticatorListItem> getMetaFederatedAuthenticators() {
List<MetaFederatedAuthenticatorListItem> metaAuthenticators = new ArrayList<>();
try {
FederatedAuthenticatorConfig[] authenticatorConfigs = IdentityProviderServiceHolder.getIdentityProviderManager().getAllFederatedAuthenticators();
if (ArrayUtils.isNotEmpty(authenticatorConfigs)) {
for (FederatedAuthenticatorConfig authenticatorConfig : authenticatorConfigs) {
MetaFederatedAuthenticatorListItem metaFederatedAuthenticator = createMetaFederatedAuthenticatorListItem(authenticatorConfig);
metaAuthenticators.add(metaFederatedAuthenticator);
}
}
return metaAuthenticators;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_META_AUTHENTICATORS, null);
}
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.MetaFederatedAuthenticator in project identity-api-server by wso2.
the class ServerIdpManagementService method getMetaFederatedAuthenticator.
/**
* Get meta information about a specific federated authenticator supported by the IDPs.
*
* @param id Federated authenticator ID.
* @return MetaFederatedAuthenticator.
*/
public MetaFederatedAuthenticator getMetaFederatedAuthenticator(String id) {
MetaFederatedAuthenticator authenticator = null;
try {
String authenticatorName = decodeAuthenticatorID(id);
FederatedAuthenticatorConfig[] authenticatorConfigs = IdentityProviderServiceHolder.getIdentityProviderManager().getAllFederatedAuthenticators();
if (ArrayUtils.isNotEmpty(authenticatorConfigs)) {
for (FederatedAuthenticatorConfig authenticatorConfig : authenticatorConfigs) {
if (StringUtils.equals(authenticatorConfig.getName(), authenticatorName)) {
authenticator = createMetaFederatedAuthenticator(authenticatorConfig);
break;
}
}
}
return authenticator;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_META_AUTHENTICATOR, id);
}
}
Aggregations