Record Class CORSConfig

java.lang.Object
java.lang.Record
io.john.amiscaray.quak.security.config.CORSConfig
Record Components:
allowedOrigins - The allowed origins.
allowAllHeaders - Whether all headers should be allowed.
allowedHeaders - The allowed headers.
allowedMethods - The allowed methods.

public record CORSConfig(List<String> allowedOrigins, boolean allowAllHeaders, List<String> allowedHeaders, List<String> allowedMethods) extends Record
The application's CORS configuration for specific paths. CORS configs for each path is specified in the SecurityConfig.
  • Constructor Details

    • CORSConfig

      public CORSConfig(List<String> allowedOrigins)
      Create a CORS config allowing all headers and methods for the given origins.
      Parameters:
      allowedOrigins - The allowed origins.
    • CORSConfig

      public CORSConfig(List<String> allowedOrigins, boolean allowAllHeaders, List<String> allowedHeaders, List<String> allowedMethods)
      Creates an instance of a CORSConfig record class.
      Parameters:
      allowedOrigins - the value for the allowedOrigins record component
      allowAllHeaders - the value for the allowAllHeaders record component
      allowedHeaders - the value for the allowedHeaders record component
      allowedMethods - the value for the allowedMethods record component
  • Method Details

    • allowAll

      public static CORSConfig allowAll()
      Returns:
      A CORS config allowing all requests.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • allowedOrigins

      public List<String> allowedOrigins()
      Returns the value of the allowedOrigins record component.
      Returns:
      the value of the allowedOrigins record component
    • allowAllHeaders

      public boolean allowAllHeaders()
      Returns the value of the allowAllHeaders record component.
      Returns:
      the value of the allowAllHeaders record component
    • allowedHeaders

      public List<String> allowedHeaders()
      Returns the value of the allowedHeaders record component.
      Returns:
      the value of the allowedHeaders record component
    • allowedMethods

      public List<String> allowedMethods()
      Returns the value of the allowedMethods record component.
      Returns:
      the value of the allowedMethods record component