wso2-extensions / identity-carbon-auth-rest

Apache License 2.0
1 stars 144 forks source link

Improve tenant context rewrite regex patterns #250

Closed sadilchamishka closed 1 year ago

sadilchamishka commented 1 year ago

Proposed changes in this pull request

this.tenantContextPattern = this.isWebApp ? CONSOLE_CONTEXT.equals(context)
                ? Pattern.compile("^/t/([^/]+)(/o|/o/([^/]+))?" + context)
                : Pattern.compile("^/t/([^/]+)(/o)?" + context)
                : Pattern.compile("^/t/([^/]+)" + context);

The rewrite context regex patterns should be improved to allow the below URL paths.

  1. Tenant perspective API resource access. - /t/<tenant-domain>/api/server/v1/applications

  2. Tenant perspective console access - /t/<tenant-domain>/console

  3. Organization perspective API resource access. - /t/<tenant-domain>/o/api/server/v1/applications

  4. Organization perspective console access - /t/<tenant-domain>/o/<org-id>/console

The console context /console/ is separately handled as here.

The above regex validations only applied for webApps. For servlets, keep the existing regex pattern of /t/<tenant-domain>/..

Additional information

The organization context rewrite valve will allow organization qualified servlet and some of the specified webApps accesses ex - oauth2

Related Issues

jenkins-is-staging commented 1 year ago

PR builder started Link: https://github.com/wso2/product-is/actions/runs/6683001630

jenkins-is-staging commented 1 year ago

PR builder started Link: https://github.com/wso2/product-is/actions/runs/6683003377

jenkins-is-staging commented 1 year ago

PR builder completed Link: https://github.com/wso2/product-is/actions/runs/6683003377 Status: success

jenkins-is-staging commented 1 year ago

PR builder completed Link: https://github.com/wso2/product-is/actions/runs/6683001630 Status: failure