fix broken build due to @Deprecated error [FINERACT-1012]

This commit is contained in:
Michael Vorburger
2020-05-28 22:36:03 +02:00
committed by Michael Vorburger ⛑️
parent 0322d4f94b
commit 4b108f02ec
2 changed files with 11 additions and 9 deletions
@@ -62,6 +62,7 @@ import org.springframework.stereotype.Component;
@SwaggerDefinition(tags = {
@Tag(name = "Fetch authenticated user details", description = "")
})
@SuppressWarnings("deprecation") // TODO FINERACT-1012
public class UserDetailsApiResource {
private final ResourceServerTokenServices tokenServices;
@@ -120,18 +120,19 @@ public class TwoFactorAuthenticationFilter extends GenericFilterBean {
chain.doFilter(req, res);
}
@SuppressWarnings("deprecation") // TODO FINERACT-1012
private Authentication createUpdatedAuthentication(final Authentication currentAuthentication,
final List<GrantedAuthority> updatedAuthorities) {
final List<GrantedAuthority> updatedAuthorities) {
final UsernamePasswordAuthenticationToken authentication = new
UsernamePasswordAuthenticationToken(currentAuthentication.getPrincipal(),
currentAuthentication.getCredentials(), updatedAuthorities);
final UsernamePasswordAuthenticationToken authentication = new
UsernamePasswordAuthenticationToken(currentAuthentication.getPrincipal(),
currentAuthentication.getCredentials(), updatedAuthorities);
if(currentAuthentication instanceof OAuth2Authentication) {
final OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) currentAuthentication;
return new OAuth2Authentication(oAuth2Authentication.getOAuth2Request(), authentication);
}
if(currentAuthentication instanceof OAuth2Authentication) {
final OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) currentAuthentication;
return new OAuth2Authentication(oAuth2Authentication.getOAuth2Request(), authentication);
}
return authentication;
return authentication;
}
}