Class SecurityInterceptor
java.lang.Object
org.chenile.core.interceptors.BaseChenileInterceptor
org.chenile.samples.security.interceptor.SecurityInterceptor
- All Implemented Interfaces:
org.chenile.owiz.Command<org.chenile.core.context.ChenileExchange>
public class SecurityInterceptor
extends org.chenile.core.interceptors.BaseChenileInterceptor
This interceptor uses
Finally, if the SecurityConfig says that the resource is UNPROTECTED, it does not do anything
SecurityConfig to secure this particular resource.
It looks at the authorities of the signed-in user and compares them with the ones that
are expected in the SecurityConfig and throws an exception if they are not available in the
current user. It also throws a 401 (UNAUTHORIZED) if there are no security credentials
that exist. Finally, if the SecurityConfig says that the resource is UNPROTECTED, it does not do anything
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ApplicationContextprivate static final org.slf4j.Loggerstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbypassInterception(org.chenile.core.context.ChenileExchange exchange) This bypasses the logic only if the security config is configured to be unprotected or if the security config does not exist at all.protected voiddoPreProcessing(org.chenile.core.context.ChenileExchange exchange) private Collection<org.springframework.security.core.GrantedAuthority> private String[]getGuardingAuthorities(org.chenile.core.context.ChenileExchange exchange) private booleanguardingAuthoritiesNotFoundInCurrentAuthorities(String[] guardingAuthorities, Collection<org.springframework.security.core.GrantedAuthority> currentAuthorities) Methods inherited from class org.chenile.core.interceptors.BaseChenileInterceptor
doContinue, doPostProcessing, execute, getExtensionByAnnotation, getExtensionByAnnotation, resumeFromSavedPoint, savePoint
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
applicationContext
-
SCOPE_PREFIX
- See Also:
-
-
Constructor Details
-
SecurityInterceptor
public SecurityInterceptor()
-
-
Method Details
-
doPreProcessing
protected void doPreProcessing(org.chenile.core.context.ChenileExchange exchange) - Overrides:
doPreProcessingin classorg.chenile.core.interceptors.BaseChenileInterceptor
-
guardingAuthoritiesNotFoundInCurrentAuthorities
private boolean guardingAuthoritiesNotFoundInCurrentAuthorities(String[] guardingAuthorities, Collection<org.springframework.security.core.GrantedAuthority> currentAuthorities) -
getGuardingAuthorities
-
getAuthorities
-
bypassInterception
protected boolean bypassInterception(org.chenile.core.context.ChenileExchange exchange) This bypasses the logic only if the security config is configured to be unprotected or if the security config does not exist at all.- Overrides:
bypassInterceptionin classorg.chenile.core.interceptors.BaseChenileInterceptor- Parameters:
exchange- the exchange- Returns:
- true if the SecurityConfig is configured to be UNPROTECTED or if config is missing
-