Package io.micronaut.security.config
Class SecurityConfigurationProperties
java.lang.Object
io.micronaut.security.config.SecurityConfigurationProperties
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable,AuthenticationModeConfiguration,SecurityConfiguration
@ConfigurationProperties("micronaut.security")
public class SecurityConfigurationProperties
extends Object
implements SecurityConfiguration
Stores configuration for JWT.
- Since:
- 1.0
- Author:
- Sergio del Amo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final AuthenticationStrategyThe default enable value.static final booleanThe default enable value.static final booleanThe default value whether intercept url patterns should be prepended with the context path.static final booleanThe default reject-not-found value.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable AuthenticationModebooleanbooleanbooleanFor cases where no security rule handles a request and it is determined that the request does not match any routes on the server, whether the response should be to reject the request or allow the not found response to be returned.voidsetAuthentication(@Nullable AuthenticationMode authentication) Defines which authentication to use.voidsetAuthenticationProviderStrategy(AuthenticationStrategy authenticationProviderStrategy) Determines how authentication providers should be processed.voidsetEnabled(boolean enabled) If Security is enabled.voidsetInterceptUrlMap(List<InterceptUrlMapPattern> interceptUrlMap) Map that defines the interception patterns.voidsetInterceptUrlMapPrependPatternWithContextPath(boolean interceptUrlMapPrependPatternWithContextPath) Whether the intercept URL patterns should be prepended with context path if defined.voidsetIpPatterns(List<String> ipPatterns) Allowed IP patterns.voidsetRejectNotFound(boolean rejectNotFound)
-
Field Details
-
PREFIX
- See Also:
-
ANYWHERE
- See Also:
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDThe default enable value.- See Also:
-
DEFAULT_INTERCEPT_URL_MAP_PREPEND_PATTERN_WITH_CONTEXT_PATH
public static final boolean DEFAULT_INTERCEPT_URL_MAP_PREPEND_PATTERN_WITH_CONTEXT_PATHThe default value whether intercept url patterns should be prepended with the context path.- See Also:
-
DEFAULT_AUTHENTICATION_STRATEGY
The default enable value. -
DEFAULT_REJECT_NOT_FOUND
public static final boolean DEFAULT_REJECT_NOT_FOUNDThe default reject-not-found value.- See Also:
-
-
Constructor Details
-
SecurityConfigurationProperties
public SecurityConfigurationProperties()
-
-
Method Details
-
getAuthentication
- Specified by:
getAuthenticationin interfaceAuthenticationModeConfiguration- Returns:
- Authentication Model to use
-
setAuthentication
Defines which authentication to use. Defaults to null. Possible values bearer, session, cookie, idtoken. Should only be supplied if the service handles login and logout requests.- Parameters:
authentication- Login Handler Mode
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable
-
getInterceptUrlMap
- Specified by:
getInterceptUrlMapin interfaceSecurityConfiguration- Returns:
- a list of
InterceptUrlMapPattern
-
getIpPatterns
- Specified by:
getIpPatternsin interfaceSecurityConfiguration- Returns:
- a list of IP Regex patterns. e.g. [192.168.1.*]
-
setEnabled
public void setEnabled(boolean enabled) If Security is enabled. Default value true- Parameters:
enabled- True if security is enabled
-
isInterceptUrlMapPrependPatternWithContextPath
public boolean isInterceptUrlMapPrependPatternWithContextPath()- Specified by:
isInterceptUrlMapPrependPatternWithContextPathin interfaceSecurityConfiguration- Returns:
- Whether the intercept URL patterns should be prepended with context path if defined.
-
setInterceptUrlMapPrependPatternWithContextPath
public void setInterceptUrlMapPrependPatternWithContextPath(boolean interceptUrlMapPrependPatternWithContextPath) Whether the intercept URL patterns should be prepended with context path if defined. Defaults to true.- Parameters:
interceptUrlMapPrependPatternWithContextPath- Prepend Intercept URL Map pattern with context path
-
setInterceptUrlMap
Map that defines the interception patterns.- Parameters:
interceptUrlMap- The intercept urls maps
-
setIpPatterns
Allowed IP patterns. Default value (["0.0.0.0"])- Parameters:
ipPatterns- The IP patterns
-
getAuthenticationProviderStrategy
- Specified by:
getAuthenticationProviderStrategyin interfaceSecurityConfiguration- Returns:
- The authentication strategy
-
setAuthenticationProviderStrategy
public void setAuthenticationProviderStrategy(AuthenticationStrategy authenticationProviderStrategy) Determines how authentication providers should be processed. Default value ANY. Possible values: ANY or ALL.- Parameters:
authenticationProviderStrategy- authentication strategy.
-
isRejectNotFound
public boolean isRejectNotFound()Description copied from interface:SecurityConfigurationFor cases where no security rule handles a request and it is determined that the request does not match any routes on the server, whether the response should be to reject the request or allow the not found response to be returned.- Specified by:
isRejectNotFoundin interfaceSecurityConfiguration- Returns:
- True if the response should be rejected.
-
setRejectNotFound
public void setRejectNotFound(boolean rejectNotFound) - Parameters:
rejectNotFound- Whether the server should respond with 401 for requests that do not match any routes on the server, if you set it to false, it will return 404 for requests that do not match any routes on the server. Default value (true).
-