Class CorsConfiguration
- java.lang.Object
-
- io.jans.configapi.model.configuration.CorsConfiguration
-
public class CorsConfiguration extends Object
-
-
Constructor Summary
Constructors Constructor Description CorsConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<String>
getAllowedHttpHeaders()
Collection<String>
getAllowedHttpMethods()
Collection<String>
getAllowedOrigins()
Collection<String>
getExposedHeaders()
long
getPreflightMaxAge()
boolean
isAnyOriginAllowed()
boolean
isDecorateRequest()
boolean
isEnabled()
boolean
isOriginAllowed(String origin)
boolean
isSupportsCredentials()
void
parseAndStore(String corsEnabled, String allowedOrigins, String allowedHttpMethods, String allowedHttpHeaders, String exposedHeaders, String supportsCredentials, String preflightMaxAge, String decorateRequest)
Parses each param-value and populates configuration variables.void
setAllowedOrigins(Collection<String> allowedOrigins)
void
setDecorateRequest(boolean decorateRequest)
void
setEnabled(boolean enabled)
void
setPreflightMaxAge(long preflightMaxAge)
void
setSupportsCredentials(boolean supportsCredentials)
String
toString()
-
-
-
Method Detail
-
getAllowedOrigins
public Collection<String> getAllowedOrigins()
-
setAllowedOrigins
public void setAllowedOrigins(Collection<String> allowedOrigins)
-
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
public Collection<String> getAllowedHttpMethods()
-
getAllowedHttpHeaders
public Collection<String> getAllowedHttpHeaders()
-
getExposedHeaders
public Collection<String> 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
- AString
of comma separated origins.allowedHttpMethods
- AString
of comma separated HTTP methods.allowedHttpHeaders
- AString
of comma separated HTTP headers.exposedHeaders
- AString
of 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
public boolean isOriginAllowed(String origin)
-
isAnyOriginAllowed
public boolean isAnyOriginAllowed()
-
-