Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public final class JwtIssuerAuthenticationManagerResolver implements Authenticat

private final AuthenticationManagerResolver<String> issuerAuthenticationManagerResolver;

private final Converter<HttpServletRequest, String> issuerConverter = new JwtClaimIssuerConverter();
private Converter<HttpServletRequest, String> issuerConverter = new JwtClaimIssuerConverter();

/**
* Construct a {@link JwtIssuerAuthenticationManagerResolver} using the provided
Expand Down Expand Up @@ -130,6 +130,16 @@ public AuthenticationManager resolve(HttpServletRequest request) {
return authenticationManager;
}

/**
* Set a custom issuer converter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you please update the JavaDoc so that it talks about BearerTokenResolver instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

*
* @since 5.5
*/
public void setIssuerConverter(Converter<HttpServletRequest, String> issuerConverter) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setIssuerConverter, could you do:

public void setBearerTokenResolver(BearerTokenResolver bearerTokenResolver) {
    this.issuerConverter = new JwtClaimIssuerConverter(bearerTokenResolver);
}

That way, the API uses a familiar interface that they most likely already configured in their app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay :) Then I would also need to add another constructor to the JwtClaimIssuerConverter to pass the resolver / converter correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jzheaux I hope this is the way your feedback was meant.

Assert.notNull(issuerConverter, "issuerConverter cannot be null");
this.issuerConverter = issuerConverter;
}

private static class JwtClaimIssuerConverter implements Converter<HttpServletRequest, String> {

private final BearerTokenResolver resolver = new DefaultBearerTokenResolver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public final class JwtIssuerReactiveAuthenticationManagerResolver

private final ReactiveAuthenticationManagerResolver<String> issuerAuthenticationManagerResolver;

private final Converter<ServerWebExchange, Mono<String>> issuerConverter = new JwtClaimIssuerConverter();
private Converter<ServerWebExchange, Mono<String>> issuerConverter = new JwtClaimIssuerConverter();

/**
* Construct a {@link JwtIssuerReactiveAuthenticationManagerResolver} using the
Expand Down Expand Up @@ -131,6 +131,16 @@ public Mono<ReactiveAuthenticationManager> resolve(ServerWebExchange exchange) {
// @formatter:on
}

/**
* Set a custom issuer converter
*
* @since 5.5
*/
public void setIssuerConverter(Converter<ServerWebExchange, Mono<String>> issuerConverter) {
Assert.notNull(issuerConverter, "converter cannot be null");
this.issuerConverter = issuerConverter;
}

private static class JwtClaimIssuerConverter implements Converter<ServerWebExchange, Mono<String>> {

private final ServerBearerTokenAuthenticationConverter converter = new ServerBearerTokenAuthenticationConverter();
Expand Down