1717import dev .findfirst .users .repository .UserRepo ;
1818import dev .findfirst .users .service .UserManagementService ;
1919
20- import lombok .AllArgsConstructor ;
21- import lombok .NoArgsConstructor ;
2220import lombok .RequiredArgsConstructor ;
2321import lombok .extern .slf4j .Slf4j ;
24- import org .springframework .beans .factory .annotation .Autowired ;
2522import org .springframework .beans .factory .annotation .Qualifier ;
2623import org .springframework .context .annotation .Conditional ;
2724import org .springframework .context .annotation .Primary ;
2825import org .springframework .security .core .GrantedAuthority ;
2926import org .springframework .security .core .authority .SimpleGrantedAuthority ;
30- import org .springframework .security .oauth2 .client .userinfo .DefaultOAuth2UserService ;
3127import org .springframework .security .oauth2 .client .userinfo .OAuth2UserRequest ;
3228import org .springframework .security .oauth2 .client .userinfo .OAuth2UserService ;
3329import org .springframework .security .oauth2 .core .OAuth2AuthenticationException ;
@@ -47,8 +43,7 @@ public class OauthUserService implements OAuth2UserService<OAuth2UserRequest, OA
4743
4844 private final UserManagementService ums ;
4945
50- @ Qualifier ("defaultOauthService" )
51- private final OAuth2UserService <OAuth2UserRequest , OAuth2User > delegate ;
46+ @ Qualifier ("defaultOauthService" ) private final OAuth2UserService <OAuth2UserRequest , OAuth2User > delegate ;
5247
5348 @ Transactional
5449 @ Override
@@ -71,7 +66,8 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
7166
7267 var username = attrs .get (userNameAttributeName ).toString ();
7368 final var registrationId = userRequest .getClientRegistration ().getClientId ();
74- final var oauth2PlaceholderEmail = "generated-" + username + registrationId + "@noemail.invalid" ;
69+ final var oauth2PlaceholderEmail =
70+ "generated-" + username + registrationId + "@noemail.invalid" ;
7571
7672 Supplier <User > signup = () -> {
7773 try {
@@ -101,10 +97,12 @@ else if (username != null && !username.isEmpty()) {
10197 throw new RuntimeException ("Error with user signup/signin" );
10298 }
10399
104- int userRole = (user .getRole () == null || user .getRole ().getId () == null ) ? 0 : user .getRole ().getId ();
100+ int userRole =
101+ (user .getRole () == null || user .getRole ().getId () == null ) ? 0 : user .getRole ().getId ();
105102
106103 GrantedAuthority authority = new SimpleGrantedAuthority (URole .values ()[userRole ].toString ());
107- var attributes = customAttribute (attrs , userNameAttributeName , user .getUserId (), registrationId );
104+ var attributes =
105+ customAttribute (attrs , userNameAttributeName , user .getUserId (), registrationId );
108106
109107 return new DefaultOAuth2User (Collections .singletonList (authority ), attributes ,
110108 userNameAttributeName );
0 commit comments