private List<ScopeDTO> buildScopeDTO(Map<String, List<String>> scopeClaimMap, int tenantId) { List<ScopeDTO> oidcScopeClaimList = new ArrayList<>(); for (Map.Entry<String, List<String>> scopeClaimEntry : scopeClaimMap.entrySet()) { ScopeDTO scopeDTO = new ScopeDTO(); String scopeName = scopeClaimEntry.getKey(); List<String> claimsList = scopeClaimEntry.getValue(); scopeDTO.setName(scopeClaimEntry.getKey()); if (CollectionUtils.isNotEmpty(claimsList)) { scopeDTO.setClaim(claimsList.toArray(new String[claimsList.size()])); } oidcScopeClaimList.add(scopeDTO); if (log.isDebugEnabled()) { log.debug("The scope: " + scopeName + " and the claims: " + String.join(",", claimsList) + "are successfully" + " loaded for the tenant: " + tenantId); } } return oidcScopeClaimList; } }
@Override public ScopeDTO getClaims(String scope, int tenantId) throws IdentityOAuth2Exception { String sql = SQLQueries.GET_IDN_OIDC_CLAIMS; JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate(); ScopeDTO scopeDTO = new ScopeDTO(); try { List<String> claimsList = jdbcTemplate.executeQuery(sql, (resultSet, i) -> resultSet.getString(1) , preparedStatement -> { preparedStatement.setString(1, scope); preparedStatement.setInt(2, tenantId); }); scopeDTO.setName(scope); String[] claimsArr = new String[claimsList.size()]; scopeDTO.setClaim(claimsList.toArray(claimsArr)); } catch (DataAccessException e) { String errorMessage = "Error while loading OIDC claims for the scope: " + scope; throw new IdentityOAuth2Exception(errorMessage, e); } return scopeDTO; }
"id")); scope.setName(configType); scope.setClaim(loadClaimConfig(omElement)); listOIDCScopesClaims.add(scope);