use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project identity-api-server by wso2.
the class InboundAuthConfigToApiModel method apply.
@Override
public List<InboundProtocolListItem> apply(ServiceProvider application) {
String applicationId = application.getApplicationResourceId();
InboundAuthenticationConfig inboundAuthConfig = application.getInboundAuthenticationConfig();
if (inboundAuthConfig != null) {
if (ArrayUtils.isNotEmpty(inboundAuthConfig.getInboundAuthenticationRequestConfigs())) {
List<InboundProtocolListItem> inboundProtocolListItems = new ArrayList<>();
Arrays.stream(inboundAuthConfig.getInboundAuthenticationRequestConfigs()).forEach(inbound -> inboundProtocolListItems.add(buildInboundProtocolListItem(applicationId, inbound)));
return inboundProtocolListItems;
}
}
return Collections.emptyList();
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project identity-api-server by wso2.
the class InboundFunctions method updateOrInsertInbound.
public static void updateOrInsertInbound(ServiceProvider application, InboundAuthenticationRequestConfig newInbound) {
InboundAuthenticationConfig inboundAuthConfig = application.getInboundAuthenticationConfig();
if (inboundAuthConfig != null) {
InboundAuthenticationRequestConfig[] inbounds = inboundAuthConfig.getInboundAuthenticationRequestConfigs();
if (inbounds != null) {
Map<String, InboundAuthenticationRequestConfig> inboundAuthConfigs = Arrays.stream(inbounds).collect(Collectors.toMap(InboundAuthenticationRequestConfig::getInboundAuthType, Function.identity()));
inboundAuthConfigs.put(newInbound.getInboundAuthType(), newInbound);
inboundAuthConfig.setInboundAuthenticationRequestConfigs(inboundAuthConfigs.values().toArray(new InboundAuthenticationRequestConfig[0]));
} else {
addNewInboundToSp(application, newInbound);
}
} else {
// Create new inbound auth config.
addNewInboundToSp(application, newInbound);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig in project identity-api-server by wso2.
the class InboundFunctions method addNewInboundToSp.
private static void addNewInboundToSp(ServiceProvider application, InboundAuthenticationRequestConfig newInbound) {
InboundAuthenticationConfig inboundAuth = new InboundAuthenticationConfig();
inboundAuth.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { newInbound });
application.setInboundAuthenticationConfig(inboundAuth);
}
Aggregations