Skip to content

Commit

Permalink
feat(config-api): new endpoint to fetch feature flag except UNKOWN (#…
Browse files Browse the repository at this point in the history
…6779)

* fix(config-api): source LDAP server test

* feat(config-api): pom changes for org json

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): sync with main

Signed-off-by: pujavs <pujas.works@gmail.com>

* docs(config-api): issue 6382 - regen spec to reflect new fields in ClientAttributes

Signed-off-by: pujavs <pujas.works@gmail.com>

* feat(config-api): json dependency changes

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): json build issue and saml plugin swagger spec annotation

Signed-off-by: pujavs <pujas.works@gmail.com>

* docs(config-api): auth featureFlags should be described as enum in spec

Signed-off-by: pujavs <pujas.works@gmail.com>

* docs(saml-plugin): saml swagger spec rectification #6604

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): made clientId optional for TR and customScript changes for returning types

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): new endpoint to return featureflag - issue#6612

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): feature flag endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): feature flag endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

* fix(config-api): feature flag endpoint

Signed-off-by: pujavs <pujas.works@gmail.com>

---------

Signed-off-by: pujavs <pujas.works@gmail.com>
  • Loading branch information
pujavs committed Nov 28, 2023
1 parent 14fb5b4 commit cba403b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private ApiConstants() {}
public static final String GRANT_TYPES = "/grant-types";
public static final String CACHE = "/cache";
public static final String PERSISTENCE = "/persistence";
public static final String FEATURE_FLAGS = "/feature-flags";
public static final String DATABASE = "/database";
public static final String LDAP = "/ldap";
public static final String SQL = "/sql";
Expand Down
35 changes: 29 additions & 6 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,29 @@ paths:
security:
- oauth2:
- https://jans.io/oauth/jans-auth-server/config/properties.write
/api/v1/jans-auth-server/config/feature-flags:
get:
tags:
- Configuration – Properties
summary: Returns feature flags type configured for Jans authorization server.
description: Returns feature flags type configured for Jans authorization server.
operationId: get-feature-flag-type
responses:
"200":
description: Ok
content:
application/json:
schema:
type: array
items:
type: string
"401":
description: Unauthorized
"500":
description: InternalServerError
security:
- oauth2:
- https://jans.io/oauth/jans-auth-server/config/properties.readonly
/api/v1/jans-auth-server/config/persistence:
get:
tags:
Expand Down Expand Up @@ -7586,18 +7609,18 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
userCanView:
userCanEdit:
type: boolean
adminCanView:
type: boolean
userCanEdit:
userCanView:
type: boolean
adminCanEdit:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
type: boolean
adminCanAccess:
type: boolean
whitePagesCanView:
type: boolean
baseDn:
Expand Down Expand Up @@ -8399,8 +8422,6 @@ components:
type: boolean
skipAuthenticationFilterOptionsMethod:
type: boolean
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
Expand All @@ -8410,6 +8431,8 @@ components:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
required:
- baseDn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.github.fge.jsonpatch.JsonPatchException;
import io.jans.agama.model.EngineConfig;
import io.jans.as.model.config.Conf;
import io.jans.as.model.common.FeatureFlagType;
import io.jans.as.model.configuration.AppConfiguration;
import io.jans.configapi.core.rest.ProtectedApi;
import io.jans.configapi.service.auth.ConfigurationService;
Expand All @@ -27,6 +28,7 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.*;

import java.util.EnumSet;
import jakarta.inject.Inject;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.*;
Expand All @@ -48,7 +50,7 @@ public class AuthConfigResource extends ConfigBaseResource {

@Inject
ConfigurationService configurationService;

@Operation(summary = "Gets all Jans authorization server configuration properties.", description = "Gets all Jans authorization server configuration properties.", operationId = "get-properties", tags = {
"Configuration – Properties" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.JANS_AUTH_CONFIG_READ_ACCESS }))
Expand Down Expand Up @@ -119,6 +121,27 @@ public Response getPersistenceDetails() {
log.debug("AuthConfigResource::getPersistenceDetails() - persistenceConfiguration:{}", persistenceConfiguration);
return Response.ok(persistenceConfiguration).build();
}


@Operation(summary = "Returns feature flags type configured for Jans authorization server.", description = "Returns feature flags type configured for Jans authorization server.", operationId = "get-feature-flag-type", tags = {
"Configuration – Properties" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.JANS_AUTH_CONFIG_READ_ACCESS }))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, array = @ArraySchema(schema = @Schema(implementation = String.class, type="enum")))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@ProtectedApi(scopes = { ApiAccessConstants.JANS_AUTH_CONFIG_READ_ACCESS }, groupScopes = {
ApiAccessConstants.JANS_AUTH_CONFIG_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
@Path(ApiConstants.FEATURE_FLAGS)
public Response getFeatureFlagType() {
EnumSet<FeatureFlagType> set = EnumSet.allOf(FeatureFlagType.class);
set.remove(FeatureFlagType.UNKNOWN);
log.debug("set:{}", set);
return Response.ok(set).build();
}


private void validateAgamaConfiguration(EngineConfig engineConfig) {
log.debug("engineConfig:{}", engineConfig);
Expand All @@ -132,4 +155,5 @@ private void validateAgamaConfiguration(EngineConfig engineConfig) {
+ engineConfig.getMaxItemsLoggedInCollections());
}
}

}

0 comments on commit cba403b

Please sign in to comment.