Skip to content

[CAMEL-20747] Migrate SpringSecurityAuthorizationPolicy to Spring 5#14082

Merged
davsclaus merged 5 commits intoapache:mainfrom
santam85:spring-security-policies
May 8, 2024
Merged

[CAMEL-20747] Migrate SpringSecurityAuthorizationPolicy to Spring 5#14082
davsclaus merged 5 commits intoapache:mainfrom
santam85:spring-security-policies

Conversation

@santam85
Copy link
Contributor

@santam85 santam85 commented May 8, 2024

Description

Changed the SpringSecurityAuthorizationPolicy to remove deprecated methods and classes, using the new Authorization manager. See the following links for reference:

Target

  • I checked that the commit is targeting the correct branch (note that Camel 3 uses camel-3.x, whereas Camel 4 uses the main branch)

Tracking

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.

  • I have run mvn clean install -DskipTests locally and I have committed all auto-generated changes

…thods and classes, using the new Authorization manager.
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2024

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@santam85
Copy link
Contributor Author

santam85 commented May 8, 2024

Tested the snapshot locally with success using the following policy definition:

@Bean(RolePolicy.ADMIN)
  public AuthorizationPolicy authorizationPolicyAdmin(AuthenticationManager authenticationManager) {
  SpringSecurityAuthorizationPolicy authorizationPolicy = new SpringSecurityAuthorizationPolicy();
  authorizationPolicy.setAuthenticationManager(authenticationManager);
  authorizationPolicy.setAuthorizationManager(AuthorityAuthorizationManager.hasRole("ADMIN"));
  return authorizationPolicy;
}

@davsclaus
Copy link
Contributor

the PR gives a test error with

org.apache.camel.component.spring.security.config.SpringSecurityAuthorizationPolicyConfigTest.testAuthorizationPolicy

@santam85
Copy link
Contributor Author

santam85 commented May 8, 2024

the PR gives a test error with

org.apache.camel.component.spring.security.config.SpringSecurityAuthorizationPolicyConfigTest.testAuthorizationPolicy

Sorry, missed one of the test resources. Ran mvn test on the whole component, all seems to pass now.

@github-actions github-actions bot added the tests label May 8, 2024
@davsclaus
Copy link
Contributor

Can you add a section about this change to the 4.7 upgrade doc at
https://github.com/apache/camel/blob/main/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_7.adoc

@github-actions github-actions bot added the docs label May 8, 2024
@davsclaus davsclaus merged commit 0dabf04 into apache:main May 8, 2024
4nt01ne pushed a commit to 4nt01ne/camel that referenced this pull request May 14, 2024
…pache#14082)

* Changed the SpringSecurityAuthorizationPolicy to remove deprecated methods and classes, using the new Authorization manager.

* Missed an xml resource, fixed tests

* Updated failing integration tests as a result of the component change.

* Added notes to the upgrade guide.

---------

Co-authored-by: Claus Ibsen <claus.ibsen@gmail.com>
@santam85 santam85 deleted the spring-security-policies branch June 25, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants