Skip to content

Commit

Permalink
fix(jans-config-api): issue UMA scope request being saved as OAUTH (#…
Browse files Browse the repository at this point in the history
…2063)

* bug(jans-config-api): fixed swagger format issue

* fix(jans-config-api): fixed due to couchbase clustter change

* feat(jans-config-api): new endpoint to get UmaResource based on associatedClient

* fix(jans-config-api): swagger spec fix for client attributes

* fix(jans-config-api): reverted the local test properties

* test(jans-config-api): commented test case

* feat(jans-config-api): scim config endpoint enhancment

* feat(jans-config-api): swagger and DTO change for new fields for scim config endpoint

* feat(jans-config-api): swagger and DTO change for new fields for scim config endpoint

* fix(jans-config-api): rectified endpoint url in swagger spec for uma resource

* feat(jans-config-api): agama endpoint fixes

* fix(jans-config-api): agama endpoint enhancements

* fix(jans-config-api): fixed swagger spec for Uma Resource delete

* fix(jans-config-api): agama endpoint enhancements

* fix(jans-config-api): agama endpoint enhancements

* fix(jans-config-api): agama endpoint enhancements

* fix(jans-config-api): agama endpoint enhancements

* fix(jans-config-api): agama endpoint enhancements

* feat(jans-config-api): agama patch endpoint

* feat(jans-config-api): agama patch endpoint

* feat(jans-config-api): agama patch endpoint

* feat(jans-config-api): Scope object changes for creator details

* feat(jans-config-api): Scope object changes for creator details

* fix(jans-config-api): updated agama endpoint for exception handling and not updating metadata

* test(jans-config-api): updates user mgmt test case for POST

* fix(jans-config-api): issue UMA scope request being saved as OAUTH
  • Loading branch information
pujavs committed Aug 9, 2022
1 parent 53a46f5 commit 6f91d00
Showing 1 changed file with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Response getScopes(@DefaultValue("") @QueryParam(ApiConstants.TYPE) Strin
@DefaultValue(DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@DefaultValue("false") @QueryParam(value = ApiConstants.WITH_ASSOCIATED_CLIENTS) boolean withAssociatedClients) {
log.debug("SCOPES to be fetched type = " + type + " , limit = " + limit + " , pattern = " + pattern);
log.debug("SCOPES to be fetched based on type:{}, limit:{}, pattern:{}", type, limit, pattern);
final List<CustomScope> scopes;
if (StringHelper.isNotEmpty(pattern)) {
scopes = scopeService.searchScopes(pattern, limit, type, withAssociatedClients);
Expand All @@ -75,8 +75,8 @@ public Response getScopes(@DefaultValue("") @QueryParam(ApiConstants.TYPE) Strin
@ProtectedApi(scopes = { ApiAccessConstants.SCOPES_READ_ACCESS })
@Path(ApiConstants.INUM_PATH)
public Response getScopeById(@NotNull @PathParam(ApiConstants.INUM) String inum,
@DefaultValue("false") @QueryParam(value = ApiConstants.WITH_ASSOCIATED_CLIENTS) boolean withAssociatedClients) {
log.debug("SCOPES to be fetched - inum = " + inum);
@DefaultValue("false") @QueryParam(value = ApiConstants.WITH_ASSOCIATED_CLIENTS) boolean withAssociatedClients) {
log.debug("SCOPES to be fetched by inum:{}", inum);
CustomScope scope = scopeService.getScopeByInum(inum, withAssociatedClients);
checkResourceNotNull(scope, SCOPE);
return Response.ok(scope).build();
Expand All @@ -85,8 +85,8 @@ public Response getScopeById(@NotNull @PathParam(ApiConstants.INUM) String inum,
@POST
@ProtectedApi(scopes = { ApiAccessConstants.SCOPES_WRITE_ACCESS })
public Response createOpenidScope(@Valid Scope scope) {
log.debug("SCOPE to be added - scope = " + scope);
log.debug("SCOPE to be added - scope.getId() = " + scope.getId());
log.debug("SCOPE to be added - scope:{}", scope);

checkNotNull(scope.getId(), AttributeNames.ID);
if (scope.getDisplayName() == null) {
scope.setDisplayName(scope.getId());
Expand All @@ -97,35 +97,31 @@ public Response createOpenidScope(@Valid Scope scope) {
if (scope.getScopeType() == null) {
scope.setScopeType(ScopeType.OAUTH);
}
if (ScopeType.UMA.getValue().equalsIgnoreCase(scope.getScopeType().getValue())) {
scope.setScopeType(ScopeType.OAUTH);
}

scopeService.addScope(scope);
Scope result = scopeService.getScopeByInum(inum);
log.debug("SCOPE added is - " + result.getId());
log.debug("Id of newly added is {}", result.getId());
return Response.status(Response.Status.CREATED).entity(result).build();
}

@PUT
@ProtectedApi(scopes = { ApiAccessConstants.SCOPES_WRITE_ACCESS })
public Response updateScope(@Valid Scope scope) {
log.debug("SCOPE to be updated - scope = " + scope.getId());
log.debug("SCOPE to be updated - scop:{}", scope.getId());
String inum = scope.getInum();
checkNotNull(inum, SCOPE);
Scope existingScope = scopeService.getScopeByInum(inum);
checkResourceNotNull(existingScope, SCOPE);
if (scope.getScopeType() == null) {
scope.setScopeType(ScopeType.OAUTH);
}
if (ScopeType.UMA.getValue().equalsIgnoreCase(scope.getScopeType().getValue())) {
scope.setScopeType(ScopeType.OAUTH);
}

scope.setInum(existingScope.getInum());
scope.setBaseDn(scopeService.getDnForScope(inum));
scopeService.updateScope(scope);
Scope result = scopeService.getScopeByInum(inum);

log.debug("SCOPE updated is - " + result.getId());
log.debug("Updated scope:{}", result.getId());
return Response.ok(result).build();
}

Expand All @@ -135,14 +131,14 @@ public Response updateScope(@Valid Scope scope) {
@Path(ApiConstants.INUM_PATH)
public Response patchScope(@PathParam(ApiConstants.INUM) @NotNull String inum, @NotNull String pathString)
throws JsonPatchException, IOException {
log.debug("SCOPES to be patched - inum = " + inum + " , pathString = " + pathString);
log.debug("SCOPES patch details - inum:{}, pathString:{}", inum, pathString);
Scope existingScope = scopeService.getScopeByInum(inum);
checkResourceNotNull(existingScope, SCOPE);
existingScope = Jackson.applyPatch(pathString, existingScope);
scopeService.updateScope(existingScope);

existingScope = scopeService.getScopeByInum(inum);
log.debug("SCOPE patched is - " + existingScope.getId());
log.debug("patched scope:{}", existingScope.getId());

return Response.ok(existingScope).build();
}
Expand All @@ -151,7 +147,7 @@ public Response patchScope(@PathParam(ApiConstants.INUM) @NotNull String inum, @
@Path(ApiConstants.INUM_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.SCOPES_DELETE_ACCESS })
public Response deleteScope(@PathParam(ApiConstants.INUM) @NotNull String inum) {
log.debug("SCOPES to be deleted - inum = " + inum);
log.debug("SCOPES to be deleted - inum:{}", inum);
Scope scope = scopeService.getScopeByInum(inum);
checkResourceNotNull(scope, SCOPE);
scopeService.removeScope(scope);
Expand Down

0 comments on commit 6f91d00

Please sign in to comment.