Search in sources :

Example 1 with WS_TRUST

use of org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.StandardInboundProtocols.WS_TRUST in project identity-api-server by wso2.

the class WSTrustInboundFunctions method createWsTrustInbound.

public static InboundAuthenticationRequestConfig createWsTrustInbound(WSTrustConfiguration wsTrustConfiguration) {
    try {
        // Check if WS-Trust is deployed.
        if (ApplicationManagementServiceHolder.getStsAdminService() != null) {
            ApplicationManagementServiceHolder.getStsAdminService().addTrustedService(wsTrustConfiguration.getAudience(), wsTrustConfiguration.getCertificateAlias());
            InboundAuthenticationRequestConfig wsTrustInbound = new InboundAuthenticationRequestConfig();
            wsTrustInbound.setInboundAuthType(WS_TRUST);
            wsTrustInbound.setInboundAuthKey(wsTrustConfiguration.getAudience());
            return wsTrustInbound;
        } else {
            // Throw 401 error since the WS-Trust connector is not available.
            throw buildBadRequestError(ERROR_DESCRIPTION);
        }
    } catch (SecurityConfigException e) {
        // Error while adding WS Trust, we can't continue.
        throw buildServerError("Error while adding WSTrust configuration. " + e.getMessage(), e);
    }
}
Also used : SecurityConfigException(org.wso2.carbon.security.SecurityConfigException) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig)

Aggregations

InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.InboundAuthenticationRequestConfig)1 SecurityConfigException (org.wso2.carbon.security.SecurityConfigException)1