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

jans(config-api): static scope id and feature and admin level scopes #3126

Merged
merged 42 commits into from
Nov 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fe98d92
fix(config-api): fix for swagger spec for scope creation and sessoin …
pujavs Nov 9, 2022
b203afe
ci: add yurem to linux setup codeowners
moabu Nov 9, 2022
dbe60b7
chore(image): sync missing localized attributes for sql and spanner (…
iromli Nov 9, 2022
b725ec7
Update restarting-services.md (#2941)
mzico Nov 9, 2022
3baba92
Update restarting-services.md (#2942)
mzico Nov 9, 2022
90c549b
Update restarting-services.md (#2943)
mzico Nov 9, 2022
a26ef90
feat: allow to use like with lower together (#2944)
yuremm Nov 9, 2022
22a8277
chore: remove unused merthod (#2945)
yuremm Nov 9, 2022
dc9d6e3
feat(jans-auth-server): corrected GluuOrganization - refactor getOrga…
yuriyz Nov 9, 2022
f552021
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 10, 2022
f7a1b83
feat(config-api): super scope implementation
pujavs Nov 10, 2022
0547c1d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 11, 2022
7046426
feat(config-api): static scope
pujavs Nov 11, 2022
fda660f
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 15, 2022
5cb0857
feat(config-api): comprehensive claims for authurization
pujavs Nov 15, 2022
c45946c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 15, 2022
227b035
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 15, 2022
0f3c44d
feat(config-api): endpoint group and admin scope
pujavs Nov 16, 2022
b516d01
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 16, 2022
30578ea
feat(config-api): sync with main
pujavs Nov 16, 2022
d125213
feat(config-api): endpoint group and admin scope
pujavs Nov 16, 2022
7b28e68
feat(config-api): scope change - wip
pujavs Nov 22, 2022
75f7d7b
feat(config-api): scope change - wip
pujavs Nov 22, 2022
7a29e9d
feat(config-api): scope change - wip
pujavs Nov 22, 2022
ca3e06b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 23, 2022
a145318
feat(config-api): scope enhancements
pujavs Nov 23, 2022
1c020c3
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 24, 2022
2b446ff
feat(config-api): scope enhancement
pujavs Nov 24, 2022
a3fc82e
feat(config-api): scope enhancement wip
pujavs Nov 25, 2022
b3e16d6
feat(config-api): scope enhancement wip
pujavs Nov 25, 2022
90bf084
feat(config-api): scope enhancement- wip
pujavs Nov 28, 2022
f7c1498
feat(config-api): scope enhancement- wip
pujavs Nov 28, 2022
43b8f6b
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 29, 2022
35b3dc9
feat: jans-linux-setup config-api scope creation with static inum (re…
devrimyatar Nov 29, 2022
0aff4ba
feat(config-api): scope enhancement - wip
pujavs Nov 29, 2022
52a7f34
Merge branch 'jans-config-fixes' of https://github.com/JanssenProject…
pujavs Nov 29, 2022
46549b9
fix: jans-linux-setup create scope if inum exists (ref: #3097)
devrimyatar Nov 29, 2022
749d214
feat: jans-linux-setup config-api scope creation (ref: #3097)
devrimyatar Nov 29, 2022
6c24268
feat(config-api): scope enhancement - wip
pujavs Nov 29, 2022
32d12bc
Merge branch 'jans-config-fixes' of https://github.com/JanssenProject…
pujavs Nov 29, 2022
11b8f75
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Nov 30, 2022
58ccd92
feat(config-api): scope enhancement
pujavs Nov 30, 2022
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 @@ -69,5 +69,18 @@ private ApiAccessConstants() {
public static final String JANS_AUTH_SESSION_READ_ACCESS = "https://jans.io/oauth/jans-auth-server/session.readonly";
public static final String JANS_AUTH_SESSION_DELETE_ACCESS = "https://jans.io/oauth/jans-auth-server/session.delete";
public static final String JANS_AUTH_REVOKE_SESSION = "revoke_session";


// Super Scopes
public static final String SUPER_ADMIN_READ_ACCESS = "https://jans.io/oauth/config/read-all";
public static final String SUPER_ADMIN_WRITE_ACCESS = "https://jans.io/oauth/config/write-all";
public static final String SUPER_ADMIN_DELETE_ACCESS = "https://jans.io/oauth/config/delete-all";

// Feature Scope
public static final String OPENID_READ_ACCESS = "https://jans.io/oauth/config/openid-read";
public static final String OPENID_WRITE_ACCESS = "https://jans.io/oauth/config/openid/openid-write";
public static final String OPENID_DELETE_ACCESS = "https://jans.io/oauth/config/openid/openid-delete";

public static final String UMA_READ_ACCESS = "https://jans.io/oauth/config/uma-read";
public static final String UMA_WRITE_ACCESS = "https://jans.io/oauth/config/uma-write";
public static final String UMA_DELETE_ACCESS = "https://jans.io/oauth/config/uma-delete";
}
46 changes: 31 additions & 15 deletions jans-config-api/docs/jans-config-api-swagger-auto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ paths:
security:
- oauth2:
- https://jans.io/oauth/config/acrs.readonly
- https://jans.io/oauth/config/acrs.write
- https://jans.io/oauth/config/read-all
put:
tags:
- Default Authentication Method
Expand Down Expand Up @@ -167,6 +169,7 @@ paths:
security:
- oauth2:
- https://jans.io/oauth/config/acrs.write
- https://jans.io/oauth/config/write-all
/api/v1/agama:
get:
tags:
Expand Down Expand Up @@ -243,6 +246,8 @@ paths:
security:
- oauth2:
- https://jans.io/oauth/config/agama.readonly
- https://jans.io/oauth/config/agama.write
- https://jans.io/oauth/config/read-all
post:
tags:
- Configuration – Agama Flow
Expand Down Expand Up @@ -333,6 +338,8 @@ paths:
security:
- oauth2:
- https://jans.io/oauth/config/agama.readonly
- https://jans.io/oauth/config/agama.write
- https://jans.io/oauth/config/read-all
post:
tags:
- Configuration – Agama Flow
Expand Down Expand Up @@ -7178,19 +7185,19 @@ components:
$ref: '#/components/schemas/AttributeValidation'
tooltip:
type: string
whitePagesCanView:
adminCanEdit:
type: boolean
adminCanAccess:
userCanEdit:
type: boolean
adminCanView:
type: boolean
userCanAccess:
userCanView:
type: boolean
adminCanEdit:
adminCanAccess:
type: boolean
userCanView:
userCanAccess:
type: boolean
userCanEdit:
whitePagesCanView:
type: boolean
baseDn:
type: string
Expand Down Expand Up @@ -7620,6 +7627,15 @@ components:
format: int32
allowOfflineAccessWithoutConsent:
type: boolean
minimumAcrLevel:
type: integer
format: int32
minimumAcrLevelAutoresolve:
type: boolean
minimumAcrPriorityList:
type: array
items:
type: string
CustomObjectAttribute:
type: object
properties:
Expand Down Expand Up @@ -8334,6 +8350,15 @@ components:
$ref: '#/components/schemas/EngineConfig'
ssaConfiguration:
$ref: '#/components/schemas/SsaConfiguration'
allResponseTypesSupported:
uniqueItems: true
type: array
items:
type: string
enum:
- code
- token
- id_token
enabledFeatureFlags:
uniqueItems: true
type: array
Expand Down Expand Up @@ -8361,15 +8386,6 @@ components:
- STAT
- PAR
- SSA
allResponseTypesSupported:
uniqueItems: true
type: array
items:
type: string
enum:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
Expand Down
8 changes: 4 additions & 4 deletions jans-config-api/profiles/local/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
test.scopes=https://jans.io/oauth/config/acrs.readonly https://jans.io/oauth/config/acrs.write https://jans.io/oauth/config/attributes.readonly https://jans.io/oauth/config/attributes.write https://jans.io/oauth/config/attributes.delete https://jans.io/oauth/config/cache.readonly https://jans.io/oauth/config/cache.write https://jans.io/oauth/config/openid/clients.readonly https://jans.io/oauth/config/openid/clients.write https://jans.io/oauth/config/openid/clients.delete https://jans.io/oauth/jans-auth-server/config/properties.readonly https://jans.io/oauth/jans-auth-server/config/properties.write https://jans.io/oauth/config/smtp.readonly https://jans.io/oauth/config/smtp.write https://jans.io/oauth/config/smtp.delete https://jans.io/oauth/config/scripts.readonly https://jans.io/oauth/config/scripts.write https://jans.io/oauth/config/scripts.delete https://jans.io/oauth/config/fido2.readonly https://jans.io/oauth/config/fido2.write https://jans.io/oauth/config/jwks.readonly https://jans.io/oauth/config/jwks.write https://jans.io/oauth/config/jwks.delete https://jans.io/oauth/config/database/ldap.readonly https://jans.io/oauth/config/database/ldap.write https://jans.io/oauth/config/database/ldap.delete https://jans.io/oauth/config/logging.readonly https://jans.io/oauth/config/logging.write https://jans.io/oauth/config/scopes.readonly https://jans.io/oauth/config/scopes.write https://jans.io/oauth/config/scopes.delete https://jans.io/oauth/config/uma/resources.readonly https://jans.io/oauth/config/uma/resources.write https://jans.io/oauth/config/uma/resources.delete https://jans.io/oauth/config/database/sql.readonly https://jans.io/oauth/config/database/sql.write https://jans.io/oauth/config/database/sql.delete https://jans.io/oauth/config/stats.readonly jans_stat https://jans.io/scim/users.read https://jans.io/scim/users.write https://jans.io/oauth/config/scim/users.read https://jans.io/oauth/config/scim/users.write https://jans.io/scim/config.readonly https://jans.io/scim/config.write https://jans.io/oauth/config/organization.readonly https://jans.io/oauth/config/organization.write https://jans.io/oauth/config/user.readonly https://jans.io/oauth/config/user.write https://jans.io/oauth/config/user.delete https://jans.io/oauth/config/agama.readonly https://jans.io/oauth/config/agama.write https://jans.io/oauth/config/agama.delete https://jans.io/oauth/jans-auth-server/session.readonly https://jans.io/oauth/jans-auth-server/session.delete revoke_session

# jans.server
token.endpoint=https://jans.server2/jans-auth/restv1/token
token.endpoint=https://jans.server1/jans-auth/restv1/token
token.grant.type=client_credentials
test.client.id=1800.768b3d38-a6e8-4be4-93d1-72df33d34fd6
test.client.secret=vA2TTjAOTfQY
test.issuer=https://jans.server2/
test.client.id=1800.5957dfad-b2cb-4764-85fe-841e6bc870ff
test.client.secret=ozu4fjIzoEbe
test.issuer=https://jans.server1/
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public PersistenceEntryManager createPersistenceEntryManager() throws OxIntializ
@ApplicationScoped
@Named("authorizationService")
private AuthorizationService createAuthorizationService() {
log.info(
log.error(
"============= AppInitializer::createAuthorizationService() - configurationFactory.getApiProtectionType():{} ",
configurationFactory.getApiProtectionType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ public class AcrsResource extends ConfigBaseResource {

@Operation(summary = "Gets default authentication method.", description = "Gets default authentication method.", operationId = "get-acrs", tags = {
"Default Authentication Method" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.ACRS_READ_ACCESS }))
ApiAccessConstants.ACRS_READ_ACCESS, ApiAccessConstants.ACRS_WRITE_ACCESS,
ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = AuthenticationMethod.class) , examples = @ExampleObject(name = "Response example" , value = "example/acr/acr.json"))),
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = AuthenticationMethod.class), examples = @ExampleObject(name = "Response example", value = "example/acr/acr.json"))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@ProtectedApi(scopes = { ApiAccessConstants.ACRS_READ_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.ACRS_READ_ACCESS }, groupScopes = {
ApiAccessConstants.ACRS_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
public Response getDefaultAuthenticationMethod() {
final GluuConfiguration gluuConfiguration = configurationService.findGluuConfiguration();

Expand All @@ -65,15 +67,16 @@ public Response getDefaultAuthenticationMethod() {

@Operation(summary = "Updates default authentication method.", description = "Updates default authentication method.", operationId = "put-acrs", tags = {
"Default Authentication Method" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.ACRS_WRITE_ACCESS }))
ApiAccessConstants.ACRS_WRITE_ACCESS, ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS }))
@RequestBody(description = "String representing patch-document.", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = AuthenticationMethod.class), examples = @ExampleObject(name = "Request json example", value = "example/acr/acr.json")))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Ok", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = AuthenticationMethod.class))),
@ApiResponse(responseCode = "400", description = "Bad Request"),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@PUT
@ProtectedApi(scopes = { ApiAccessConstants.ACRS_WRITE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.ACRS_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS })
public Response updateDefaultAuthenticationMethod(@NotNull AuthenticationMethod authenticationMethod) {
log.debug("ACRS details to update - authenticationMethod:{}", authenticationMethod);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ public class AgamaResource extends ConfigBaseResource {

@Operation(summary = "Fetches all agama flow.", description = "Fetches all agama flow.", operationId = "get-agama-flows", tags = {
"Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.AGAMA_READ_ACCESS }))
ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS,
ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Agama Flows", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = PagedResult.class), examples = @ExampleObject(name = "Response json example", value = "example/agama/agama-get-all.json"))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = {
ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
public Response getFlows(@DefaultValue("") @QueryParam(value = ApiConstants.PATTERN) String pattern,
@DefaultValue(ApiConstants.DEFAULT_LIST_SIZE) @QueryParam(value = ApiConstants.LIMIT) int limit,
@DefaultValue(ApiConstants.DEFAULT_LIST_START_INDEX) @QueryParam(value = ApiConstants.START_INDEX) int startIndex,
Expand All @@ -90,13 +92,15 @@ public Response getFlows(@DefaultValue("") @QueryParam(value = ApiConstants.PATT

@Operation(summary = "Gets an agama flow based on Qname.", description = "Gets an agama flow based on Qname.", operationId = "get-agama-flow", tags = {
"Configuration – Agama Flow" }, security = @SecurityRequirement(name = "oauth2", scopes = {
ApiAccessConstants.AGAMA_READ_ACCESS }))
ApiAccessConstants.AGAMA_READ_ACCESS, ApiAccessConstants.AGAMA_WRITE_ACCESS,
ApiAccessConstants.SUPER_ADMIN_READ_ACCESS }))
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Agama Flow", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(implementation = Flow.class), examples = @ExampleObject(name = "Response json example", value = "example/agama/agama-get.json"))),
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@GET
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_READ_ACCESS }, groupScopes = {
ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = { ApiAccessConstants.SUPER_ADMIN_READ_ACCESS })
@Path(ApiConstants.QNAME_PATH)
public Response getFlowByName(@PathParam(ApiConstants.QNAME) @NotNull String flowName,
@DefaultValue("false") @QueryParam(value = ApiConstants.INCLUDE_SOURCE) boolean includeSource) {
Expand All @@ -121,7 +125,8 @@ public Response getFlowByName(@PathParam(ApiConstants.QNAME) @NotNull String flo
@ApiResponse(responseCode = "401", description = "Unauthorized"),
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@POST
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS })
public Response createFlow(@Valid Flow flow)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
logger.debug(" Flow to be added flow:{}, flow.getQName():{}, flow.getSource():{} ", flow, flow.getQname(),
Expand Down Expand Up @@ -155,7 +160,8 @@ public Response createFlow(@Valid Flow flow)
@POST
@Consumes(MediaType.TEXT_PLAIN)
@Path(ApiConstants.QNAME_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS })
public Response createFlowFromSource(@PathParam(ApiConstants.QNAME) @NotNull String flowName, @Valid String source)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
logger.debug(" Flow to be created flowName:{}, source:{}", flowName, source);
Expand Down Expand Up @@ -196,7 +202,8 @@ public Response createFlowFromSource(@PathParam(ApiConstants.QNAME) @NotNull Str
@PUT
@Consumes(MediaType.TEXT_PLAIN)
@Path(ApiConstants.SOURCE + ApiConstants.QNAME_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS })
public Response updateFlowSource(@PathParam(ApiConstants.QNAME) @NotNull String flowName, @Valid String source)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
logger.debug(" Flow to be updated flowName:{}, source:{}", flowName, source);
Expand Down Expand Up @@ -232,7 +239,8 @@ public Response updateFlowSource(@PathParam(ApiConstants.QNAME) @NotNull String
@PATCH
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
@Path(ApiConstants.QNAME_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_WRITE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_WRITE_ACCESS })
public Response patchFlow(@PathParam(ApiConstants.QNAME) @NotNull String flowName, @NotNull JsonPatch jsonPatch)
throws JsonPatchException, IOException, NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
Expand Down Expand Up @@ -267,7 +275,8 @@ public Response patchFlow(@PathParam(ApiConstants.QNAME) @NotNull String flowNam
@ApiResponse(responseCode = "500", description = "InternalServerError") })
@DELETE
@Path(ApiConstants.QNAME_PATH)
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_DELETE_ACCESS })
@ProtectedApi(scopes = { ApiAccessConstants.AGAMA_DELETE_ACCESS }, superScopes = {
ApiAccessConstants.SUPER_ADMIN_DELETE_ACCESS })
public Response delete(@PathParam(ApiConstants.QNAME) @NotNull String flowName) {
logger.debug(" Flow to delete - flowName:{}", flowName);
String decodedFlowName = getURLDecodedValue(flowName);
Expand Down
Loading