Package org.chenile.security.interceptor
Class SecurityInterceptor
java.lang.Object
org.chenile.core.interceptors.BaseChenileInterceptor
org.chenile.security.interceptor.SecurityInterceptor
- All Implemented Interfaces:
Command<ChenileExchange>
This interceptor uses
Next, it looks at the authorities of the signed-in user. It throws a 401 (UNAUTHORIZED) if the authorities don't exist for the current user. Now, it compares current authorities with the guarding authorities for this service. It lets the user in if even one of the guarding authorities exist for the current user. Else it throws a 403 (FORBIDDEN)
Finally, if the SecurityConfig says that the resource is UNPROTECTED, it does not do anything
Please see
SecurityConfig
to secure this particular resource.It first looks at the
SecurityConfig to see if there are any guarding authorities for this service. If there are none then
this interceptor does nothing. Next, it looks at the authorities of the signed-in user. It throws a 401 (UNAUTHORIZED) if the authorities don't exist for the current user. Now, it compares current authorities with the guarding authorities for this service. It lets the user in if even one of the guarding authorities exist for the current user. Else it throws a 403 (FORBIDDEN)
Finally, if the SecurityConfig says that the resource is UNPROTECTED, it does not do anything
Please see
SecurityConfig
for more details about the various annotation fields and how they are used-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
(package private) SecurityService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
bypassInterception
(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.
Also, we will only enforce it in the HTTP end point.protected void
doPreProcessing
(ChenileExchange exchange) Override this to do pre-processing.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 -
securityService
-
-
Constructor Details
-
SecurityInterceptor
public SecurityInterceptor()
-
-
Method Details
-
doPreProcessing
Description copied from class:BaseChenileInterceptor
Override this to do pre-processing. This will be called before the service is invoked. Don't expect to see exception or response being set inChenileExchange
. However you can check forChenileExchange.getBody()
to manipulate the body if this interceptor is a Chenile post processor or a service specific or operation specific interceptor.
If this interceptor is a Chenile pre-processor, thenChenileExchange.getBody()
will return null. Then you need to look at headers only.- Overrides:
doPreProcessing
in classBaseChenileInterceptor
-
bypassInterception
This bypasses the logic only if the security config is configured to be unprotected or if the security config does not exist at all.
Also, we will only enforce it in the HTTP end point. We assume that all the other end points are secured- Overrides:
bypassInterception
in classBaseChenileInterceptor
- Parameters:
exchange
- the exchange- Returns:
- true if the SecurityConfig is configured to be UNPROTECTED or if config is missing
-