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 java.lang.Object implements SecurityConfigurationStores configuration for JWT.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANYWHEREstatic AuthenticationStrategyDEFAULT_AUTHENTICATION_STRATEGYThe default enable value.static booleanDEFAULT_ENABLEDThe default enable value.static booleanDEFAULT_REJECT_NOT_FOUNDThe default reject-not-found value.static java.lang.StringPREFIX
-
Constructor Summary
Constructors Constructor Description SecurityConfigurationProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationModegetAuthentication()AuthenticationStrategygetAuthenticationProviderStrategy()java.util.List<InterceptUrlMapPattern>getInterceptUrlMap()java.util.List<java.lang.String>getIpPatterns()booleanisEnabled()booleanisRejectNotFound()For 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(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(java.util.List<InterceptUrlMapPattern> interceptUrlMap)Map that defines the interception patterns.voidsetIpPatterns(java.util.List<java.lang.String> ipPatterns)Allowed IP patterns.voidsetRejectNotFound(boolean rejectNotFound)
-
-
-
Field Detail
-
PREFIX
public static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
ANYWHERE
public static final java.lang.String ANYWHERE
- See Also:
- Constant Field Values
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
The default enable value.- See Also:
- Constant Field Values
-
DEFAULT_AUTHENTICATION_STRATEGY
public static final AuthenticationStrategy DEFAULT_AUTHENTICATION_STRATEGY
The default enable value.
-
DEFAULT_REJECT_NOT_FOUND
public static final boolean DEFAULT_REJECT_NOT_FOUND
The default reject-not-found value.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAuthentication
@Nullable public AuthenticationMode getAuthentication()
- Specified by:
getAuthenticationin interfaceAuthenticationModeConfiguration- Returns:
- Authentication Model to use
-
setAuthentication
public void setAuthentication(@Nullable AuthenticationMode authentication)Defines which authentication to use. Defaults to null. Possible values bearer, session, cookie. 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
public java.util.List<InterceptUrlMapPattern> getInterceptUrlMap()
- Specified by:
getInterceptUrlMapin interfaceSecurityConfiguration- Returns:
- a list of
InterceptUrlMapPattern
-
getIpPatterns
public java.util.List<java.lang.String> 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
-
setInterceptUrlMap
public void setInterceptUrlMap(java.util.List<InterceptUrlMapPattern> interceptUrlMap)
Map that defines the interception patterns.- Parameters:
interceptUrlMap- The intercept urls maps
-
setIpPatterns
public void setIpPatterns(java.util.List<java.lang.String> ipPatterns)
Allowed IP patterns. Default value (["0.0.0.0"])- Parameters:
ipPatterns- The IP patterns
-
getAuthenticationProviderStrategy
public AuthenticationStrategy 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).
-
-