Class SecurityConfig

java.lang.Object
com.example.vehicletaxsystem.config.SecurityConfig

@Configuration @EnableWebSecurity public class SecurityConfig extends Object
Class for configuring the security for the API.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    URI for the JWT decoder to call.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.web.SecurityFilterChain
    filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Method for allocating access levels for roles based on query paths.
    private org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,? extends org.springframework.security.authentication.AbstractAuthenticationToken>
     
    (package private) org.springframework.security.oauth2.jwt.JwtDecoder
    Decoder for Javascript Web Tokens

    Methods inherited from class java.lang.Object

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

    • jwkSetUri

      @Value("${SPRING_KC_RES_SERVER_CERTS}") private String jwkSetUri
      URI for the JWT decoder to call.
  • Constructor Details

    • SecurityConfig

      public SecurityConfig()
  • Method Details

    • filterChain

      @Bean public org.springframework.security.web.SecurityFilterChain filterChain(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
      Method for allocating access levels for roles based on query paths. Admin have access to all endpoints that regular users do.
      Parameters:
      http - HttpSecurity object for assigning customisation to.
      Returns:
      Security filter chain built up with all roles and restrictions set.
      Throws:
      Exception
    • jwtAuthenticationConverter

      private org.springframework.core.convert.converter.Converter<org.springframework.security.oauth2.jwt.Jwt,? extends org.springframework.security.authentication.AbstractAuthenticationToken> jwtAuthenticationConverter()
    • jwtDecoder

      @Bean org.springframework.security.oauth2.jwt.JwtDecoder jwtDecoder()
      Decoder for Javascript Web Tokens
      Returns:
      Instance of a JwtDecoder object