Class CorsConfiguration
- java.lang.Object
-
- io.jans.configapi.model.configuration.CorsConfiguration
-
- All Implemented Interfaces:
Serializable
public class CorsConfiguration extends Object implements Serializable
- See Also:
- Serialized Form
-
-
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()longgetPreflightMaxAge()booleanisAnyOriginAllowed()booleanisDecorateRequest()booleanisEnabled()booleanisOriginAllowed(String origin)booleanisSupportsCredentials()voidparseAndStore(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)StringtoString()
-
-
-
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- 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
public boolean isOriginAllowed(String origin)
-
isAnyOriginAllowed
public boolean isAnyOriginAllowed()
-
-