Search in sources :

Example 6 with OIDCApplication

use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.

the class OIDCAuthCodeGrantSSOTestCase method initApplications.

protected void initApplications() throws Exception {
    OIDCApplication playgroundApp = new OIDCApplication(OIDCUtilTest.playgroundAppOneAppName, OIDCUtilTest.playgroundAppOneAppContext, OIDCUtilTest.playgroundAppOneAppCallBackUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.emailClaimUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.firstNameClaimUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.lastNameClaimUri);
    applications.put(OIDCUtilTest.playgroundAppOneAppName, playgroundApp);
    playgroundApp = new OIDCApplication(OIDCUtilTest.playgroundAppTwoAppName, OIDCUtilTest.playgroundAppTwoAppContext, OIDCUtilTest.playgroundAppTwoAppCallBackUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.emailClaimUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.firstNameClaimUri);
    playgroundApp.addRequiredClaim(OIDCUtilTest.lastNameClaimUri);
    applications.put(OIDCUtilTest.playgroundAppTwoAppName, playgroundApp);
}
Also used : OIDCApplication(org.wso2.identity.integration.test.oidc.bean.OIDCApplication)

Example 7 with OIDCApplication

use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.

the class OIDCFederatedIdpInitLogoutTest method updateServiceProviderWithOIDCConfigs.

private void updateServiceProviderWithOIDCConfigs(int portOffset, String applicationName, String callbackUrl, String backChannelLogoutUrl, ServiceProvider serviceProvider) throws Exception {
    OIDCApplication application = new OIDCApplication(applicationName, OAuth2Constant.TRAVELOCITY_APP_CONTEXT_ROOT, callbackUrl);
    OAuthConsumerAppDTO appDTO = getOAuthConsumerAppDTO(application);
    appDTO.setBackChannelLogoutUrl(backChannelLogoutUrl);
    OAuthConsumerAppDTO[] appDtos = createOIDCConfiguration(portOffset, appDTO);
    for (OAuthConsumerAppDTO appDto : appDtos) {
        if (appDto.getApplicationName().equals(application.getApplicationName())) {
            application.setClientId(appDto.getOauthConsumerKey());
            application.setClientSecret(appDto.getOauthConsumerSecret());
        }
    }
    ClaimConfig claimConfig = null;
    if (!application.getRequiredClaims().isEmpty()) {
        claimConfig = new ClaimConfig();
        for (String claimUri : application.getRequiredClaims()) {
            Claim claim = new Claim();
            claim.setClaimUri(claimUri);
            ClaimMapping claimMapping = new ClaimMapping();
            claimMapping.setRequested(true);
            claimMapping.setLocalClaim(claim);
            claimMapping.setRemoteClaim(claim);
            claimConfig.addClaimMappings(claimMapping);
        }
    }
    serviceProvider.setClaimConfig(claimConfig);
    serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
    List<InboundAuthenticationRequestConfig> authRequestList = new ArrayList<>();
    if (application.getClientId() != null) {
        InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
        inboundAuthenticationRequestConfig.setInboundAuthKey(application.getClientId());
        secondaryISClientID = application.getClientId();
        inboundAuthenticationRequestConfig.setInboundAuthType(OAuth2Constant.OAUTH_2);
        if (StringUtils.isNotBlank(application.getClientSecret())) {
            org.wso2.carbon.identity.application.common.model.xsd.Property property = new org.wso2.carbon.identity.application.common.model.xsd.Property();
            property.setName(OAuth2Constant.OAUTH_CONSUMER_SECRET);
            property.setValue(application.getClientSecret());
            secondaryISClientSecret = application.getClientSecret();
            org.wso2.carbon.identity.application.common.model.xsd.Property[] properties = { property };
            inboundAuthenticationRequestConfig.setProperties(properties);
        }
        serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { inboundAuthenticationRequestConfig });
        authRequestList.add(inboundAuthenticationRequestConfig);
    }
    super.updateServiceProvider(PORT_OFFSET_1, serviceProvider);
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO) ArrayList(java.util.ArrayList) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) ClaimMapping(org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping) ClaimConfig(org.wso2.carbon.identity.application.common.model.xsd.ClaimConfig) OIDCApplication(org.wso2.identity.integration.test.oidc.bean.OIDCApplication) IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty) Property(org.wso2.carbon.identity.application.common.model.idp.xsd.Property) Claim(org.wso2.carbon.identity.application.common.model.xsd.Claim)

Example 8 with OIDCApplication

use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.

the class OIDCFederatedIdpInitLogoutTest method getOAuthConsumerAppDTO.

private OAuthConsumerAppDTO getOAuthConsumerAppDTO(OIDCApplication application) {
    OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO();
    appDTO.setApplicationName(application.getApplicationName());
    appDTO.setCallbackUrl(application.getCallBackURL());
    appDTO.setOAuthVersion(OAuth2Constant.OAUTH_VERSION_2);
    appDTO.setGrantTypes("authorization_code implicit password client_credentials refresh_token " + "urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm");
    return appDTO;
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO)

