How would you secure RESTful web services in Spring Security using OAuth2?
- Define the @OAuth2Security annotation on the REST controller methods that need protection.
- Add OAuth2 configuration properties to the application.properties file.
- Configure OAuth2 client and resource server details in the Spring Security configuration.
- Use the @EnableOAuth2Security annotation at the application class level.
To secure RESTful web services in Spring Security using OAuth2, you should configure OAuth2 client and resource server details in the Spring Security configuration. Option 1 and Option 4 do not represent the correct way to secure RESTful services with OAuth2. Option 2 suggests configuring OAuth2 properties in the wrong place, and it is not a standard approach.
Loading...
Related Quiz
- In a microservices architecture using Spring Cloud, how is service registration managed?
- In a Spring Boot application, the _____ is a test utility used for making HTTP requests to the application and can be auto-configured in integration tests.
- Which utility is commonly used in Spring Boot for performing HTTP requests in test scenarios?
- How can cache be synchronized across multiple instances of a Spring Boot application in a distributed environment?
- In Spring Boot, the _____ annotation is used to conditionally enable a configuration based on the presence of a specific property.