Search in sources :

Example 36 with InboundAuthenticationConfig

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();
}
Also used : InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig) InboundProtocolListItem(org.wso2.carbon.identity.api.server.application.management.v1.InboundProtocolListItem) ArrayList(java.util.ArrayList)

Example 37 with InboundAuthenticationConfig

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);
    }
}
Also used : InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig)

Example 38 with InboundAuthenticationConfig

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);
}
Also used : InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig)

Aggregations

InboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig)21 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)21 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)19 InboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.InboundAuthenticationConfig)16 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig)15 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)15 ArrayList (java.util.ArrayList)9 Property (org.wso2.carbon.identity.application.common.model.Property)7 IdentityApplicationManagementException (org.wso2.carbon.identity.application.common.IdentityApplicationManagementException)6 RequestPathAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig)5 ServiceProvider (org.wso2.carbon.identity.application.common.model.ServiceProvider)4 LocalAndOutboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig)4 PreparedStatement (java.sql.PreparedStatement)3 SQLException (java.sql.SQLException)3 NamedPreparedStatement (org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement)3 ServiceProviderProperty (org.wso2.carbon.identity.application.common.model.ServiceProviderProperty)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 APIError (org.wso2.carbon.identity.api.server.common.error.APIError)2 AuthenticationStep (org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)2