Interface CredentialsExtractor<A extends Credentials>

Type Parameters:
A - the credentials type
All Known Implementing Classes:
BasicCredentialsExtractor, BearerTokenCredentialsExtractor, CookieTokenCredentialsExtractor, DigestCredentialsExtractor, FormCredentialsExtractor
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CredentialsExtractor<A extends Credentials>

A credentials extractor is used to extract credentials from an exchange, typically the request.

The SecurityInterceptor uses it to extract credentials in order to authenticate the exchange and create the security context.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    extract(Exchange<?> exchange)
    Extracts credentials from the specified exchange.
    or(CredentialsExtractor<? extends A> other)
    Returns a composed credentials extractor which first invokes this extractor and, if no credentials could have been extracted, invokes the specified extractor.
  • Method Details

    • extract

      Mono<A> extract(Exchange<?> exchange) throws MalformedCredentialsException

      Extracts credentials from the specified exchange.

      Parameters:
      exchange - the exchange
      Returns:
      a mono emitting the credentials or an empty mono if the exchange didn't provide any credentials
      Throws:
      MalformedCredentialsException - if credentials in the exchange are malformed
    • or

      default CredentialsExtractor<A> or(CredentialsExtractor<? extends A> other)

      Returns a composed credentials extractor which first invokes this extractor and, if no credentials could have been extracted, invokes the specified extractor.

      Parameters:
      other - the credentials extractor to invoke in case this extractor was not able to extract credentials
      Returns:
      a composed credentials extractor