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

Add API layer to manage authorization details types #728

Merged
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ff6a480
Adds Authorization Details Types API
VimukthiRajapaksha Aug 26, 2024
004b252
Adds Authorization Details Types API
VimukthiRajapaksha Aug 27, 2024
ee0b27e
Add authorization details types feature
VimukthiRajapaksha Aug 27, 2024
2c29a50
Validates provided schema
VimukthiRajapaksha Sep 30, 2024
096c5f6
Add authorization details types ID to resource paths
VimukthiRajapaksha Oct 25, 2024
9546d52
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Oct 25, 2024
7e8a1cb
Resolve merge conflicts
VimukthiRajapaksha Oct 25, 2024
1668b5a
Update license headers
VimukthiRajapaksha Oct 28, 2024
6a90f0e
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Oct 29, 2024
3eb0307
resolve merge conflicts
VimukthiRajapaksha Oct 29, 2024
520a203
Improves error descriptions
VimukthiRajapaksha Nov 13, 2024
d40a5c6
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Nov 13, 2024
a7732fc
Resolve merge conflicts
VimukthiRajapaksha Nov 13, 2024
ff585ef
Adds missing JavaDoc comments
VimukthiRajapaksha Nov 13, 2024
ac57c20
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Dec 18, 2024
879cfb2
Resolve merge conflicts
VimukthiRajapaksha Dec 18, 2024
c07b105
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 9, 2025
fbaf016
Merge remote-tracking branch 'origin/master' into master_rich_authori…
VimukthiRajapaksha Jan 9, 2025
37bda4f
rename replaceAuthorizationDetailsTypes to updateAuthorizationDetails…
VimukthiRajapaksha Jan 16, 2025
eb60ef6
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 16, 2025
d545435
Merge remote-tracking branch 'origin/master' into master_rich_authori…
VimukthiRajapaksha Jan 16, 2025
89080d1
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 22, 2025
bbff729
Merge remote-tracking branch 'origin/master' into master_rich_authori…
VimukthiRajapaksha Jan 22, 2025
9eb900c
Accept RAR as an OSGi component
VimukthiRajapaksha Jan 24, 2025
8fcf548
Resolve merge conflicts
VimukthiRajapaksha Jan 24, 2025
3c49ef1
Resolve merge conflicts
VimukthiRajapaksha Jan 24, 2025
dd6fd5c
Resolve authorization details services using OSGi
VimukthiRajapaksha Jan 24, 2025
4671d0e
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 24, 2025
1d3f598
Merge remote-tracking branch 'origin/master' into master_rich_authori…
VimukthiRajapaksha Jan 24, 2025
210638a
Delete ~
VimukthiRajapaksha Jan 24, 2025
ba59fc6
Update the year of license header
VimukthiRajapaksha Jan 24, 2025
fa5cfd0
Merge remote-tracking branch 'origin/master_rich_authorization_reques…
VimukthiRajapaksha Jan 24, 2025
c7ff423
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 24, 2025
155f7f0
Resolve merge conflicts
VimukthiRajapaksha Jan 24, 2025
44043a1
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 24, 2025
4c159f1
Resolve merge conflicts
VimukthiRajapaksha Jan 24, 2025
2307769
Merge remote-tracking branch 'upstream/master'
VimukthiRajapaksha Jan 25, 2025
9b911b4
Resolve merge conflicts
VimukthiRajapaksha Jan 25, 2025
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
Expand Up @@ -68,5 +68,10 @@
<artifactId>org.wso2.carbon.identity.api.resource.collection.mgt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>org.wso2.carbon.identity.oauth.rar</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2023-2025, 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
Expand All @@ -21,7 +21,9 @@
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.api.resource.collection.mgt.APIResourceCollectionManager;
import org.wso2.carbon.identity.api.resource.mgt.APIResourceManager;
import org.wso2.carbon.identity.api.resource.mgt.AuthorizationDetailsTypeManager;
import org.wso2.carbon.identity.oauth.OAuthAdminServiceImpl;
import org.wso2.carbon.identity.oauth.rar.core.AuthorizationDetailsSchemaValidator;

