Skip to content

RequestSecurityValidator should have the ability to return a full response #79

Description

@nicmunroe

RequestSecurityValidator.validateSecureRequestForEndpoint(...) currently has a void return type, with the idea that if the request passes auth you do nothing, and if it fails auth you throw an appropriate exception.

We should change the return type to Optional<ResponseInfo<?>> to allow you to short circuit with an explicit full-flexibility response if you wanted to. For example, you might want to send a 302/307 redirect.

So there would be three options for handling a request in RequestSecurityValidator.validateSecureRequestForEndpoint(...):

  • Return Optional.empty() (or null) to indicate the request passed auth and request processing should proceed.
  • Return a non-empty Optional<ResponseInfo<?>> to short circuit with the provided response immediately, bypassing any endpoint and any after-security-validator-RequestAndResponseFilters. (The response side of RequestAndResponseFilter should still run).
  • Throw an exception with the same support we have now.

This would be an API breaking change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions