Spring Security: Setting Up OAuth2 Resource Server
A beginner's quiz on configuring OAuth2 Resource Server with Spring Security.
Questions in this quiz
15 questions on Spring Security: Setting Up OAuth2 Resource Server. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary purpose of an OAuth2 Resource Server in Spring Security?
- ATo store user credentials
- BTo manage user sessions
- CTo authorize access to resources
- DTo authenticate users
2.Which Spring Boot starter is needed to set up an OAuth2 Resource Server?
- Aspring-boot-starter-security
- Bspring-boot-starter-web
- Cspring-boot-starter-data-jpa
- Dspring-boot-starter-oauth2-resource-server
3.In Spring Security, which annotation is used to enable resource server capabilities?
- A@EnableResourceServer
- B@EnableAuthorizationServer
- C@EnableWebSecurity
- D@EnableOAuth2Client
4.What configuration file is typically used to specify the JWT issuer URI in a Spring Boot application?
- Asecurity-config.xml
- Bapplication.yml
- Cweb.xml
- Dapplication.properties
5.Which property is used to specify the issuer URI for JWT validation in Spring Security?
- Aspring.security.oauth2.resourceserver.issuer
- Bspring.security.oauth2.client.registration.issuer-uri
- Cspring.security.oauth2.resourceserver.jwt.issuer-uri
- Dspring.security.jwt.issuer-uri
6.What is the default token format supported by Spring Security's OAuth2 Resource Server?
- AJWT
- BOpaque tokens
- CXML
- DSAML
7.Which method in the SecurityFilterChain bean is used to configure HTTP security for a resource server?
- AformLogin()
- Bcsrf()
- CauthorizeRequests()
- DhttpBasic()
8.In a Spring Boot application, where do you typically define the SecurityFilterChain bean?
- AIn the main application class
- BIn the application.properties file
- CIn a @Configuration class
- DIn a @Service class
9.Which dependency is required to validate JWT tokens in a Spring Security resource server?
- Aspring-security-web
- Bspring-security-oauth2-jose
- Cspring-security-jwt
- Dspring-security-core
10.What role does the 'Bearer' keyword play in OAuth2 authorization headers?
- AIt specifies the token expiration
- BIt specifies the token audience
- CIt specifies the token issuer
- DIt specifies the token type
11.Which HTTP status code is returned by a resource server when access is denied due to invalid credentials?
- A401 Unauthorized
- B404 Not Found
- C403 Forbidden
- D500 Internal Server Error
12.What is the purpose of the 'JwtDecoder' bean in a Spring Security resource server?
- ATo encode JWT tokens
- BTo manage user sessions
- CTo decode and validate JWT tokens
- DTo handle OAuth2 client registrations
13.Which property is used to specify the public key for JWT signature verification in Spring Security?
- Aspring.security.jwt.public-key
- Bspring.security.oauth2.resourceserver.jwt.public-key
- Cspring.security.oauth2.resourceserver.jwt.jwk-set-uri
- Dspring.security.oauth2.resourceserver.jwk-uri
14.What is the role of the 'ResourceServerConfigurerAdapter' class in Spring Security?
- ATo configure resource server settings
- BTo configure session management
- CTo configure OAuth2 client settings
- DTo configure user authentication
15.Which method is used to specify the endpoints that require authentication in a resource server?
- AantMatchers()
- BpermitAll()
- CauthorizeRequests()
- Dauthenticated()