From 65db5fa028bd8adbe6986da869997b1d5387dc91 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Fri, 15 Jul 2022 14:35:48 -0400 Subject: [PATCH] Remove deprecations in JwtAuthenticationConverter Closes gh-11587 --- .../JwtAuthenticationConverter.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java index 7478d1d0df..959abc30e6 100644 --- a/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java +++ b/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,26 +40,12 @@ public class JwtAuthenticationConverter implements Converter authorities = extractAuthorities(jwt); + Collection authorities = this.jwtGrantedAuthoritiesConverter.convert(jwt); String principalClaimValue = jwt.getClaimAsString(this.principalClaimName); return new JwtAuthenticationToken(jwt, authorities, principalClaimValue); } - /** - * Extracts the {@link GrantedAuthority}s from scope attributes typically found in a - * {@link Jwt} - * @param jwt The token - * @return The collection of {@link GrantedAuthority}s found on the token - * @deprecated Since 5.2. Use your own custom converter instead - * @see JwtGrantedAuthoritiesConverter - * @see #setJwtGrantedAuthoritiesConverter(Converter) - */ - @Deprecated - protected Collection extractAuthorities(Jwt jwt) { - return this.jwtGrantedAuthoritiesConverter.convert(jwt); - } - /** * Sets the {@link Converter Converter<Jwt, Collection<GrantedAuthority>>} * to use. Defaults to {@link JwtGrantedAuthoritiesConverter}.