Class CorsConfiguration
java.lang.Object
io.jans.configapi.model.configuration.CorsConfiguration
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanbooleanbooleanbooleanisOriginAllowed(String origin) booleanvoidparseAndStore(String corsEnabled, String allowedOrigins, String allowedHttpMethods, String allowedHttpHeaders, String exposedHeaders, String supportsCredentials, String preflightMaxAge, String decorateRequest) Parses each param-value and populates configuration variables.voidsetAllowedOrigins(Collection<String> allowedOrigins) voidsetDecorateRequest(boolean decorateRequest) voidsetEnabled(boolean enabled) voidsetPreflightMaxAge(long preflightMaxAge) voidsetSupportsCredentials(boolean supportsCredentials) toString()
-
Constructor Details
-
CorsConfiguration
public CorsConfiguration()
-
-
Method Details
-
getAllowedOrigins
-
setAllowedOrigins
-
isSupportsCredentials
public boolean isSupportsCredentials() -
setSupportsCredentials
public void setSupportsCredentials(boolean supportsCredentials) -
getPreflightMaxAge
public long getPreflightMaxAge() -
setPreflightMaxAge
public void setPreflightMaxAge(long preflightMaxAge) -
isDecorateRequest
public boolean isDecorateRequest() -
setDecorateRequest
public void setDecorateRequest(boolean decorateRequest) -
isEnabled
public boolean isEnabled() -
setEnabled
public void setEnabled(boolean enabled) -
getAllowedHttpMethods
-
getAllowedHttpHeaders
-
getExposedHeaders
-
parseAndStore
public void parseAndStore(String corsEnabled, String allowedOrigins, String allowedHttpMethods, String allowedHttpHeaders, String exposedHeaders, String supportsCredentials, String preflightMaxAge, String decorateRequest) throws jakarta.servlet.ServletException Parses each param-value and populates configuration variables. If a param is provided, it overrides the default.- Parameters:
corsEnabled- "true" if CORS needs to be enabled.allowedOrigins- AStringof comma separated origins.allowedHttpMethods- AStringof comma separated HTTP methods.allowedHttpHeaders- AStringof comma separated HTTP headers.exposedHeaders- AStringof comma separated headers that needs to be exposed.supportsCredentials- "true" if support credentials needs to be enabled.preflightMaxAge- The amount of seconds the user agent is allowed to cache the result of the pre-flight request.decorateRequest- "true" if request needs to enhanced- Throws:
jakarta.servlet.ServletException
-
isOriginAllowed
-
isAnyOriginAllowed
public boolean isAnyOriginAllowed() -
toString
-