Search in sources :

Example 11 with ApplicationPermission

use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project carbon-identity-framework by wso2.

the class ApplicationMgtUtilTest method setup.

@BeforeTest
public void setup() {
    mockAppRootNode = mock(Collection.class);
    mockRealmConfiguration = mock(RealmConfiguration.class);
    applicationPermission = new ApplicationPermission();
    applicationPermission.setValue(USERNAME);
    applicationPermissions = new ApplicationPermission[] { applicationPermission };
}
Also used : RealmConfiguration(org.wso2.carbon.user.core.config.RealmConfiguration) Collection(org.wso2.carbon.registry.api.Collection) ApplicationPermission(org.wso2.carbon.identity.application.common.model.ApplicationPermission) BeforeTest(org.testng.annotations.BeforeTest)

Example 12 with ApplicationPermission

use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project product-is by wso2.

the class ApplicationManagementTestCase method testUpdateApplicationPermissions.

@Test(alwaysRun = true, description = "2.1.2.9")
public void testUpdateApplicationPermissions() {
    String applicationName = "TestServiceProvider";
    try {
        ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
        PermissionsAndRoleConfig permAndRoleConfig = new PermissionsAndRoleConfig();
        List<ApplicationPermission> appPermList = new ArrayList<ApplicationPermission>();
        ApplicationPermission appPermission = new ApplicationPermission();
        appPermission.setValue("app_permission");
        appPermList.add(appPermission);
        permAndRoleConfig.setPermissions(appPermList.toArray(new ApplicationPermission[appPermList.size()]));
        serviceProvider.setPermissionAndRoleConfig(permAndRoleConfig);
        applicationManagementServiceClient.updateApplicationData(serviceProvider);
        ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
        PermissionsAndRoleConfig updatedPermissionsAndRoleConfig = updatedServiceProvider.getPermissionAndRoleConfig();
        Assert.assertEquals(updatedPermissionsAndRoleConfig.getPermissions()[0].getValue(), "app_permission", "Failed update application permissions");
    } catch (Exception e) {
        Assert.fail("Error while trying to update Application Permissions", e);
    }
}
Also used : PermissionsAndRoleConfig(org.wso2.carbon.identity.application.common.model.xsd.PermissionsAndRoleConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ArrayList(java.util.ArrayList) ApplicationPermission(org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission) Test(org.testng.annotations.Test)

Example 13 with ApplicationPermission

use of org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission in project product-is by wso2.

the class ApplicationManagementTestCase method testUpdateApplicationPermissions.

@Test(alwaysRun = true, description = "Testing update Application Permissions")
public void testUpdateApplicationPermissions() {
    String applicationName = "TestServiceProvider";
    try {
        ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
        PermissionsAndRoleConfig permAndRoleConfig = new PermissionsAndRoleConfig();
        List<ApplicationPermission> appPermList = new ArrayList<ApplicationPermission>();
        ApplicationPermission appPermission = new ApplicationPermission();
        appPermission.setValue("app_permission");
        appPermList.add(appPermission);
        permAndRoleConfig.setPermissions(appPermList.toArray(new ApplicationPermission[appPermList.size()]));
        serviceProvider.setPermissionAndRoleConfig(permAndRoleConfig);
        applicationManagementServiceClient.updateApplicationData(serviceProvider);
        ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
        PermissionsAndRoleConfig updatedPermissionsAndRoleConfig = updatedServiceProvider.getPermissionAndRoleConfig();
        Assert.assertEquals(updatedPermissionsAndRoleConfig.getPermissions()[0].getValue(), "app_permission", "Failed update application permissions");
    } catch (Exception e) {
        Assert.fail("Error while trying to update Application Permissions", e);
    }
}
Also used : ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ArrayList(java.util.ArrayList) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest)

Aggregations

ApplicationPermission (org.wso2.carbon.identity.application.common.model.ApplicationPermission)8 Collection (org.wso2.carbon.registry.api.Collection)5 ArrayList (java.util.ArrayList)4 IdentityApplicationManagementException (org.wso2.carbon.identity.application.common.IdentityApplicationManagementException)4 Registry (org.wso2.carbon.registry.api.Registry)4 RegistryException (org.wso2.carbon.registry.api.RegistryException)4 ApplicationPermission (org.wso2.carbon.identity.application.common.model.xsd.ApplicationPermission)3 BeforeTest (org.testng.annotations.BeforeTest)2 Test (org.testng.annotations.Test)2 PermissionsAndRoleConfig (org.wso2.carbon.identity.application.common.model.PermissionsAndRoleConfig)2 PermissionsAndRoleConfig (org.wso2.carbon.identity.application.common.model.xsd.PermissionsAndRoleConfig)2 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)2 Resource (org.wso2.carbon.registry.api.Resource)2 UserStoreException (org.wso2.carbon.user.api.UserStoreException)2 UserRealm (org.wso2.carbon.user.core.UserRealm)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JAXBException (javax.xml.bind.JAXBException)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 AuthenticationStep (org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)1 Claim (org.wso2.carbon.identity.application.common.model.xsd.Claim)1