use of org.wso2.carbon.identity.api.server.application.management.v1.RoleConfig in project identity-api-server by wso2.
the class ServerIdpManagementService method createRoleResponse.
private Roles createRoleResponse(IdentityProvider identityProvider) {
PermissionsAndRoleConfig permissionsAndRoleConfig = identityProvider.getPermissionAndRoleConfig();
Roles roleConfig = new Roles();
List<org.wso2.carbon.identity.api.server.idp.v1.model.RoleMapping> apiRoleMappings = new ArrayList<>();
if (permissionsAndRoleConfig != null) {
if (permissionsAndRoleConfig.getRoleMappings() != null) {
for (RoleMapping roleMapping : permissionsAndRoleConfig.getRoleMappings()) {
org.wso2.carbon.identity.api.server.idp.v1.model.RoleMapping apiRoleMapping = new org.wso2.carbon.identity.api.server.idp.v1.model.RoleMapping();
apiRoleMapping.setIdpRole(roleMapping.getRemoteRole());
apiRoleMapping.setLocalRole(IdentityUtil.addDomainToName(roleMapping.getLocalRole().getLocalRoleName(), roleMapping.getLocalRole().getUserStoreId()));
apiRoleMappings.add(apiRoleMapping);
}
}
}
roleConfig.setMappings(apiRoleMappings);
String provRoles = identityProvider.getProvisioningRole();
if (StringUtils.isNotBlank(provRoles)) {
roleConfig.setOutboundProvisioningRoles(Arrays.asList(provRoles.split(",")));
}
return roleConfig;
}
use of org.wso2.carbon.identity.api.server.application.management.v1.RoleConfig in project identity-api-server by wso2.
the class ServiceProviderToApiModel method buildRoleConfig.
private RoleConfig buildRoleConfig(ServiceProvider application) {
RoleConfig roleConfig = new RoleConfig();
if (application.getClaimConfig() != null) {
String roleClaimId = application.getClaimConfig().getRoleClaimURI();
if (StringUtils.isBlank(roleClaimId)) {
if (application.getClaimConfig().isLocalClaimDialect()) {
roleConfig.claim(buildClaimModel(FrameworkConstants.LOCAL_ROLE_CLAIM_URI));
}
} else {
roleConfig.claim(buildClaimModel(roleClaimId));
}
}
if (application.getLocalAndOutBoundAuthenticationConfig() != null) {
roleConfig.includeUserDomain(application.getLocalAndOutBoundAuthenticationConfig().isUseUserstoreDomainInRoles());
}
if (application.getPermissionAndRoleConfig() != null) {
RoleMapping[] roleMappings = application.getPermissionAndRoleConfig().getRoleMappings();
arrayToStream(roleMappings).forEach(roleMapping -> roleConfig.addMappingsItem(new org.wso2.carbon.identity.api.server.application.management.v1.RoleMapping().applicationRole(roleMapping.getRemoteRole()).localRole(roleMapping.getLocalRole().getLocalRoleName())));
}
return roleConfig;
}
use of org.wso2.carbon.identity.api.server.application.management.v1.RoleConfig in project identity-api-server by wso2.
the class UpdateClaimConfiguration method updateRoleClaimConfigs.
private void updateRoleClaimConfigs(RoleConfig roleApiModel, ServiceProvider application) {
if (roleApiModel != null) {
ClaimConfig claimConfig = getClaimConfig(application);
if (roleApiModel.getClaim() != null) {
claimConfig.setRoleClaimURI(roleApiModel.getClaim().getUri());
}
PermissionsAndRoleConfig permissionAndRoleConfig = getPermissionAndRoleConfig(application);
permissionAndRoleConfig.setRoleMappings(getRoleMappings(roleApiModel));
LocalAndOutboundAuthenticationConfig localAndOutboundConfig = getLocalAndOutboundConfig(application);
setIfNotNull(roleApiModel.getIncludeUserDomain(), localAndOutboundConfig::setUseUserstoreDomainInRoles);
}
}
Aggregations