Skip to content

Commit 3cb0975

Browse files
ttddyyjzheaux
authored andcommitted
Accept Converter in ReactiveJwtAuthenticationConverterAdapter
Currently, "ReactiveJwtAuthenticationConverterAdapter" takes "JwtAuthenticationConverter" as its constructor argument. However, this limits the usage of this adapter. In this commit, widen the constructor to take "Converter<Jwt, AbstractAuthenticationToken>" and allow this adapter to be used by generic converters.
1 parent 1739ef8 commit 3cb0975

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
* @since 5.1.1
3131
*/
3232
public class ReactiveJwtAuthenticationConverterAdapter implements Converter<Jwt, Mono<AbstractAuthenticationToken>> {
33-
private final JwtAuthenticationConverter delegate;
33+
private final Converter<Jwt, AbstractAuthenticationToken> delegate;
3434

35-
public ReactiveJwtAuthenticationConverterAdapter(JwtAuthenticationConverter delegate) {
35+
public ReactiveJwtAuthenticationConverterAdapter(Converter<Jwt, AbstractAuthenticationToken> delegate) {
3636
Assert.notNull(delegate, "delegate cannot be null");
3737
this.delegate = delegate;
3838
}

oauth2/oauth2-resource-server/src/test/java/org/springframework/security/oauth2/server/resource/authentication/ReactiveJwtAuthenticationConverterAdapterTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.junit.Test;
2727

28+
import org.springframework.core.convert.converter.Converter;
2829
import org.springframework.security.authentication.AbstractAuthenticationToken;
2930
import org.springframework.security.core.GrantedAuthority;
3031
import org.springframework.security.core.authority.SimpleGrantedAuthority;
@@ -39,7 +40,7 @@
3940
* @author Josh Cummings
4041
*/
4142
public class ReactiveJwtAuthenticationConverterAdapterTests {
42-
JwtAuthenticationConverter converter = new JwtAuthenticationConverter();
43+
Converter<Jwt, AbstractAuthenticationToken> converter = new JwtAuthenticationConverter();
4344
ReactiveJwtAuthenticationConverterAdapter jwtAuthenticationConverter =
4445
new ReactiveJwtAuthenticationConverterAdapter(converter);
4546

0 commit comments

Comments
 (0)