cbioportal icon indicating copy to clipboard operation
cbioportal copied to clipboard

feat: implement custom resolvers for custom auth over oauth2

Open Aiosa opened this issue 4 months ago • 0 comments

Resolves #11052

Describe changes proposed in this pull request:

  • SecurityMapper no longer retrieves study groups, these have their own mapper
  • SecurityRepository now is parametrized by another generic object, that is given by the auth configuration to the repository if used. Such repository then decides whether it is able to be used in the current context. Newly, repository can be switched between with security.repository.type:
    • cbioportal: the default, injects SecurityMyBatisRepository
    • disabled: allows all access, injects FullAccessResolver
    • [any other]: custom implementation + custom args

There is included a LsaaiOauth2DrivenResolver that demonstrates the usage; I would like to remove this implementation as it is specially designed to work for my usecase. It can be used like this:

security.repository.type=lsaai
security.repository.lsaai.userinfo=https://example.com/oidc/userinfo

I would like a discussion on whether this is a good design, or whether there are some issues (interaction with different flows, usage in different scenarios, over-complexity due the need to compile / build images yourself...). But IMHO this is a crucial feature if this app should be used in production systems - being able to customize authentication and authorization to your needs.

No new tests are necessary since this PR just modularizes the current behavior, so the current test suite should be sufficient.

Checks

  • [x] The commit log is comprehensible. It follows 7 rules of great commit messages. We can fix this during merge by using a squash+merge if necessary
  • [x] Has tests or has a separate issue that describes the types of test that should be created. If no test is included it should explicitly be mentioned in the PR why there is no test.
  • [x] Is this PR adding logic based on one or more clinical attributes? If yes, please make sure validation for this attribute is also present in the data validation / data loading layers (in backend repo) and documented in File-Formats Clinical data section!
  • [ ] Make sure your PR has one of the labels defined in https://github.com/cBioPortal/cbioportal/blob/master/.github/release-drafter.yml (GUI does not let me add them)

Aiosa avatar Oct 08 '24 15:10 Aiosa