Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce application role #4873

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>application-role-mgt</artifactId>
<version>5.25.287-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.application.role.mgt</artifactId>
<name>Application Role Management Service</name>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.core</artifactId>
</dependency>
<!--Test Dependencies-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.idp.mgt</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Description>Application Role Management Service Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.identity.application.role.mgt.internal
</Private-Package>
<Export-Package>
!org.wso2.carbon.identity.application.role.mgt.internal,
org.wso2.carbon.identity.application.role.mgt.*;
version="${project.version}",
</Export-Package>
<Import-Package>
javax.sql,
org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}",
org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}",
org.apache.commons.lang; version="${commons-lang.wso2.osgi.version.range}",
org.apache.commons.logging; version="${import.package.version.commons.logging}",
org.wso2.carbon.context; version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.identity.core.*; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.database.utils.jdbc;
version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.user.api; version="${carbon.user.api.imp.pkg.version.range}",
org.wso2.carbon.user.core.*;version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.database.utils.jdbc.exceptions;version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.utils; version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.idp.mgt.*; version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.application.common.*; version="${carbon.identity.package.import.version.range}",
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.wso2.carbon.identity.application.role.mgt;

import org.wso2.carbon.identity.application.role.mgt.exceptions.ApplicationRoleManagementException;
import org.wso2.carbon.identity.application.role.mgt.model.ApplicationRole;

import java.util.List;

/**
* Application Role Manager.
*/
public interface ApplicationRoleManager {

/**
* Add application role.
*
* @param applicationRole Application role.
* @throws ApplicationRoleManagementException Error occurred while adding application role.
*/
void addApplicationRole(ApplicationRole applicationRole) throws ApplicationRoleManagementException;

/**
* Update application role.
*
* @param roleId role Id.
* @param newName new role name.
* @param addedScopes List of scopes to be added.
* @param removedScopes List of scopes to be removed.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
void updateApplicationRole(String applicationId, String roleId, String newName, List<String> addedScopes,
List<String> removedScopes) throws ApplicationRoleManagementException;

/**
* Get the application role by role id.
*
* @param roleId Role id.
* @return Application role.
* @throws ApplicationRoleManagementException Error occurred while retrieving the application role.
*/
ApplicationRole getApplicationRoleById(String roleId) throws ApplicationRoleManagementException;

/**
* Get all the application roles by application id.
*
* @param applicationId Application id.
* @return Application roles.
* @throws ApplicationRoleManagementException Error occurred while retrieving the application roles of a given app.
*/
List<ApplicationRole> getApplicationRoles(String applicationId) throws ApplicationRoleManagementException;

/**
* Delete application role.
*
* @param roleId Role id.
* @throws ApplicationRoleManagementException Error occurred while deleting the application role.
*/
void deleteApplicationRole(String roleId) throws ApplicationRoleManagementException;


/**
* Update the list of assigned users for an application role.
*
* @param roleId Application role ID.
* @param addedUsers List of user IDs to be assigned.
* @param removedUsers List of user IDs to be unassigned.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
void updateApplicationRoleAssignedUsers(String roleId, List<String> addedUsers, List<String> removedUsers)
throws ApplicationRoleManagementException;

/**
* Get the list of assigned users of an application role.
*
* @param roleId Application role ID.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
ApplicationRole getApplicationRoleAssignedUsers(String roleId) throws ApplicationRoleManagementException;

/**
* Update the list of assigned groups for an application role.
*
* @param roleId Application role ID.
* @param addedGroups List of group IDs to be assigned.
* @param removedGroups List of group IDs to be unassigned.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
void updateApplicationRoleAssignedGroups(String roleId, String idpId, List<String> addedGroups,
List<String> removedGroups) throws ApplicationRoleManagementException;

/**
* Get the list of assigned groups of an application role.
*
* @param roleId Application role ID.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
ApplicationRole getApplicationRoleAssignedGroups(String roleId, String idpId)
throws ApplicationRoleManagementException;

/**
* Get the list of application roles of a user.
*
* @param userId user ID.
* @param tenantDomain tenant domain.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
List<ApplicationRole> getApplicationRolesByUserId(String userId, String tenantDomain)
throws ApplicationRoleManagementException;

/**
* Get the list of application roles of a group.
*
* @param groupId group ID.
* @param tenantDomain tenant domain.
* @throws ApplicationRoleManagementException Error occurred while updating the application role.
*/
List<ApplicationRole> getApplicationRolesByGroupId(String groupId, String tenantDomain)
throws ApplicationRoleManagementException;


}
Loading
Loading