Class CommandSecurityInterceptor
java.lang.Object
io.github.yvasyliev.telegramforwarderbot.aspect.CommandSecurityInterceptor
Aspect that intercepts command execution and handles security checks.
If access is denied, it sends an unauthorized action message to the user.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintercept(org.aspectj.lang.ProceedingJoinPoint pjp, org.telegram.telegrambots.meta.api.objects.CallbackQuery query) Intercepts method calls that handle callback query events.intercept(org.aspectj.lang.ProceedingJoinPoint pjp, org.telegram.telegrambots.meta.api.objects.message.Message message) Intercepts method calls that handle message events and callback queries.
-
Constructor Details
-
CommandSecurityInterceptor
public CommandSecurityInterceptor()
-
-
Method Details
-
intercept
public Object intercept(org.aspectj.lang.ProceedingJoinPoint pjp, org.telegram.telegrambots.meta.api.objects.message.Message message) throws Throwable Intercepts method calls that handle message events and callback queries. If anAccessDeniedExceptionis thrown, it sends an unauthorized action message.- Parameters:
pjp- the proceeding join pointmessage- the message object for message events- Returns:
- the result of the intercepted method or an unauthorized action message
- Throws:
Throwable- if any error occurs during method execution
-
intercept
public Object intercept(org.aspectj.lang.ProceedingJoinPoint pjp, org.telegram.telegrambots.meta.api.objects.CallbackQuery query) throws Throwable Intercepts method calls that handle callback query events. If anAccessDeniedExceptionis thrown, it sends an unauthorized action response.- Parameters:
pjp- the proceeding join pointquery- the callback query object for callback query events- Returns:
- the result of the intercepted method or an unauthorized action response
- Throws:
Throwable- if any error occurs during method execution
-