File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
src/main/java/com/example Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -134,11 +134,9 @@ public AuthoritiesExtractor authoritiesExtractor(OAuth2RestOperations template)
134134 String url = (String) map.get("organizations_url");
135135 @SuppressWarnings("unchecked")
136136 List<Map<String, Object>> orgs = template.getForObject(url, List.class);
137- for (Map<String, Object> org : orgs) {
138- if ("spring-projects".equals(org.get("login"))) {
139- return AuthorityUtils
140- .commaSeparatedStringToAuthorityList("ROLE_USER");
141- }
137+ if (orgs.stream()
138+ .anyMatch(org -> "spring-projects".equals(org.get("login")))) {
139+ return AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER");
142140 }
143141 throw new BadCredentialsException("Not in Spring Projects origanization");
144142 };
Original file line number Diff line number Diff line change @@ -62,11 +62,9 @@ public AuthoritiesExtractor authoritiesExtractor(OAuth2RestOperations template)
6262String url = (String ) map .get ("organizations_url" );
6363@ SuppressWarnings ("unchecked" )
6464List <Map <String , Object >> orgs = template .getForObject (url , List .class );
65- for (Map <String , Object > org : orgs ) {
66- if ("spring-projects" .equals (org .get ("login" ))) {
67- return AuthorityUtils
68- .commaSeparatedStringToAuthorityList ("ROLE_USER" );
69- }
65+ if (orgs .stream ()
66+ .anyMatch (org -> "spring-projects" .equals (org .get ("login" )))) {
67+ return AuthorityUtils .commaSeparatedStringToAuthorityList ("ROLE_USER" );
7068}
7169throw new BadCredentialsException ("Not in Spring Team" );
7270};
You can’t perform that action at this time.
0 commit comments