/**
* Service holder class for api resource management.
Expand All @@ -48,6 +50,19 @@ private static class OAuthAdminServiceImplHolder {
.getThreadLocalCarbonContext().getOSGiService(OAuthAdminServiceImpl.class, null);
}

private static class AuthorizationDetailsTypeManagerHolder {

static final AuthorizationDetailsTypeManager SERVICE = (AuthorizationDetailsTypeManager) PrivilegedCarbonContext
.getThreadLocalCarbonContext().getOSGiService(AuthorizationDetailsTypeManager.class, null);
}

private static class AuthorizationDetailsSchemaValidatorHolder {

static final AuthorizationDetailsSchemaValidator SERVICE =
(AuthorizationDetailsSchemaValidator) PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getOSGiService(AuthorizationDetailsSchemaValidator.class, null);
}

/**
* Get APIResourceManager osgi service.
*
Expand Down Expand Up @@ -77,4 +92,24 @@ public static OAuthAdminServiceImpl getOAuthAdminServiceImpl() {

return OAuthAdminServiceImplHolder.SERVICE;
}

/**
* Set {@link AuthorizationDetailsTypeManager} instance.
*
* @return AuthorizationDetailsTypeManager instance.
*/
public static AuthorizationDetailsTypeManager getAuthorizationDetailsTypeManager() {

return AuthorizationDetailsTypeManagerHolder.SERVICE;
}

