Class JWTConfig

java.lang.Object
com.example.blogs.app.config.JWTConfig

@Configuration public class JWTConfig extends Object
Configuration for JWT parsing and validation using JJWT library. Provides a shared JwtParser bean for token verification across the application.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JWTConfig(String secretKey)
    Constructs JWTConfig with HMAC SHA256 signing key from application properties.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.jsonwebtoken.JwtParser
    Creates a JWT parser bean configured with the signing key for token verification.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JWTConfig

      public JWTConfig(@Value("${jwt.secret-key}") String secretKey)
      Constructs JWTConfig with HMAC SHA256 signing key from application properties.
      Parameters:
      secretKey - the secret key for JWT signing and verification
  • Method Details

    • jwtParser

      @Bean public io.jsonwebtoken.JwtParser jwtParser()
      Creates a JWT parser bean configured with the signing key for token verification.
      Returns:
      configured JwtParser for parsing and validating JWT tokens