Skip to content

Adding JWT token Authentication information only possible after body processing #2

Description

@envimate-opensource

Do you have an awesome idea to improve the project? Please describe.
Adding authentication information into the body map should be possible BEFORE body
processing, so that the authorizer can reject a request even BEFORE the body is parsed.

Is your feature request related to a problem? Please describe.
That reduces the attack surface and hence increases security.

Describe the solution you'd like
I'd like to be able to call:

.configured(toAuthenticateRequests().beforeBodyProcessing().using(metaData -> {
                    final Optional<CustomerIdentifier> optionalId = metaData.get(HEADERS)
                            .getHeader("Authorization")
                            .map(authenticator::authenticateAs);
                    optionalId.ifPresent(customerIdentifier ->
                            metaData.get(BODY_MAP).put("customerIdentifier", customerIdentifier)
                    );
                    return optionalId;
                }))

without receiving a java.lang.RuntimeException: Could not find meta datum BODY_MAP ...

Additional context
none given

Metadata

Metadata

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