QuizzesSpring Security with OAuth2: Resource Server Basics
beginner
spring

Spring Security with OAuth2: Resource Server Basics

A beginner's quiz on configuring a Spring Security Resource Server with OAuth2.

15 minutes 15 questions Pass at 70%
Time Limit
15 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

15 questions on Spring Security with OAuth2: Resource Server Basics. Work through them here, then start the quiz to answer them and see your score.

  1. 1.What is the primary purpose of a Resource Server in OAuth2?

    • ATo issue access tokens
    • BTo authenticate users
    • CTo protect APIs and resources
    • DTo store user credentials
  2. 2.Which annotation is used to enable a Spring Boot application as a Resource Server?

    • A@EnableOAuth2Client
    • B@EnableAuthorizationServer
    • C@EnableResourceServer
    • D@EnableWebSecurity
  3. 3.In Spring Security, which dependency is required to set up a Resource Server?

    • Aspring-boot-starter-oauth2-resource-server
    • Bspring-boot-starter-web
    • Cspring-boot-starter-security
    • Dspring-boot-starter-data-jpa
  4. 4.What is the role of the 'Bearer' token in OAuth2?

    • ATo refresh expired tokens
    • BTo authenticate the client
    • CTo encrypt user data
    • DTo authorize access to resources
  5. 5.Which HTTP header is used to send the access token to the Resource Server?

    • AAccept
    • BAuthorization
    • CContent-Type
    • DX-Access-Token
  6. 6.What is the default token format supported by Spring Security's Resource Server?

    • AXML
    • BSAML
    • CJWT
    • DOpaque
  7. 7.How can you configure a Resource Server to validate JWT tokens?

    • ABy configuring a token store
    • BBy specifying a JWT decoder
    • CBy using the @EnableWebSecurity annotation
    • DBy setting up a custom filter
  8. 8.Which property is used to specify the issuer URI for JWT validation in application.properties?

    • Aspring.security.oauth2.resourceserver.issuer
    • Bspring.security.oauth2.jwt.issuer-uri
    • Cspring.security.oauth2.client.issuer-uri
    • Dspring.security.oauth2.resourceserver.jwt.issuer-uri
  9. 9.What is the function of the 'scope' claim in a JWT token?

    • ATo specify the token's intended audience
    • BTo define the token's expiration time
    • CTo identify the token's issuer
    • DTo list the permissions granted to the token
  10. 10.Which class is used to configure HTTP security for a Resource Server in Spring Security?

    • AWebSecurityConfigurerAdapter
    • BResourceServerConfigurerAdapter
    • CAuthorizationServerConfigurerAdapter
    • DOAuth2ClientConfigurerAdapter
  11. 11.How do you specify the path to be protected by the Resource Server?

    • AConfiguring the path in application.properties
    • BSpecifying the path in the JWT token
    • CUsing the HttpSecurity object in configure method
    • DUsing the @PathVariable annotation
  12. 12.What is the purpose of the 'aud' claim in a JWT token?

    • ATo identify the token's issuer
    • BTo list the permissions granted to the token
    • CTo specify the token's expiration time
    • DTo define the token's intended audience
  13. 13.Which method is used to configure the JWT decoder in a Resource Server?

    • AconfigureJwt()
    • BsetJwtDecoder()
    • CjwtConfigurer()
    • DjwtDecoder()
  14. 14.Which claim in a JWT token specifies the token's expiration time?

    • Aexp
    • Baud
    • Csub
    • Diat
  15. 15.What is the default behavior of a Resource Server when an invalid token is received?

    • AIt redirects to a login page
    • BIt logs the user out
    • CIt issues a new token
    • DIt returns a 401 Unauthorized error