Class CommandSecurityInterceptor

java.lang.Object
io.github.yvasyliev.telegramforwarderbot.aspect.CommandSecurityInterceptor

@Component public class CommandSecurityInterceptor extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    intercept(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 an AccessDeniedException is thrown, it sends an unauthorized action message.
      Parameters:
      pjp - the proceeding join point
      message - 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 an AccessDeniedException is thrown, it sends an unauthorized action response.
      Parameters:
      pjp - the proceeding join point
      query - 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