Ocelot icon indicating copy to clipboard operation
Ocelot copied to clipboard

#913 #1066 ScopesAuthorizer refactoring

Open mehyaa opened this issue 3 years ago • 18 comments

Fixes #913 #1066

  • #913
  • #1066

Scopes can be a space separated list in a single claim. Include this possibility on allowed scopes check.

Proposed Changes

  • Split user scope values with space character if scope claim is an single claim and its value has space character(s)
  • User scopes must have all allowed scopes

Predecessor

  • #1431

mehyaa avatar May 31 '21 13:05 mehyaa

The build is broken, it fails on irrelevant part from this PR. #1436 fixes is I think.

mehyaa avatar Jun 01 '21 05:06 mehyaa

This is still an issue. Adding my :+1: to get this small and valuable PR merged.

PatrickDelancy avatar Jul 14 '21 20:07 PatrickDelancy

Please do the following:

  • Merge PR 1
  • Rebase feature branch onto develop
  • Resolve all merge conflicts

raman-m avatar Jun 30 '23 19:06 raman-m

Mehmet, Thanks for resolving of merge conflicts!

Unfortunately the last build is failed: 5 acceptance tests have failed!

Why is your PR code so unstable?

raman-m avatar Aug 18 '23 16:08 raman-m

I haven't found out the reason why the tests failed with a quick look. I couldn't figure out the tests structure. When I have time I'll look into it.

mehyaa avatar Aug 18 '23 18:08 mehyaa

@mehyaa The feature branch has been rebased onto ThreeMammals:develop successfully! The build has failed with 5 tests! Code review will start after fixing of these failed tests. Also, some new tests should cover your proposed changes in the ScopesAuthorizer class.

Could you add me as collaborator to your forked repo please? I will fix develop branch because now it has the diff, but both develop branches should be identical.

raman-m avatar Aug 24 '23 14:08 raman-m

@raman-m I've fixed the tests. Failing tests were written for the bug that requires one of allowed scopes. I've changed the claims and allowed scopes on tests so they can test the correct conditions.

For adding new tests to test ScopesAuthorizer, the current tests seem pretty sufficient.

mehyaa avatar Sep 14 '23 11:09 mehyaa

@raman-m I've added you as collaborator on my fork, you can fix the diff or guide me to how-to.

mehyaa avatar Sep 14 '23 11:09 mehyaa

Interestingly some irrelevant tests fail irregularly.

mehyaa avatar Sep 15 '23 07:09 mehyaa

@mehyaa commented on Sep 14, 11:38 AM

Thanks for fixing of failed tests!


For adding new tests to test ScopesAuthorizer, the current tests seem pretty sufficient.

No, at least one new test should cover claims logic having them multiple in the related config property. Simultaneously, we should update current tests to be green. Because each test covers specific atomic feature.

Come on! We've changed the logic from single Scope to multiple ones! And it is definitely right time to cover these changes.

I have idea: let's write tests for each linked issue:

  • a test for #913 where you can ask @fsmullinslc to help you
  • a test for #1066 where you can ask @papugamichal to help you

Sounds good?

raman-m avatar Sep 15 '23 17:09 raman-m

@mehyaa commented on Sep 14, 11:42 AM

Thanks for adding me as collaborator! Now your develop branch is up to date with ThreeMammals:develop. So, I've performed Sync fork operation. Done! You can start rebasing of current branches onto (creation of new ones from) your develop branch.

raman-m avatar Sep 15 '23 17:09 raman-m

@mehyaa commented on Sep 15

Don't worry! This is unstable scenario: Ocelot.AcceptanceTests.ConfigurationReloadTests.should_reload_config_on_change The next run fixes the build usually. Truly speaking, I am tired of this test too. I will create bug issue soon for this test.

raman-m avatar Sep 15 '23 17:09 raman-m

@mehyaa Why not to continue working? Firstly resolving all merge conflicts and merging from develop...

raman-m avatar Jan 21 '24 12:01 raman-m

Possible dependency

  • #1431 which will be merged first❕

raman-m avatar Apr 16 '24 17:04 raman-m

The branch has been rebased onto release/24.0 with top commit https://github.com/ThreeMammals/Ocelot/commit/59b63eab9c2cd2ab33c5752bbc3bd00a079cd74c !

raman-m avatar Apr 16 '24 17:04 raman-m

@mehyaa Mehmet, If you're no longer interested in your PR, please allow me to take it over. I will then deliver the feature with my own design vision.

Development is required❕

raman-m avatar Apr 16 '24 17:04 raman-m

Failed acceptance test: Ocelot.AcceptanceTests.AuthorizationTests.should_return_response_200_using_identity_server_with_allowed_scope

raman-m avatar Apr 19 '24 17:04 raman-m