Interface IdempotentService

    • Method Detail

      • generateToken

        @Nonnull
        default java.lang.String generateToken​(org.springframework.web.context.request.NativeWebRequest request,
                                               IdempotentAttributes attributes)
        Generate a new token.

        Note : The new token should not be generated twice in one request.

        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        Returns:
        the new token
      • getToken

        @Nullable
        java.lang.String getToken​(org.springframework.web.context.request.NativeWebRequest request,
                                  IdempotentAttributes attributes)
        Get the token from the request.
        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        Returns:
        the token from the request if exists
      • storeToken

        boolean storeToken​(org.springframework.web.context.request.NativeWebRequest request,
                           IdempotentAttributes attributes,
                           java.lang.String newToken)
        Store the token into backend storage.
        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        newToken - the new generated token
        Returns:
        true if stored successfully
      • checkToken

        boolean checkToken​(org.springframework.web.context.request.NativeWebRequest request,
                           IdempotentAttributes attributes,
                           java.lang.String token)
        Check the token is existed
        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        token - the token
        Returns:
        true if exists
      • invalidate

        boolean invalidate​(org.springframework.web.context.request.NativeWebRequest request,
                           IdempotentAttributes attributes,
                           java.lang.String token)
        Invalidate the token
        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        token - the token
        Returns:
        true if invalidated successfully
      • renewToken

        default java.lang.String renewToken​(org.springframework.web.context.request.NativeWebRequest request,
                                            IdempotentAttributes attributes)
        Renew the token
        Parameters:
        request - the NativeWebRequest
        attributes - the IdempotentAttributes
        Returns:
        the new token
      • destroy

        void destroy()
        Destroy