-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4926 from ThaminduR/add-authorized-api
Implement authorizing API resource to an application
- Loading branch information
Showing
27 changed files
with
1,569 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
140 changes: 140 additions & 0 deletions
140
...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,140 @@ | ||
/* | ||
* 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 apiIdentifier; | ||
private String apiName; | ||
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 getAPIIdentifier() { | ||
|
||
return apiIdentifier; | ||
} | ||
|
||
public void setAPIIdentifier(String apiIdentifier) { | ||
|
||
this.apiIdentifier = apiIdentifier; | ||
} | ||
|
||
public String getAPIName() { | ||
|
||
return apiName; | ||
} | ||
|
||
public void setAPIName(String apiName) { | ||
|
||
this.apiName = apiName; | ||
} | ||
|
||
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 String policyId; | ||
private List<Scope> 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
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
Oops, something went wrong.