Spring Security: OAuth2 Resource Server Basics
A beginner-level quiz on implementing OAuth2 Resource Server using Spring Security.
Questions in this quiz
15 questions on Spring Security: OAuth2 Resource Server Basics. Work through them here, then start the quiz to answer them and see your score.
1.What is the primary role of an OAuth2 Resource Server in a Spring application?
- ATo issue access tokens
- BTo authenticate users
- CTo protect resources and validate access tokens
- DTo manage user sessions
2.Which Spring Boot starter is typically used to set up an OAuth2 Resource Server?
- Aspring-boot-starter-data-jpa
- Bspring-boot-starter-oauth2-resource-server
- Cspring-boot-starter-security
- Dspring-boot-starter-web
3.In Spring Security, which annotation is used to enable resource server capabilities?
- A@EnableAuthorizationServer
- B@EnableWebSecurity
- C@EnableResourceServer
- D@EnableOAuth2Sso
4.What is the purpose of the 'Bearer' token in OAuth2?
- ATo grant access to protected resources
- BTo authenticate the user
- CTo identify the client application
- DTo encrypt data
5.Which HTTP header is used to pass the OAuth2 token to the resource server?
- AContent-Type
- BUser-Agent
- CAccept
- DAuthorization
6.What is the default token format expected by Spring Security's OAuth2 Resource Server?
- AOAuth
- BSAML
- COpenID
- DJWT
7.Which property is used to specify the public key for verifying JWT tokens in Spring Security?
- Aspring.security.oauth2.resourceserver.jwt.public-key-location
- Bspring.security.oauth2.resourceserver.jwt.jwk-set-uri
- Cspring.security.oauth2.client.client-secret
- Dspring.security.oauth2.client.client-id
8.How can you configure a Spring application to treat all endpoints as protected by default?
- ABy using '@EnableWebSecurity' annotation
- BBy using '@EnableResourceServer' annotation
- CBy configuring HttpSecurity to authorize requests
- DBy setting 'security.protected=true' in application.properties
9.What is the role of the 'JwtDecoder' bean in a Spring OAuth2 Resource Server?
- ATo manage user sessions
- BTo encode JWT tokens
- CTo handle OAuth2 client registration
- DTo decode and verify JWT tokens
10.Which method in HttpSecurity is used to configure OAuth2 Resource Server support?
- Aoauth2Login()
- BformLogin()
- ChttpBasic()
- Doauth2ResourceServer()
11.What is the purpose of the 'scope' claim in a JWT token?
- ATo identify the issuer of the token
- BTo encrypt the token
- CTo specify the token's expiration time
- DTo define the permissions granted by the token
12.Which property is used to specify the JWK Set URI for a resource server in Spring Security?
- Aspring.security.oauth2.client.client-id
- Bspring.security.oauth2.resourceserver.jwt.issuer-uri
- Cspring.security.oauth2.client.registration-id
- Dspring.security.oauth2.resourceserver.jwt.jwk-set-uri
13.What is the default behavior of a Spring OAuth2 Resource Server when a token is invalid?
- AIt logs the user out
- BIt returns a 401 Unauthorized response
- CIt returns a 200 OK response
- DIt redirects to a login page
14.Which component is responsible for extracting the token from the HTTP request in Spring Security?
- ATokenExtractor
- BBearerTokenResolver
- CTokenManager
- DTokenProvider
15.What is the purpose of the 'aud' claim in a JWT token?
- ATo identify the token's issuer
- BTo specify the token's audience
- CTo encrypt the token
- DTo define the token's expiration