forked from wso2/carbon-identity-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
779 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
...common/src/main/java/org/wso2/carbon/identity/application/common/model/AuthorizedAPI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
* 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.common.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Authorized API model class. | ||
*/ | ||
public class AuthorizedAPI { | ||
|
||
private String appId; | ||
private String apiId; | ||
private String policyId; | ||
private List<Scope> scopes; | ||
|
||
public AuthorizedAPI(String appId, String apiId, String policyId, List<Scope> scopes) { | ||
|
||
this.appId = appId; | ||
this.apiId = apiId; | ||
this.policyId = policyId; | ||
this.scopes = scopes; | ||
} | ||
|
||
public AuthorizedAPI() { | ||
|
||
} | ||
|
||
public String getAppId() { | ||
|
||
return appId; | ||
} | ||
|
||
public String getApiId() { | ||
|
||
return apiId; | ||
} | ||
|
||
public String getPolicyId() { | ||
|
||
return policyId; | ||
} | ||
|
||
public List<Scope> getScopes() { | ||
|
||
return scopes; | ||
} | ||
|
||
public void setScopes(List<Scope> scopes) { | ||
|
||
this.scopes = scopes; | ||
} | ||
|
||
public void addScope(Scope scope) { | ||
|
||
this.scopes.add(scope); | ||
} | ||
|
||
/** | ||
* Builder class for {@link AuthorizedAPI}. | ||
*/ | ||
public static class AuthorizedAPIBuilder { | ||
|
||
private String appId; | ||
private String apiId; | ||
private boolean isUserBased; | ||
private String policyId; | ||
private List<Scope> scopes; | ||
|
||
public AuthorizedAPIBuilder(String appId, String apiId, String policyId, | ||
List<Scope> scopes) { | ||
|
||
this.appId = appId; | ||
this.apiId = apiId; | ||
this.policyId = policyId; | ||
this.scopes = scopes; | ||
} | ||
|
||
public AuthorizedAPIBuilder() { | ||
|
||
} | ||
|
||
public AuthorizedAPIBuilder appId(String appId) { | ||
|
||
this.appId = appId; | ||
return this; | ||
} | ||
|
||
public AuthorizedAPIBuilder apiId(String apiId) { | ||
|
||
this.apiId = apiId; | ||
return this; | ||
} | ||
|
||
public AuthorizedAPIBuilder policyId(String policyId) { | ||
|
||
this.policyId = policyId; | ||
return this; | ||
} | ||
|
||
public AuthorizedAPIBuilder scopes(List<Scope> scopes) { | ||
|
||
this.scopes = scopes; | ||
return this; | ||
} | ||
|
||
public AuthorizedAPI build() { | ||
|
||
return new AuthorizedAPI(appId, apiId, policyId, scopes); | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...mon/src/main/java/org/wso2/carbon/identity/application/common/model/AuthorizedScopes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* 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.common.model; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Authorized Scopes model class. | ||
*/ | ||
public class AuthorizedScopes { | ||
|
||
private String policyId; | ||
private List<String> scopes; | ||
|
||
public AuthorizedScopes(String policyId, List<String> scopes) { | ||
|
||
this.policyId = policyId; | ||
this.scopes = scopes; | ||
} | ||
|
||
public AuthorizedScopes() { | ||
|
||
} | ||
|
||
public String getPolicyId() { | ||
|
||
return policyId; | ||
} | ||
|
||
public List<String> getScopes() { | ||
|
||
return scopes; | ||
} | ||
|
||
public void setScopes(List<String> scopes) { | ||
|
||
this.scopes = scopes; | ||
} | ||
|
||
/** | ||
* Builder class for {@link AuthorizedScopes}. | ||
*/ | ||
public static class AuthorizedScopesBuilder { | ||
|
||
private String policyId; | ||
private List<String> scopes; | ||
|
||
public AuthorizedScopesBuilder policyId(String policyId) { | ||
|
||
this.policyId = policyId; | ||
return this; | ||
} | ||
|
||
public AuthorizedScopesBuilder scopes(List<String> scopes) { | ||
|
||
this.scopes = scopes; | ||
return this; | ||
} | ||
|
||
public AuthorizedScopes build() { | ||
|
||
return new AuthorizedScopes(policyId, scopes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
...rc/main/java/org/wso2/carbon/identity/application/mgt/AuthorizedAPIManagementService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* 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.mgt; | ||
|
||
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; | ||
import org.wso2.carbon.identity.application.common.model.AuthorizedAPI; | ||
import org.wso2.carbon.identity.application.common.model.AuthorizedScopes; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Authorized API management service. | ||
*/ | ||
public interface AuthorizedAPIManagementService { | ||
|
||
/** | ||
* Authorize an API to the application. | ||
* | ||
* @param applicationId Application ID. | ||
* @param authorizedAPI Authorized API. | ||
* @param tenantDomain Tenant Domain. | ||
* @throws IdentityApplicationManagementException if an error occurs while authorizing the API. | ||
*/ | ||
public void addAuthorizedAPI(String applicationId, AuthorizedAPI authorizedAPI, String tenantDomain) | ||
throws IdentityApplicationManagementException; | ||
|
||
/** | ||
* Delete authorized APIs from the application. | ||
* | ||
* @param appId Application ID. | ||
* @param apiId API ID. | ||
* @param tenantDomain Tenant Domain. | ||
* @throws IdentityApplicationManagementException if an error occurs while deleting the authorized APIs. | ||
*/ | ||
public void deleteAuthorizedAPIs(String appId, String apiId, String tenantDomain) | ||
throws IdentityApplicationManagementException; | ||
|
||
/** | ||
* Get authorized APIs of the application. | ||
* | ||
* @param applicationId Application ID. | ||
* @param tenantDomain Tenant Domain. | ||
* @return List of authorized APIs. | ||
* @throws IdentityApplicationManagementException if an error occurs while retrieving the authorized APIs. | ||
*/ | ||
public List<AuthorizedAPI> getAuthorizedAPIs(String applicationId, String tenantDomain) | ||
throws IdentityApplicationManagementException; | ||
|
||
/** | ||
* Patch authorized APIs of the application. | ||
* | ||
* @param appId Application ID. | ||
* @param apiId API ID. | ||
* @param addedScopes Added scopes. | ||
* @param removedScopes Removed scopes. | ||
* @param tenantDomain Tenant Domain. | ||
* @throws IdentityApplicationManagementException if an error occurs while patching the authorized APIs. | ||
*/ | ||
public void patchAuthorizedAPIs(String appId, String apiId, List<String> addedScopes, | ||
List<String> removedScopes, String tenantDomain) | ||
throws IdentityApplicationManagementException; | ||
|
||
/** | ||
* Get authorized scopes of the application. | ||
* | ||
* @param appId Application ID. | ||
* @param tenantDomain Tenant Domain. | ||
* @throws IdentityApplicationManagementException if an error occurs while retrieving the authorized scopes. | ||
*/ | ||
public List<AuthorizedScopes> getAuthorizedScopes(String appId, String tenantDomain) | ||
throws IdentityApplicationManagementException; | ||
} |
Oops, something went wrong.