|
1 | 1 | package org.mitre.openid.connect.service;
|
2 | 2 |
|
3 |
| -import java.util.List; |
| 3 | +import java.util.HashSet; |
4 | 4 | import java.util.Map;
|
5 | 5 | import java.util.Set;
|
6 | 6 |
|
7 |
| -import com.google.common.collect.ArrayListMultimap; |
8 |
| -import com.google.common.collect.Lists; |
| 7 | +import com.google.common.collect.HashMultimap; |
9 | 8 | import com.google.common.collect.Maps;
|
| 9 | +import com.google.common.collect.SetMultimap; |
10 | 10 |
|
11 | 11 | /**
|
12 | 12 | * Service to map scopes to claims, and claims to Java field names
|
|
16 | 16 | */
|
17 | 17 | public class ScopeClaimTranslationService {
|
18 | 18 |
|
19 |
| -private ArrayListMultimap<String, String> scopesToClaims = ArrayListMultimap.create(); |
| 19 | +private SetMultimap<String, String> scopesToClaims = HashMultimap.create(); |
20 | 20 | private Map<String, String> claimsToFields = Maps.newHashMap();
|
21 | 21 |
|
22 | 22 | /**
|
@@ -76,12 +76,16 @@ public ScopeClaimTranslationService() {
|
76 | 76 |
|
77 | 77 | }
|
78 | 78 |
|
79 |
| -public List<String> getClaimsForScope(String scope) { |
80 |
| -return scopesToClaims.get(scope); |
| 79 | +public Set<String> getClaimsForScope(String scope) { |
| 80 | +if (scopesToClaims.containsKey(scope)) { |
| 81 | +return scopesToClaims.get(scope); |
| 82 | +} else { |
| 83 | +return new HashSet<String>(); |
| 84 | +} |
81 | 85 | }
|
82 | 86 |
|
83 |
| -public List<String> getClaimsForScopeSet(Set<String> scopes) { |
84 |
| -List<String> result = Lists.newArrayList(); |
| 87 | +public Set<String> getClaimsForScopeSet(Set<String> scopes) { |
| 88 | +Set<String> result = new HashSet<String>(); |
85 | 89 | for (String scope : scopes) {
|
86 | 90 | result.addAll(getClaimsForScope(scope));
|
87 | 91 | }
|
|
0 commit comments