Spring Security: Basics of JWT Authentication
An introductory quiz on implementing JWT authentication using Spring Security.
Questions in this quiz
15 questions on Spring Security: Basics of JWT Authentication. Work through them here, then start the quiz to answer them and see your score.
1.What does JWT stand for in the context of Spring Security?
- AJava Web Transport
- BJSON Web Token
- CJava Web Token
- DJavaScript Web Token
2.Which part of a JWT contains the claims?
- AToken
- BSignature
- CHeader
- DPayload
3.What is the primary purpose of the signature in a JWT?
- ATo store user roles
- BTo verify the sender's identity
- CTo encrypt the token
- DTo decode the token
4.In Spring Security, which filter is typically used to validate JWT tokens?
- ABearerTokenAuthenticationFilter
- BJwtAuthenticationFilter
- CUsernamePasswordAuthenticationFilter
- DBasicAuthenticationFilter
5.Which HTTP header is commonly used to pass a JWT?
- AToken
- BBearer
- CAuthorization
- DAuthentication
6.What is the typical prefix used in the Authorization header for JWTs?
- AAuth
- BJWT
- CBearer
- DToken
7.Which library is commonly used in Java to create and verify JWTs?
- AJWT-Java
- BJavaJWT
- CJJWT
- DSpringJWT
8.What is the role of the 'exp' claim in a JWT?
- ATo indicate the token's signature
- BTo determine the token's subject
- CTo specify the token's issuer
- DTo define the token's expiration time
9.Which method is used to extract the JWT from the Authorization header in a custom filter?
- AgetHeader()
- BresolveToken()
- CextractJWT()
- DgetToken()
10.What is the primary benefit of using JWTs for authentication?
- AThey are self-contained
- BThey require no server storage
- CThey are easy to revoke
- DThey are always encrypted
11.Which claim is used to identify the principal that is the subject of the JWT?
- Aexp
- Bsub
- Caud
- Diss
12.How is the integrity of a JWT verified?
- ABy verifying the signature
- BBy checking the payload
- CBy validating the issuer
- DBy decoding the header
13.In Spring Security, where do you typically configure JWT authentication?
- AIn the application.properties file
- BIn the Service class
- CIn the SecurityConfig class
- DIn the Controller class
14.Which part of a JWT is base64url encoded?
- AHeader
- BSignature
- CAll parts
- DPayload
15.What is a common use case for JWTs in web applications?
- AUser authentication
- BSession management
- CData encryption
- DDatabase transactions