@@ -21,21 +21,25 @@ public class GithubOAuthUserDetails extends User implements UserDetails {
21
21
22
22
private static final long serialVersionUID = 1L ;
23
23
24
+ private boolean hasGrantedAuthorities ;
25
+
24
26
private final GithubAuthenticationToken authenticationToken ;
25
27
26
28
public GithubOAuthUserDetails (@ Nonnull String login , @ Nonnull GrantedAuthority [] authorities ) {
27
29
super (login , "" , true , true , true , true , authorities );
28
30
this .authenticationToken = null ;
31
+ this .hasGrantedAuthorities = true ;
29
32
}
30
33
31
34
public GithubOAuthUserDetails (@ Nonnull String login , @ Nonnull GithubAuthenticationToken authenticationToken ) {
32
- super (login , "" , true , true , true , true , null );
35
+ super (login , "" , true , true , true , true , new GrantedAuthority [ 0 ] );
33
36
this .authenticationToken = authenticationToken ;
37
+ this .hasGrantedAuthorities = false ;
34
38
}
35
39
36
40
@ Override
37
41
public GrantedAuthority [] getAuthorities () {
38
- if (super . getAuthorities () == null ) {
42
+ if (! hasGrantedAuthorities ) {
39
43
try {
40
44
GHUser user = authenticationToken .loadUser (getUsername ());
41
45
setAuthorities (authenticationToken .getGrantedAuthorities (user ));
0 commit comments