Module quak.framework.security
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 Summary
ConstructorsConstructorDescriptionCORSConfig(List<String> allowedOrigins) Create a CORS config allowing all headers and methods for the given origins.CORSConfig(List<String> allowedOrigins, boolean allowAllHeaders, List<String> allowedHeaders, List<String> allowedMethods) Creates an instance of aCORSConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic CORSConfigallowAll()booleanReturns the value of theallowAllHeadersrecord component.Returns the value of theallowedHeadersrecord component.Returns the value of theallowedMethodsrecord component.Returns the value of theallowedOriginsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CORSConfig
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 aCORSConfigrecord class.- Parameters:
allowedOrigins- the value for theallowedOriginsrecord componentallowAllHeaders- the value for theallowAllHeadersrecord componentallowedHeaders- the value for theallowedHeadersrecord componentallowedMethods- the value for theallowedMethodsrecord component
-
-
Method Details
-
allowAll
- Returns:
- A CORS config allowing all requests.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
allowedOrigins
Returns the value of theallowedOriginsrecord component.- Returns:
- the value of the
allowedOriginsrecord component
-
allowAllHeaders
public boolean allowAllHeaders()Returns the value of theallowAllHeadersrecord component.- Returns:
- the value of the
allowAllHeadersrecord component
-
allowedHeaders
Returns the value of theallowedHeadersrecord component.- Returns:
- the value of the
allowedHeadersrecord component
-
allowedMethods
Returns the value of theallowedMethodsrecord component.- Returns:
- the value of the
allowedMethodsrecord component
-