Example 9 with OIDCApplication

use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.

the class OIDCIdentityFederationTestCase method updateServiceProviderWithOIDCConfigs.

private void updateServiceProviderWithOIDCConfigs(int portOffset, String applicationName, String callbackUrl, ServiceProvider serviceProvider) throws Exception {
    OIDCApplication application = new OIDCApplication(applicationName, OAuth2Constant.TRAVELOCITY_APP_CONTEXT_ROOT, callbackUrl);
    OAuthConsumerAppDTO appDTO = getOAuthConsumerAppDTO(application);
    OAuthConsumerAppDTO[] appDtos = createOIDCConfiguration(portOffset, appDTO);
    for (OAuthConsumerAppDTO appDto : appDtos) {
        if (appDto.getApplicationName().equals(application.getApplicationName())) {
            application.setClientId(appDto.getOauthConsumerKey());
            application.setClientSecret(appDto.getOauthConsumerSecret());
        }
    }
    ClaimConfig claimConfig = null;
    if (!application.getRequiredClaims().isEmpty()) {
        claimConfig = new ClaimConfig();
        for (String claimUri : application.getRequiredClaims()) {
            Claim claim = new Claim();
            claim.setClaimUri(claimUri);
            ClaimMapping claimMapping = new ClaimMapping();
            claimMapping.setRequested(true);
            claimMapping.setLocalClaim(claim);
            claimMapping.setRemoteClaim(claim);
            claimConfig.addClaimMappings(claimMapping);
        }
    }
    serviceProvider.setClaimConfig(claimConfig);
    serviceProvider.setOutboundProvisioningConfig(new OutboundProvisioningConfig());
    List<InboundAuthenticationRequestConfig> authRequestList = new ArrayList<>();
    if (application.getClientId() != null) {
        InboundAuthenticationRequestConfig inboundAuthenticationRequestConfig = new InboundAuthenticationRequestConfig();
        inboundAuthenticationRequestConfig.setInboundAuthKey(application.getClientId());
        secondaryISClientID = application.getClientId();
        inboundAuthenticationRequestConfig.setInboundAuthType(OAuth2Constant.OAUTH_2);
        if (StringUtils.isNotBlank(application.getClientSecret())) {
            org.wso2.carbon.identity.application.common.model.xsd.Property property = new org.wso2.carbon.identity.application.common.model.xsd.Property();
            property.setName(OAuth2Constant.OAUTH_CONSUMER_SECRET);
            property.setValue(application.getClientSecret());
            secondaryISClientSecret = application.getClientSecret();
            org.wso2.carbon.identity.application.common.model.xsd.Property[] properties = { property };
            inboundAuthenticationRequestConfig.setProperties(properties);
        }
        serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { inboundAuthenticationRequestConfig });
        authRequestList.add(inboundAuthenticationRequestConfig);
    }
    super.updateServiceProvider(PORT_OFFSET_1, serviceProvider);
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO) ArrayList(java.util.ArrayList) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) OutboundProvisioningConfig(org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig) ClaimMapping(org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping) ClaimConfig(org.wso2.carbon.identity.application.common.model.xsd.ClaimConfig) OIDCApplication(org.wso2.identity.integration.test.oidc.bean.OIDCApplication) Property(org.wso2.carbon.identity.application.common.model.idp.xsd.Property) Claim(org.wso2.carbon.identity.application.common.model.xsd.Claim)

Example 10 with OIDCApplication

use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.

the class OIDCIdentityFederationTestCase method getOAuthConsumerAppDTO.

private OAuthConsumerAppDTO getOAuthConsumerAppDTO(OIDCApplication application) {
    OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO();
    appDTO.setApplicationName(application.getApplicationName());
    appDTO.setCallbackUrl(application.getCallBackURL());
    appDTO.setOAuthVersion(OAuth2Constant.OAUTH_VERSION_2);
    appDTO.setGrantTypes("authorization_code implicit password client_credentials refresh_token " + "urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm");
    return appDTO;
}
Also used : OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO)

Aggregations

OIDCApplication (org.wso2.identity.integration.test.oidc.bean.OIDCApplication)7 OAuthConsumerAppDTO (org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO)6 Claim (org.wso2.carbon.identity.application.common.model.xsd.Claim)5 ClaimConfig (org.wso2.carbon.identity.application.common.model.xsd.ClaimConfig)5 ClaimMapping (org.wso2.carbon.identity.application.common.model.xsd.ClaimMapping)5 ArrayList (java.util.ArrayList)4 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)4 OutboundProvisioningConfig (org.wso2.carbon.identity.application.common.model.xsd.OutboundProvisioningConfig)4 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)4 Property (org.wso2.carbon.identity.application.common.model.idp.xsd.Property)2 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)2 URI (java.net.URI)1 HttpResponse (org.apache.http.HttpResponse)1 URIBuilder (org.apache.http.client.utils.URIBuilder)1 Test (org.testng.annotations.Test)1 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty)1 LocalAndOutboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig)1