Interface TokenValidator

  • All Known Implementing Classes:
    DefaultTokenValidator
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @DefaultImplementation(DefaultTokenValidator.class)
    @FunctionalInterface
    public interface TokenValidator
    API to validate a token provided the Bot Father and return the Bot's configuration.
    Since:
    1.0.0
    Author:
    Sergio del Amo
    • Field Detail

      • X_TELEGRAM_BOT_API_SECRET_TOKEN

        static final java.lang.String X_TELEGRAM_BOT_API_SECRET_TOKEN
        See Also:
        Constant Field Values
    • Method Detail

      • validate

        @NonNull
        java.util.Optional<TelegramBotConfiguration> validate​(@NonNull @NotBlank
                                                              @NotBlank java.lang.String token)
        Parameters:
        token - Telegram Token as returned by the Bot Father.
        Returns:
        Returns the TelegramBotConfiguration associated to the token. If the token is not associated with any Telegram bot an empty optional is returned.