/**
* Set {@link AuthorizationDetailsSchemaValidator} instance.
*
* @return AuthorizationDetailsSchemaValidator instance.
*/
public static AuthorizationDetailsSchemaValidator getAuthorizationDetailsSchemaValidator() {

return AuthorizationDetailsSchemaValidatorHolder.SERVICE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
<artifactId>org.wso2.carbon.identity.oauth</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.inbound.auth.oauth2</groupId>
<artifactId>org.wso2.carbon.identity.oauth.rar</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2025, 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
Expand All @@ -24,6 +24,7 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.wso2.carbon.identity.api.server.api.resource.v1.AuthorizationDetailsTypesCreationModel;
import org.wso2.carbon.identity.api.server.api.resource.v1.ScopeCreationModel;
import javax.validation.constraints.*;

Expand All @@ -41,6 +42,8 @@ public class APIResourceCreationModel {
private Boolean requiresAuthorization;
private List<ScopeCreationModel> scopes = null;

private List<AuthorizationDetailsTypesCreationModel> authorizationDetailsTypes = null;


/**
**/
Expand Down Expand Up @@ -144,6 +147,32 @@ public APIResourceCreationModel addScopesItem(ScopeCreationModel scopesItem) {
return this;
}

/**
**/
public APIResourceCreationModel authorizationDetailsTypes(List<AuthorizationDetailsTypesCreationModel> authorizationDetailsTypes) {

this.authorizationDetailsTypes = authorizationDetailsTypes;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("authorizationDetailsTypes")
@Valid
public List<AuthorizationDetailsTypesCreationModel> getAuthorizationDetailsTypes() {
return authorizationDetailsTypes;
}
public void setAuthorizationDetailsTypes(List<AuthorizationDetailsTypesCreationModel> authorizationDetailsTypes) {
this.authorizationDetailsTypes = authorizationDetailsTypes;
}

public APIResourceCreationModel addAuthorizationDetailsTypesItem(AuthorizationDetailsTypesCreationModel authorizationDetailsTypesItem) {
if (this.authorizationDetailsTypes == null) {
this.authorizationDetailsTypes = new ArrayList<AuthorizationDetailsTypesCreationModel>();
}
this.authorizationDetailsTypes.add(authorizationDetailsTypesItem);
return this;
}



@Override
Expand All @@ -160,12 +189,13 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.identifier, apIResourceCreationModel.identifier) &&
Objects.equals(this.description, apIResourceCreationModel.description) &&
Objects.equals(this.requiresAuthorization, apIResourceCreationModel.requiresAuthorization) &&
Objects.equals(this.scopes, apIResourceCreationModel.scopes);
Objects.equals(this.scopes, apIResourceCreationModel.scopes) &&
Objects.equals(this.authorizationDetailsTypes, apIResourceCreationModel.authorizationDetailsTypes);
}

@Override
public int hashCode() {
return Objects.hash(name, identifier, description, requiresAuthorization, scopes);
return Objects.hash(name, identifier, description, requiresAuthorization, scopes, authorizationDetailsTypes);
}

@Override
Expand All @@ -179,6 +209,7 @@ public String toString() {
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" requiresAuthorization: ").append(toIndentedString(requiresAuthorization)).append("\n");
sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n");
sb.append(" authorizationDetailsTypes: ").append(toIndentedString(authorizationDetailsTypes)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2025, 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
Expand All @@ -24,6 +24,7 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.wso2.carbon.identity.api.server.api.resource.v1.AuthorizationDetailsTypesCreationModel;
import org.wso2.carbon.identity.api.server.api.resource.v1.ScopeCreationModel;
import javax.validation.constraints.*;

Expand All @@ -41,6 +42,10 @@ public class APIResourcePatchModel {

private List<String> removedScopes = null;

private List<AuthorizationDetailsTypesCreationModel> addedAuthorizationDetailsTypes = null;

private List<String> removedAuthorizationDetailsTypes = null;


/**
**/
Expand Down Expand Up @@ -131,6 +136,58 @@ public APIResourcePatchModel addRemovedScopesItem(String removedScopesItem) {
return this;
}

/**
**/
public APIResourcePatchModel addedAuthorizationDetailsTypes(List<AuthorizationDetailsTypesCreationModel> addedAuthorizationDetailsTypes) {

this.addedAuthorizationDetailsTypes = addedAuthorizationDetailsTypes;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("addedAuthorizationDetailsTypes")
@Valid
public List<AuthorizationDetailsTypesCreationModel> getAddedAuthorizationDetailsTypes() {
return addedAuthorizationDetailsTypes;
}
public void setAddedAuthorizationDetailsTypes(List<AuthorizationDetailsTypesCreationModel> addedAuthorizationDetailsTypes) {
this.addedAuthorizationDetailsTypes = addedAuthorizationDetailsTypes;
}

public APIResourcePatchModel addAddedAuthorizationDetailsTypesItem(AuthorizationDetailsTypesCreationModel addedAuthorizationDetailsTypesItem) {
if (this.addedAuthorizationDetailsTypes == null) {
this.addedAuthorizationDetailsTypes = new ArrayList<AuthorizationDetailsTypesCreationModel>();
}
this.addedAuthorizationDetailsTypes.add(addedAuthorizationDetailsTypesItem);
return this;
}

/**
**/
public APIResourcePatchModel removedAuthorizationDetailsTypes(List<String> removedAuthorizationDetailsTypes) {

this.removedAuthorizationDetailsTypes = removedAuthorizationDetailsTypes;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("removedAuthorizationDetailsTypes")
@Valid
public List<String> getRemovedAuthorizationDetailsTypes() {
return removedAuthorizationDetailsTypes;
}
public void setRemovedAuthorizationDetailsTypes(List<String> removedAuthorizationDetailsTypes) {
this.removedAuthorizationDetailsTypes = removedAuthorizationDetailsTypes;
}

public APIResourcePatchModel addRemovedAuthorizationDetailsTypesItem(String removedAuthorizationDetailsTypesItem) {
if (this.removedAuthorizationDetailsTypes == null) {
this.removedAuthorizationDetailsTypes = new ArrayList<String>();
}
this.removedAuthorizationDetailsTypes.add(removedAuthorizationDetailsTypesItem);
return this;
}



@Override
Expand All @@ -146,12 +203,14 @@ public boolean equals(java.lang.Object o) {
return Objects.equals(this.name, apIResourcePatchModel.name) &&
Objects.equals(this.description, apIResourcePatchModel.description) &&
Objects.equals(this.addedScopes, apIResourcePatchModel.addedScopes) &&
Objects.equals(this.removedScopes, apIResourcePatchModel.removedScopes);
Objects.equals(this.removedScopes, apIResourcePatchModel.removedScopes) &&
Objects.equals(this.addedAuthorizationDetailsTypes, apIResourcePatchModel.addedAuthorizationDetailsTypes) &&
Objects.equals(this.removedAuthorizationDetailsTypes, apIResourcePatchModel.removedAuthorizationDetailsTypes);
}

@Override
public int hashCode() {
return Objects.hash(name, description, addedScopes, removedScopes);
return Objects.hash(name, description, addedScopes, removedScopes, addedAuthorizationDetailsTypes, removedAuthorizationDetailsTypes);
}

@Override
Expand All @@ -164,6 +223,8 @@ public String toString() {
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" addedScopes: ").append(toIndentedString(addedScopes)).append("\n");
sb.append(" removedScopes: ").append(toIndentedString(removedScopes)).append("\n");
sb.append(" addedAuthorizationDetailsTypes: ").append(toIndentedString(addedAuthorizationDetailsTypes)).append("\n");
sb.append(" removedAuthorizationDetailsTypes: ").append(toIndentedString(removedAuthorizationDetailsTypes)).append("\n");
sb.append("}");
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com).
* Copyright (c) 2025, 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
Expand All @@ -24,6 +24,7 @@
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.wso2.carbon.identity.api.server.api.resource.v1.AuthorizationDetailsTypesGetModel;
import org.wso2.carbon.identity.api.server.api.resource.v1.Property;
import org.wso2.carbon.identity.api.server.api.resource.v1.ScopeGetModel;
import org.wso2.carbon.identity.api.server.api.resource.v1.SubscribedApplicationGetModel;
Expand All @@ -45,6 +46,8 @@ public class APIResourceResponse {
private Boolean requiresAuthorization;
private List<ScopeGetModel> scopes = null;

private List<AuthorizationDetailsTypesGetModel> authorizationDetailsTypes = null;

private List<SubscribedApplicationGetModel> subscribedApplications = null;

private List<Property> properties = null;
Expand Down Expand Up @@ -193,6 +196,32 @@ public APIResourceResponse addScopesItem(ScopeGetModel scopesItem) {

/**
**/
public APIResourceResponse authorizationDetailsTypes(List<AuthorizationDetailsTypesGetModel> authorizationDetailsTypes) {

this.authorizationDetailsTypes = authorizationDetailsTypes;
return this;
}

@ApiModelProperty(value = "")
@JsonProperty("authorizationDetailsTypes")
@Valid
public List<AuthorizationDetailsTypesGetModel> getAuthorizationDetailsTypes() {
return authorizationDetailsTypes;
}
public void setAuthorizationDetailsTypes(List<AuthorizationDetailsTypesGetModel> authorizationDetailsTypes) {
this.authorizationDetailsTypes = authorizationDetailsTypes;
}

public APIResourceResponse addAuthorizationDetailsTypesItem(AuthorizationDetailsTypesGetModel authorizationDetailsTypesItem) {
if (this.authorizationDetailsTypes == null) {
this.authorizationDetailsTypes = new ArrayList<AuthorizationDetailsTypesGetModel>();
}
this.authorizationDetailsTypes.add(authorizationDetailsTypesItem);
return this;
}

/**
**/
public APIResourceResponse subscribedApplications(List<SubscribedApplicationGetModel> subscribedApplications) {

this.subscribedApplications = subscribedApplications;
Expand Down Expand Up @@ -282,14 +311,15 @@ public boolean equals(java.lang.Object o) {
Objects.equals(this.type, apIResourceResponse.type) &&
Objects.equals(this.requiresAuthorization, apIResourceResponse.requiresAuthorization) &&
Objects.equals(this.scopes, apIResourceResponse.scopes) &&
Objects.equals(this.authorizationDetailsTypes, apIResourceResponse.authorizationDetailsTypes) &&
Objects.equals(this.subscribedApplications, apIResourceResponse.subscribedApplications) &&
Objects.equals(this.properties, apIResourceResponse.properties) &&
Objects.equals(this.self, apIResourceResponse.self);
}

@Override
public int hashCode() {
return Objects.hash(id, name, description, identifier, type, requiresAuthorization, scopes, subscribedApplications, properties, self);
return Objects.hash(id, name, description, identifier, type, requiresAuthorization, scopes, authorizationDetailsTypes, subscribedApplications, properties, self);
}

@Override
Expand All @@ -305,6 +335,7 @@ public String toString() {
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" requiresAuthorization: ").append(toIndentedString(requiresAuthorization)).append("\n");
sb.append(" scopes: ").append(toIndentedString(scopes)).append("\n");
sb.append(" authorizationDetailsTypes: ").append(toIndentedString(authorizationDetailsTypes)).append("\n");
sb.append(" subscribedApplications: ").append(toIndentedString(subscribedApplications)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
sb.append(" self: ").append(toIndentedString(self)).append("\n");
Expand Down
Loading
Loading