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

Add RESTful Dubbo Integration with Spring Security and OAuth2 Sample #1193

Merged
merged 17 commits into from
Dec 6, 2024

Conversation

Similarityoung
Copy link
Contributor

This pull request introduces a sample project that demonstrates how to integrate Dubbo with RESTful APIs, incorporating Spring Security and OAuth2 for authentication and authorization. The sample showcases the following key functionalities:

  1. Dubbo RESTful Integration:
  • A RESTful API is exposed for Dubbo services, enabling easier interaction with external systems.
  1. Spring Security Setup:
  • Spring Security is configured to secure the endpoints, ensuring that only authorized users can access the Dubbo services via the REST API.
  1. OAuth2 Authentication:
  • OAuth2 authentication is implemented to handle secure access to the resources, with token validation for API access.

Copy link
Contributor

@wcy666103 wcy666103 left a comment

Choose a reason for hiding this comment

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

The path might not be right.

@wcy666103
Copy link
Contributor

image

@wcy666103
Copy link
Contributor

LGTM


assertEquals("\"Hello, World\"", userResponse, "error");
} catch (RestClientResponseException e) {
System.err.println("Error Response: " + e.getResponseBodyAsString());
Copy link
Contributor

Choose a reason for hiding this comment

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

This catch will cause the result of the exception to succeed

String accessToken = jsonNode.get("access_token").asText();

// Use the access token to authenticate the request to the /user endpoint
assert accessToken != null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also add a scenario when the accessToken is invalid

@Similarityoung Similarityoung requested a review from oxsean December 3, 2024 11:00
@AlbumenJ AlbumenJ merged commit f9a3d5f into apache:master Dec 6, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants