Skip to content

Commit

Permalink
feat(jans-config-api): user management api
Browse files Browse the repository at this point in the history
  • Loading branch information
pujavs committed Apr 6, 2022
1 parent 58ab751 commit a034bc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.jans.as.common.model.common.User;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.rest.model.SearchRequest;
import io.jans.configapi.service.auth.UsrService;
import io.jans.configapi.service.auth.UserService;
import io.jans.configapi.util.ApiAccessConstants;
import io.jans.configapi.util.ApiConstants;
import io.jans.configapi.core.util.Jackson;
Expand Down Expand Up @@ -42,26 +42,26 @@ public class UserResource extends BaseResource {
Logger logger;

@Inject
UsrService userSrv;
UserService userSrv;

@GET
@ProtectedApi(scopes = { ApiAccessConstants.USER_READ_ACCESS })
public Response getOpenIdConnectClients(
public Response getUsers(
@DefaultValue(DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@DefaultValue(DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
@QueryParam(value = ApiConstants.SORT_BY) String sortBy,
@QueryParam(value = ApiConstants.SORT_ORDER) String sortOrder) {
if (logger.isDebugEnabled()) {
logger.debug("User serach param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
logger.debug("User search param - limit:{}, pattern:{}, startIndex:{}, sortBy:{}, sortOrder:{}",
escapeLog(limit), escapeLog(pattern), escapeLog(startIndex), escapeLog(sortBy),
escapeLog(sortOrder));
}
SearchRequest searchReq = createSearchRequest(userSrv.getPeopleBaseDn(), pattern, sortBy, sortOrder, startIndex,
limit, null, null);

final List<User> users = this.doSearch(searchReq);
logger.debug("User serach result:{}", users);
logger.debug("User search result:{}", users);
return Response.ok(users).build();
}

Expand All @@ -70,7 +70,7 @@ public Response getOpenIdConnectClients(
@Path(ApiConstants.INUM_PATH)
public Response getUserByInum(@PathParam(ApiConstants.INUM) @NotNull String inum) {
if (logger.isDebugEnabled()) {
logger.debug("User serach by inum:{}", escapeLog(inum));
logger.debug("User search by inum:{}", escapeLog(inum));
}
User user = userSrv.getUserByInum(inum);
logger.debug("user:{}", user);
Expand All @@ -79,7 +79,7 @@ public Response getUserByInum(@PathParam(ApiConstants.INUM) @NotNull String inum

@POST
@ProtectedApi(scopes = { ApiAccessConstants.USER_WRITE_ACCESS })
public Response createOpenIdConnect(@Valid User user) {
public Response createUser(@Valid User user) {
if (logger.isDebugEnabled()) {
logger.debug("User details to be added - user:{}", escapeLog(user));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package io.jans.configapi.service.auth;

import io.jans.as.common.model.common.User;
import io.jans.as.common.service.common.UserService;
import io.jans.as.common.util.AttributeConstants;
import io.jans.as.model.config.StaticConfiguration;
import io.jans.as.model.configuration.AppConfiguration;
Expand All @@ -27,7 +26,7 @@

@ApplicationScoped
@Named("userSrv")
public class UsrService extends UserService {
public class UserService extends io.jans.as.common.service.common.UserService {

@Inject
private Logger logger;
Expand Down

0 comments on commit a034bc3

Please sign in to comment.