Skip to content

Commit

Permalink
fix(config-api): swagger fixes for missing scope and admin-ui paths (#…
Browse files Browse the repository at this point in the history
…2697)

* feat(config-api): swagger fixes

* feat(config-api): swagger fixes
  • Loading branch information
pujavs committed Oct 21, 2022
1 parent adf2a6d commit 6dcbff3
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ private ApiAccessConstants() {
public static final String DATABASE_LDAP_WRITE_ACCESS = "https://jans.io/oauth/config/database/ldap.write";
public static final String DATABASE_LDAP_DELETE_ACCESS = "https://jans.io/oauth/config/database/ldap.delete";

public static final String DATABASE_COUCHBASE_READ_ACCESS = "https://jans.io/oauth/config/database/couchbase.readonly";
public static final String DATABASE_COUCHBASE_WRITE_ACCESS = "https://jans.io/oauth/config/database/couchbase.write";
public static final String DATABASE_COUCHBASE_DELETE_ACCESS = "https://jans.io/oauth/config/database/couchbase.delete";

public static final String DATABASE_SQL_READ_ACCESS = "https://jans.io/oauth/config/database/sql.readonly";
public static final String DATABASE_SQL_WRITE_ACCESS = "https://jans.io/oauth/config/database/sql.write";
public static final String DATABASE_SQL_DELETE_ACCESS = "https://jans.io/oauth/config/database/sql.delete";

public static final String SCRIPTS_READ_ACCESS = "https://jans.io/oauth/config/scripts.readonly";
public static final String SCRIPTS_WRITE_ACCESS = "https://jans.io/oauth/config/scripts.write";
public static final String SCRIPTS_DELETE_ACCESS = "https://jans.io/oauth/config/scripts.delete";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private ApiConstants() {}
public static final String PERSISTENCE = "/persistence";
public static final String DATABASE = "/database";
public static final String LDAP = "/ldap";
public static final String COUCHBASE = "/couchbase";
public static final String SQL = "/sql";
public static final String REDIS = "/redis";
public static final String IN_MEMORY = "/in-memory";
Expand Down
62 changes: 25 additions & 37 deletions jans-config-api/docs/jans-config-api-swagger-auto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ servers:
tags:
- name: Attribute
- name: Default Authentication Method
- name: Cache Configuration
- name: Cache Configuration – Memcached
- name: Cache Configuration – Redis
- name: Cache Configuration – in-Memory
- name: Cache Configuration – Native-Persistence
- name: Configuration – Properties
- name: Fido2 - Configuration
- name: Configuration – SMTP
- name: Configuration – Logging
- name: Configuration – JWK - JSON Web Key (JWK)
- name: Custom Scripts
- name: Database - LDAP configuration
- name: Database - Couchbase configuration
- name: OAuth - OpenID Connect - Clients
- name: OAuth - UMA Resources
- name: OAuth - Scopes
Expand Down Expand Up @@ -2946,20 +2945,20 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
whitePagesCanView:
adminCanEdit:
type: boolean
userCanAccess:
adminCanView:
type: boolean
userCanView:
type: boolean
adminCanView:
type: boolean
adminCanEdit:
userCanAccess:
type: boolean
userCanEdit:
type: boolean
adminCanAccess:
type: boolean
whitePagesCanView:
type: boolean
baseDn:
type: string
PatchRequest:
Expand Down Expand Up @@ -3285,8 +3284,6 @@ components:
format: int32
displayName:
type: string
tokenBindingSupported:
type: boolean
authenticationMethod:
type: string
enum:
Expand All @@ -3298,6 +3295,8 @@ components:
- tls_client_auth
- self_signed_tls_client_auth
- none
tokenBindingSupported:
type: boolean
baseDn:
type: string
inum:
Expand Down Expand Up @@ -3376,6 +3375,9 @@ components:
type: string
jansDefaultPromptLogin:
type: boolean
idTokenLifetime:
type: integer
format: int32
CustomObjectAttribute:
type: object
properties:
Expand All @@ -3387,24 +3389,24 @@ components:
type: array
items:
type: object
value:
type: object
displayValue:
type: string
value:
type: object
LocalizedString:
type: object
properties:
values:
type: object
additionalProperties:
type: string
value:
type: string
languageTags:
uniqueItems: true
type: array
items:
type: string
value:
type: string
AppConfiguration:
type: object
properties:
Expand Down Expand Up @@ -4093,15 +4095,6 @@ components:
$ref: '#/components/schemas/SsaConfiguration'
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
items:
type: string
enum:
- code
- token
- id_token
enabledFeatureFlags:
uniqueItems: true
type: array
Expand Down Expand Up @@ -4129,6 +4122,15 @@ components:
- STAT
- PAR
- SSA
allResponseTypesSupported:
uniqueItems: true
type: array
items:
type: string
enum:
- code
- token
- id_token
AuthenticationFilter:
required:
- baseDn
Expand Down Expand Up @@ -4919,12 +4921,6 @@ components:
related information
https://jans.io/oauth/config/database/ldap.delete: Delete LDAP database
related information
https://jans.io/oauth/config/database/couchbase.readonly: View Couchbase
database information
https://jans.io/oauth/config/database/couchbase.write: Manage Couchbase
database related information
https://jans.io/oauth/config/database/couchbase.delete: Delete Couchbase
database related information
https://jans.io/oauth/config/scripts.readonly: View cache scripts information
https://jans.io/oauth/config/scripts.write: Manage scripts related information
https://jans.io/oauth/config/scripts.delete: Delete scripts related information
Expand All @@ -4937,6 +4933,7 @@ components:
https://jans.io/oauth/config/logging.write: Manage logging related information
https://jans.io/oauth/config/jwks.readonly: View JWKS related information
https://jans.io/oauth/config/jwks.write: Manage JWKS related information
https://jans.io/oauth/config/jwks.delete: Delete JWKS related information
https://jans.io/oauth/config/openid/clients.readonly: View clients related
information
https://jans.io/oauth/config/openid/clients.write: Manage clients related
Expand All @@ -4952,20 +4949,11 @@ components:
related information
https://jans.io/oauth/config/uma/resources.delete: Delete UMA Resource
related information
https://jans.io/oauth/config/database/sql.readonly: View SQL database
related information
https://jans.io/oauth/config/database/sql.write: Manage SQL database related
information
https://jans.io/oauth/config/database/sql.delete: Delete SQL database
related information
https://jans.io/oauth/config/stats.readonly: View server with basic statistic
https://jans.io/oauth/config/organization.readonly: View organization
configuration information
https://jans.io/oauth/config/organization.write: Manage organization configuration
information
https://jans.io/oauth/config/user.readonly: View user related information
https://jans.io/oauth/config/user.write: Manage user related information
https://jans.io/oauth/config/user.delete: Delete user related information
https://jans.io/oauth/config/agama.readonly: View Agama Flow related information
https://jans.io/oauth/config/agama.write: Manage Agama Flow related information
https://jans.io/oauth/config/agama.delete: Delete Agama Flow related information
Expand Down
16 changes: 5 additions & 11 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ tags:
- name: Configuration – JWK - JSON Web Key (JWK)
- name: Custom Scripts
- name: Database - LDAP configuration
- name: Database - Couchbase configuration
- name: OAuth - OpenID Connect - Clients
- name: OAuth - UMA Resources
- name: OAuth - Scopes
Expand Down Expand Up @@ -1585,7 +1584,7 @@ paths:
'500':
description: Internal Server Error
security:
- oauth2: [https://jans.io/oauth/config/jwks.write]
- oauth2: [https://jans.io/oauth/config/jwks.delete]
/jans-config-api/api/v1/openid/clients:
get:
tags:
Expand Down Expand Up @@ -2965,7 +2964,7 @@ paths:
'500':
description: Internal Server Error

/jans-config-api/admin-ui/user/roles:
/jans-config-api/admin-ui/adminUIRoles:
get:
tags:
- Admin UI - Role
Expand Down Expand Up @@ -3087,7 +3086,7 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/jans-config-api/admin-ui/user/permissions:
/jans-config-api/admin-ui/adminUIPermissions:
get:
tags:
- Admin UI - Permission
Expand Down Expand Up @@ -3209,7 +3208,7 @@ paths:
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalServerError'
/jans-config-api/admin-ui/user/rolePermissionsMapping:
/jans-config-api/admin-ui/adminUIRolePermissionsMapping:
get:
tags:
- Admin UI - Role-Permissions Mapping
Expand Down Expand Up @@ -3495,9 +3494,6 @@ components:
https://jans.io/oauth/config/database/ldap.readonly: View LDAP database related information
https://jans.io/oauth/config/database/ldap.write: Manage LDAP database related information
https://jans.io/oauth/config/database/ldap.delete: Delete LDAP database related information
https://jans.io/oauth/config/database/couchbase.readonly: View Couchbase database information
https://jans.io/oauth/config/database/couchbase.write: Manage Couchbase database related information
https://jans.io/oauth/config/database/couchbase.delete: Delete Couchbase database related information
https://jans.io/oauth/config/scripts.readonly: View cache scripts information
https://jans.io/oauth/config/scripts.write: Manage scripts related information
https://jans.io/oauth/config/scripts.delete: Delete scripts related information
Expand All @@ -3510,6 +3506,7 @@ components:
https://jans.io/oauth/config/logging.write: Manage logging related information
https://jans.io/oauth/config/jwks.readonly: View JWKS related information
https://jans.io/oauth/config/jwks.write: Manage JWKS related information
https://jans.io/oauth/config/jwks.delete: Delete JWKS related information
https://jans.io/oauth/config/openid/clients.readonly: View clients related information
https://jans.io/oauth/config/openid/clients.write: Manage clients related information
https://jans.io/oauth/config/openid/clients.delete: Delete clients related information
Expand All @@ -3519,9 +3516,6 @@ components:
https://jans.io/oauth/config/uma/resources.readonly: View UMA Resource related information
https://jans.io/oauth/config/uma/resources.write: Manage UMA Resource related information
https://jans.io/oauth/config/uma/resources.delete: Delete UMA Resource related information
https://jans.io/oauth/config/database/sql.readonly: View SQL database related information
https://jans.io/oauth/config/database/sql.write: Manage SQL database related information
https://jans.io/oauth/config/database/sql.delete: Delete SQL database related information
https://jans.io/oauth/config/stats.readonly: Vew server with basic statistic
https://jans.io/oauth/config/scim/users.read: Vew scim user related information
https://jans.io/oauth/config/scim/users.write: Manage scim user related information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function() {
cacheUrl: baseUrl + '/jans-config-api/api/v1/config/cache',
jwksUrl: baseUrl + '/jans-config-api/api/v1/config/jwks',
ldapUrl: baseUrl + '/jans-config-api/api/v1/config/database/ldap',
couchbaseUrl: baseUrl + '/jans-config-api/api/v1/config/database/couchbase',
openidclients_url: baseUrl + '/jans-config-api/api/v1/openid/clients',
scopes_url: baseUrl + '/jans-config-api/api/v1/scopes',
umaresources_url: baseUrl + '/jans-config-api/api/v1/uma/resources',
Expand Down
3 changes: 0 additions & 3 deletions jans-config-api/plugins/docs/fido2-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ servers:
variables: {}
tags:
- name: Fido2 - Configuration
- name: Admin UI - Permission
- name: Admin UI - Role-Permissions Mapping
- name: Admin UI - License
paths:
/fido2/config:
get:
Expand Down
4 changes: 2 additions & 2 deletions jans-config-api/plugins/docs/user-mgt-plugin-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ components:
type: array
items:
type: object
value:
type: object
displayValue:
type: string
value:
type: object
CustomUser:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jans.configapi.plugin.fido2.rest;

import io.jans.configapi.util.ApiAccessConstants;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.*;
Expand All @@ -17,16 +18,13 @@

license = @License(name = "Apache 2.0", url = "https://github.com/JanssenProject/jans/blob/main/LICENSE")),

tags = { @Tag(name = "Fido2 - Configuration"),
@Tag(name = "Admin UI - Permission"),
@Tag(name = "Admin UI - Role-Permissions Mapping"),
@Tag(name = "Admin UI - License") },
tags = { @Tag(name = "Fido2 - Configuration")},

servers = { @Server(url = "https://jans.io/", description = "The Jans server") })

@SecurityScheme(name = "oauth2", type = SecuritySchemeType.OAUTH2, flows = @OAuthFlows(clientCredentials = @OAuthFlow(tokenUrl = "https://{op-hostname}/.../token", scopes = {
@OAuthScope(name = "https://jans.io/oauth/config/fido2.readonly", description = "View fido2 configuration related information"),
@OAuthScope(name = "https://jans.io/oauth/config/fido2.write", description = "Manage fido2 configuration related information")}
@OAuthScope(name = ApiAccessConstants.FIDO2_CONFIG_READ_ACCESS, description = "View fido2 configuration related information"),
@OAuthScope(name = ApiAccessConstants.FIDO2_CONFIG_WRITE_ACCESS, description = "Manage fido2 configuration related information")}
)))
public class ApiApplication extends Application {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Fido2ConfigResource extends BaseResource {

@Operation(summary = "Gets Jans Authorization Server Fido2 configuration properties", description = "Gets Jans Authorization Server Fido2 configuration properties", operationId = "get-properties-fido2", tags = {
"Fido2 - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = {
"https://jans.io/oauth/config/fido2.readonly" }))
ApiAccessConstants.FIDO2_CONFIG_READ_ACCESS }))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = DbApplicationConfiguration.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
Expand All @@ -67,7 +67,7 @@ public Response getFido2Configuration() throws JsonProcessingException {

@Operation(summary = "Updates Fido2 configuration properties", description = "Updates Fido2 configuration properties", operationId = "put-properties-fido2", tags = {
"Fido2 - Configuration" }, security = @SecurityRequirement(name = "oauth2", scopes = {
"https://jans.io/oauth/config/fido2.write" }))
ApiAccessConstants.FIDO2_CONFIG_WRITE_ACCESS }))
@RequestBody(description = "Fido2Config", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = DbApplicationConfiguration.class)))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Fido2Config", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = String.class))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.HashSet;
import java.util.Set;

import io.jans.configapi.util.ApiAccessConstants;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Contact;
Expand All @@ -27,9 +28,9 @@
servers = { @Server(url = "https://jans.io/", description = "The Jans server") })

@SecurityScheme(name = "oauth2", type = SecuritySchemeType.OAUTH2, flows = @OAuthFlows(clientCredentials = @OAuthFlow(tokenUrl = "https://{op-hostname}/.../token", scopes = {
@OAuthScope(name = "https://jans.io/oauth/config/user.readonly", description = "View user related information"),
@OAuthScope(name = "https://jans.io/oauth/config/user.write", description = "Manage user related information"),
@OAuthScope(name = "https://jans.io/oauth/config/user.delete", description = "Delete user related information")}
@OAuthScope(name = ApiAccessConstants.USER_READ_ACCESS, description = "View user related information"),
@OAuthScope(name = ApiAccessConstants.USER_WRITE_ACCESS, description = "Manage user related information"),
@OAuthScope(name = ApiAccessConstants.USER_DELETE_ACCESS, description = "Delete user related information")}
)))
public class ApiApplication extends Application {

Expand Down
Loading

0 comments on commit 6dcbff3

Please sign in to comment.