use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.
the class OIDCAuthCodeGrantSSOTestCase method testAuthzRequestWithoutValidSessionForIDENTITY5581.
@Test(groups = "wso2.is", description = "Test authz endpoint before creating a valid session")
public void testAuthzRequestWithoutValidSessionForIDENTITY5581() throws Exception {
// When accessing the below endpoint from with invalid session it should provide a message with login_required
OIDCApplication application = applications.get(OIDCUtilTest.playgroundAppOneAppName);
URI uri = new URIBuilder(OAuth2Constant.APPROVAL_URL).addParameter("client_id", application.getClientId()).addParameter("scope", "openid").addParameter("response_type", "code").addParameter("prompt", "none").addParameter("redirect_uri", application.getCallBackURL()).build();
HttpResponse httpResponse = sendGetRequest(client, uri.toString());
String contentData = DataExtractUtil.getContentData(httpResponse);
Assert.assertTrue(contentData.contains("login_required"));
EntityUtils.consume(httpResponse.getEntity());
}
use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.
the class OIDCAbstractUIIntegrationTest method createApplication.
/**
* Register an OIDC application in OP
*
* @param application application instance
* @throws Exception
*/
public void createApplication(OIDCApplication application) throws Exception {
log.info("Creating application " + application.getApplicationName());
OAuthConsumerAppDTO appDTO = new OAuthConsumerAppDTO();
appDTO.setApplicationName(application.getApplicationName());
appDTO.setCallbackUrl(application.getCallBackURL());
appDTO.setOAuthVersion(OIDCUITestConstants.OAUTH_VERSION_2);
appDTO.setGrantTypes("authorization_code implicit password client_credentials refresh_token " + "urn:ietf:params:oauth:grant-type:saml2-bearer iwa:ntlm");
oauthAdminClient.registerOAuthApplicationData(appDTO);
OAuthConsumerAppDTO[] appDtos = oauthAdminClient.getAllOAuthApplicationData();
for (OAuthConsumerAppDTO appDto : appDtos) {
if (appDto.getApplicationName().equals(application.getApplicationName())) {
application.setClientId(appDto.getOauthConsumerKey());
application.setClientSecret(appDto.getOauthConsumerSecret());
}
}
ServiceProvider serviceProvider = new ServiceProvider();
serviceProvider.setApplicationName(application.getApplicationName());
serviceProvider.setDescription(application.getApplicationName());
applicationManagementServiceClient.createApplication(serviceProvider);
serviceProvider = applicationManagementServiceClient.getApplication(application.getApplicationName());
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());
inboundAuthenticationRequestConfig.setInboundAuthType(OIDCUITestConstants.OAUTH_2);
if (StringUtils.isNotBlank(application.getClientSecret())) {
Property property = new Property();
property.setName(OIDCUITestConstants.OAUTH_CONSUMER_SECRET);
property.setValue(application.getClientSecret());
Property[] properties = { property };
inboundAuthenticationRequestConfig.setProperties(properties);
}
authRequestList.add(inboundAuthenticationRequestConfig);
}
if (authRequestList.size() > 0) {
serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(authRequestList.toArray(new InboundAuthenticationRequestConfig[authRequestList.size()]));
}
applicationManagementServiceClient.updateApplicationData(serviceProvider);
}
use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.
the class OIDCAbstractIntegrationTest method createApplication.
/**
* Register an OIDC application in OP
*
* @param application application instance
* @throws Exception
*/
public void createApplication(OIDCApplication application) throws Exception {
ServiceProvider serviceProvider = new ServiceProvider();
createApplication(serviceProvider, application);
}
use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.
the class OIDCAbstractIntegrationTest method createApplication.
public ServiceProvider createApplication(ServiceProvider serviceProvider, OIDCApplication application) throws Exception {
log.info("Creating application " + application.getApplicationName());
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");
adminClient.registerOAuthApplicationData(appDTO);
OAuthConsumerAppDTO[] appDtos = adminClient.getAllOAuthApplicationData();
for (OAuthConsumerAppDTO appDto : appDtos) {
if (appDto.getApplicationName().equals(application.getApplicationName())) {
application.setClientId(appDto.getOauthConsumerKey());
application.setClientSecret(appDto.getOauthConsumerSecret());
}
}
serviceProvider.setApplicationName(application.getApplicationName());
serviceProvider.setDescription(application.getApplicationName());
appMgtclient.createApplication(serviceProvider);
serviceProvider = appMgtclient.getApplication(application.getApplicationName());
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());
inboundAuthenticationRequestConfig.setInboundAuthType(OAuth2Constant.OAUTH_2);
if (StringUtils.isNotBlank(application.getClientSecret())) {
Property property = new Property();
property.setName(OAuth2Constant.OAUTH_CONSUMER_SECRET);
property.setValue(application.getClientSecret());
Property[] properties = { property };
inboundAuthenticationRequestConfig.setProperties(properties);
}
authRequestList.add(inboundAuthenticationRequestConfig);
}
if (authRequestList.size() > 0) {
serviceProvider.getInboundAuthenticationConfig().setInboundAuthenticationRequestConfigs(authRequestList.toArray(new InboundAuthenticationRequestConfig[authRequestList.size()]));
}
updateApplication(serviceProvider);
return serviceProvider;
}
use of org.wso2.identity.integration.test.oidc.bean.OIDCApplication in project product-is by wso2.
the class OIDCAuthCodeGrantSSODifferentSubjectIDTestCase method createApplication.
@Override
public void createApplication(OIDCApplication application) throws Exception {
super.createApplication(application);
ServiceProvider serviceProvider = appMgtclient.getApplication(application.getApplicationName());
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setSubjectClaimUri(application.getSubjectClaimURI());
appMgtclient.updateApplicationData(serviceProvider);
}
Aggregations