added null check to confirmation controller, closes #684
parent
e814c3abd4
commit
188818dc0d
|
@ -153,21 +153,23 @@ public class OAuthConfirmationController {
|
|||
|
||||
// get the userinfo claims for each scope
|
||||
UserInfo user = userInfoService.getByUsername(p.getName());
|
||||
JsonObject userJson = user.toJson();
|
||||
Map<String, Map<String, String>> claimsForScopes = new HashMap<String, Map<String, String>>();
|
||||
|
||||
for (SystemScope systemScope : sortedScopes) {
|
||||
Map<String, String> claimValues = new HashMap<String, String>();
|
||||
|
||||
Set<String> claims = scopeClaimTranslationService.getClaimsForScope(systemScope.getValue());
|
||||
for (String claim : claims) {
|
||||
if (userJson.has(claim) && userJson.get(claim).isJsonPrimitive()) {
|
||||
// TODO: this skips the address claim
|
||||
claimValues.put(claim, userJson.get(claim).getAsString());
|
||||
if (user != null) {
|
||||
JsonObject userJson = user.toJson();
|
||||
|
||||
for (SystemScope systemScope : sortedScopes) {
|
||||
Map<String, String> claimValues = new HashMap<String, String>();
|
||||
|
||||
Set<String> claims = scopeClaimTranslationService.getClaimsForScope(systemScope.getValue());
|
||||
for (String claim : claims) {
|
||||
if (userJson.has(claim) && userJson.get(claim).isJsonPrimitive()) {
|
||||
// TODO: this skips the address claim
|
||||
claimValues.put(claim, userJson.get(claim).getAsString());
|
||||
}
|
||||
}
|
||||
|
||||
claimsForScopes.put(systemScope.getValue(), claimValues);
|
||||
}
|
||||
|
||||
claimsForScopes.put(systemScope.getValue(), claimValues);
|
||||
}
|
||||
|
||||
model.put("claims", claimsForScopes);
|
||||
|
|
Loading…
Reference in New Issue