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

[Refactor](auth)(step-2) Add AccessController to support customized authorization #16802

Merged
merged 5 commits into from
Feb 20, 2023

Conversation

morningman
Copy link
Contributor

@morningman morningman commented Feb 15, 2023

Proposed changes

Issue Number: #16762

Problem summary

  1. Support specifying AccessControllerFactory when creating catalog

    create catalog hive properties(
    ...
    "access_controller.class" = "org.apache.doris.mysql.privilege.RangerAccessControllerFactory",
    "access_controller.properties.prop1" = "xxx",
    "access_controller.properties.prop2" = "yyy",
    ...
    )
    

    So that user can specified their own access controller, such as RangerAccessController

  2. Add interface to check column level privilege

    A new method of CatalogAccessController: checkColsPriv(),
    for checking column level privileges.

    TODO:
    Support grant column level privileges statements in Doris

  3. Add TestExternalCatalog/Database/Table/ScanNode

    These classes are used for FE unit test. In unit test you can

    create catalog test1 properties(
        "type" = "test"
        "catalog_provider.class" = "org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider"
        "access_controller.class" = "org.apache.doris.mysql.privilege.TestAccessControllerFactory",
        "access_controller.properties.key1" = "val1",
        "access_controller.properties.key2" = "val2"
    );
    

    To create a test catalog, and specify catalog_provider to mock database/table/schema metadata

  4. Set roles in current user identity in connection context

    The roles can be used for authorization in access controller.

Checklist(Required)

  • Does it affect the original behavior
  • Has unit tests been added
  • Has document been added or modified
  • Does it need to update dependencies
  • Is this PR support rollback (If NO, please explain WHY)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@github-actions github-actions bot added the area/planner Issues or PRs related to the query planner label Feb 15, 2023
@morningman morningman added the api-review Categorizes an issue or PR as actively needing an API review. label Feb 15, 2023
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@morningman morningman force-pushed the column_priv_interface branch from 1aba215 to b0be82f Compare February 15, 2023 15:49
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

2 similar comments
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@morningman morningman force-pushed the column_priv_interface branch from 39d744a to e7d51f5 Compare February 16, 2023 02:17
@github-actions github-actions bot added area/load Issues or PRs related to all kinds of load area/nereids labels Feb 16, 2023
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

import java.util.List;

/**
* Elasticsearch external table.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, es?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need a deleteAccessController method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. the access controller will be removed when catalog is dropped

@morningman morningman force-pushed the column_priv_interface branch from e7d51f5 to 6fd56d3 Compare February 17, 2023 16:04
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@morningman morningman force-pushed the column_priv_interface branch from 6fd56d3 to 73d0419 Compare February 18, 2023 14:33
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yiguolei yiguolei merged commit 97230a5 into apache:master Feb 20, 2023
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 20, 2023
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

yagagagaga pushed a commit to yagagagaga/doris that referenced this pull request Mar 9, 2023
…uthorization (apache#16802)

Support specifying AccessControllerFactory when creating catalog

create catalog hive properties(
...
"access_controller.class" = "org.apache.doris.mysql.privilege.RangerAccessControllerFactory",
"access_controller.properties.prop1" = "xxx",
"access_controller.properties.prop2" = "yyy",
...
)
So that user can specified their own access controller, such as RangerAccessController

Add interface to check column level privilege

A new method of CatalogAccessController: checkColsPriv(),
for checking column level privileges.

TODO:
Support grant column level privileges statements in Doris

Add TestExternalCatalog/Database/Table/ScanNode

These classes are used for FE unit test. In unit test you can

create catalog test1 properties(
    "type" = "test"
    "catalog_provider.class" = "org.apache.doris.datasource.ColumnPrivTest$MockedCatalogProvider"
    "access_controller.class" = "org.apache.doris.mysql.privilege.TestAccessControllerFactory",
    "access_controller.properties.key1" = "val1",
    "access_controller.properties.key2" = "val2"
);
To create a test catalog, and specify catalog_provider to mock database/table/schema metadata

Set roles in current user identity in connection context

The roles can be used for authorization in access controller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by one committer. area/load Issues or PRs related to all kinds of load area/nereids area/planner Issues or PRs related to the query planner reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants